20 #include "selectspecialchar.h"
21 #include <KCharSelect>
22 #include <KLocalizedString>
23 #include <QHBoxLayout>
25 namespace KPIMTextEdit {
27 class SelectSpecialCharPrivate
30 SelectSpecialCharPrivate( SelectSpecialChar *qq )
33 q->setCaption( i18n(
"Select Special Characters" ) );
34 q->setButtons( KDialog::Close|KDialog::User1 );
35 q->setButtonText( KDialog::User1, i18n(
"Select" ) );
37 q->setMainWidget( page );
39 mCharSelect =
new KCharSelect( q, 0, KCharSelect::CharacterTable|KCharSelect::BlockCombos );
40 q->connect( mCharSelect, SIGNAL(charSelected(
QChar)),
41 q, SIGNAL(charSelected(
QChar)) );
43 q->connect( q, SIGNAL(user1Clicked()),
44 q, SLOT(_k_slotInsertChar()) );
45 q->connect( q, SIGNAL(okClicked()),
46 q, SLOT(_k_slotInsertChar()) );
49 void _k_slotInsertChar();
51 KCharSelect *mCharSelect;
55 void SelectSpecialCharPrivate::_k_slotInsertChar()
57 Q_EMIT q->charSelected( mCharSelect->currentChar() );
60 SelectSpecialChar::SelectSpecialChar(
QWidget *parent )
61 : KDialog( parent ), d( new SelectSpecialCharPrivate( this ) )
65 SelectSpecialChar::~SelectSpecialChar()
70 void SelectSpecialChar::showSelectButton(
bool show )
73 setButtons( Close|User1 );
75 setButtons( Ok|Cancel );
79 void SelectSpecialChar::setCurrentChar(
const QChar &c )
81 d->mCharSelect->setCurrentChar(c);
84 QChar SelectSpecialChar::currentChar()
const
86 return d->mCharSelect->currentChar();
89 void SelectSpecialChar::autoInsertChar()
91 connect( d->mCharSelect, SIGNAL(charSelected(
QChar)), SLOT(accept()) );
94 void SelectSpecialChar::setOkButtonText(
const QString &text )
96 setButtonText( KDialog::User1, text );
101 #include "moc_selectspecialchar.cpp"