Commit fac98a88 authored by JanKusanagi's avatar JanKusanagi

Use optional CharacterPicker in Publisher

parent 349be243
......@@ -157,6 +157,17 @@ Publisher::Publisher(PumpController *pumpController,
// Add formatting button exported from Composer
m_toolsButton = m_composerBox->getToolsButton();
#ifdef HAVE_KCHARSELECT
m_charPickerButton = new QPushButton(QIcon::fromTheme("face-smile",
QIcon(":/images/list-add.png")),
QString(), this);
m_charPickerButton->setSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred);
// Kinda TMP, enforce a certain width -- FIXME
m_charPickerButton->setMinimumWidth(m_charPickerButton->iconSize().width() * 3);
connect(m_charPickerButton, &QPushButton::clicked,
this, &Publisher::showCharacterPicker);
#endif
// Add menu and submenus to access drafts from the Draft Manager
m_draftsManager = new DraftsManager(m_globalObject, this);
......@@ -316,6 +327,10 @@ Publisher::Publisher(PumpController *pumpController,
m_titleLayout->addSpacing(2);
m_titleLayout->addWidget(m_toolsButton, 0);
m_titleLayout->addSpacing(2);
#ifdef HAVE_KCHARSELECT
m_titleLayout->addWidget(m_charPickerButton, 0);
m_titleLayout->addSpacing(2);
#endif
m_titleLayout->addWidget(m_draftsButton, 0);
m_mediaLayout = new QGridLayout();
......@@ -863,6 +878,9 @@ void Publisher::setMinimumMode()
m_titleLineEdit->hide();
m_toolsButton->hide();
#ifdef HAVE_KCHARSELECT
m_charPickerButton->hide();
#endif
m_draftsButton->hide();
// Disable possible scrollbars
......@@ -970,6 +988,9 @@ void Publisher::setFullMode()
m_titleLineEdit->show();
m_toolsButton->show();
#ifdef HAVE_KCHARSELECT
m_charPickerButton->show();
#endif
m_draftsButton->show();
m_composerBox->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
......@@ -1686,3 +1707,13 @@ void Publisher::updateCharacterCounter()
int charCount = m_composerBox->textCursor().document()->characterCount() - 1;
m_charCounterLabel->setText(QLocale::system().toString(charCount));
}
#ifdef HAVE_KCHARSELECT
void Publisher::showCharacterPicker()
{
m_characterPicker = new CharacterPicker(this);
connect(m_characterPicker, &CharacterPicker::characterSelected,
m_composerBox, &Composer::insertHtml);
m_characterPicker->show();
}
#endif
......@@ -41,6 +41,10 @@
#include "audienceselector.h"
#include "draftsmanager.h"
#ifdef HAVE_KCHARSELECT
#include "characterpicker.h"
#endif
class Publisher : public QWidget
{
......@@ -124,6 +128,10 @@ public slots:
void updateCharacterCounter();
#ifdef HAVE_KCHARSELECT
void showCharacterPicker();
#endif
private:
QVBoxLayout *m_mainLayout;
......@@ -142,6 +150,11 @@ private:
QPushButton *m_toolsButton;
#ifdef HAVE_KCHARSELECT
QPushButton *m_charPickerButton;
CharacterPicker *m_characterPicker;
#endif
DraftsManager *m_draftsManager;
QMenu *m_draftsMenu;
QPushButton *m_draftsButton;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment