Commit 7b0c02ca authored by JanKusanagi's avatar JanKusanagi

Added Insert/Cancel buttons

parent 32418bbe
......@@ -37,17 +37,22 @@ CharacterPicker::CharacterPicker(QWidget *parent) : QWidget(parent)
this->resize(savedWindowsize);
}
m_charSelect = new KCharSelect(this, KCharSelect::CharacterTable
| KCharSelect::BlockCombos
| KCharSelect::SearchLine
| KCharSelect::FontSize); // FIXME: make optional
m_charSelect = new KCharSelect(this,
// FIXME: use the other constructor to handle Find action
KCharSelect::CharacterTable
| KCharSelect::BlockCombos
| KCharSelect::SearchLine
| KCharSelect::FontSize);
m_charSelect->setAllPlanesEnabled(true);
// Select the first symbol from the Emoticons block
m_charSelect->setCurrentCodePoint(0x1F600);
QFont charFont = m_charSelect->currentFont();
charFont.setPointSize(settings.value("CharacterPicker/charPickerFontSize",
24).toInt());
m_charSelect->setCurrentFont(charFont);
connect(m_charSelect, &KCharSelect::currentCodePointChanged,
this, &CharacterPicker::onCodePointChanged);
// To allow selecting the first symbol on the list, preselected...
......@@ -60,9 +65,30 @@ CharacterPicker::CharacterPicker(QWidget *parent) : QWidget(parent)
.toBool());
// Insert / Cancel buttons
m_insertButton = new QPushButton(QIcon::fromTheme("insert-image",
QIcon(":/images/list-add.png")),
tr("&Insert Symbol"),
this);
//connect(m_insertButton, &QAbstractButton::clicked,
// this, &CharacterPicker::close); ///////////////// TMP FIXME
m_cancelButton = new QPushButton(QIcon::fromTheme("dialog-cancel",
QIcon(":/images/button-cancel.png")),
tr("&Cancel"),
this);
connect(m_cancelButton, &QAbstractButton::clicked,
this, &QWidget::close);
m_buttonBox = new QDialogButtonBox(this);
m_buttonBox->addButton(m_insertButton, QDialogButtonBox::AcceptRole);
m_buttonBox->addButton(m_cancelButton, QDialogButtonBox::RejectRole);
m_mainLayout = new QVBoxLayout();
m_mainLayout->addWidget(m_charSelect);
m_mainLayout->addWidget(m_makeBigCheckbox);
m_mainLayout->addWidget(m_buttonBox);
this->setLayout(m_mainLayout);
......
......@@ -26,6 +26,7 @@
#include <KCharSelect>
#include <QPushButton>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QAction>
#include <QCloseEvent>
#include <QSettings>
......@@ -64,6 +65,9 @@ private:
int m_fontSize;
QAction *m_closeAction;
QDialogButtonBox *m_buttonBox;
QPushButton *m_insertButton;
QPushButton *m_cancelButton;
};
#endif // CHARACTERPICKER_H
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