diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/charSelector.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/charSelector.cpp')
-rw-r--r-- | ksirc/charSelector.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/ksirc/charSelector.cpp b/ksirc/charSelector.cpp new file mode 100644 index 00000000..6cfe09a4 --- /dev/null +++ b/ksirc/charSelector.cpp @@ -0,0 +1,77 @@ +/* ascii table for ksirc - Robbie Ward <[email protected]>*/ + +#include "charSelector.h" +#include "charSelector.moc" + +#include <qlayout.h> +#include <qpushbutton.h> + +#include <klocale.h> + +charSelector::charSelector(QWidget *parent, const char* name) + : KDialog(parent, name, false) +{ + testLayout = new QVBoxLayout(this); + testLayout->setSpacing( spacingHint() ); + testLayout->setMargin( marginHint() ); + + charSelect = new KCharSelect(this, QCString(name) + "_kcharselector", "", 0); + testLayout->addWidget(charSelect); + charSelect->installEventFilter(this); + + connect(charSelect, SIGNAL(doubleClicked()), SLOT(insertText())); + + QHBoxLayout *buttonLayout = new QHBoxLayout; + buttonLayout->setSpacing( spacingHint() ); + + insertButton = new QPushButton(i18n("&Insert Char"), this); + connect(insertButton, SIGNAL(clicked()), SLOT(insertText())); + buttonLayout->addWidget(insertButton); + + QSpacerItem *spacer = new QSpacerItem(50, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); + buttonLayout->addItem(spacer); + + testLayout->addLayout(buttonLayout); +} + +charSelector::~charSelector() +{ + delete charSelect; + charSelect = 0x0; +} + +void charSelector::insertText() +{ + emit clicked(); +} + +void charSelector::setFont( const QString &font ) +{ + charSelect->setFont(font); +} + +void charSelector::reject() +{ + KDialog::reject(); + close(); +} + +void charSelector::keyPressEvent(QKeyEvent *e) +{ + KDialog::keyPressEvent(e); +} + +bool charSelector::eventFilter ( QObject *, QEvent * e ) +{ + if ( e->type() == QEvent::AccelOverride ) { + // special processing for key press + QKeyEvent *k = (QKeyEvent *)e; + if(k->key() == Key_Escape){ + keyPressEvent(k); + return TRUE; // eat event + } + } + // standard event processing + return FALSE; +} + |