From ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwordquiz/src/dlgspecchar.cpp | 82 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 kwordquiz/src/dlgspecchar.cpp (limited to 'kwordquiz/src/dlgspecchar.cpp') diff --git a/kwordquiz/src/dlgspecchar.cpp b/kwordquiz/src/dlgspecchar.cpp new file mode 100644 index 00000000..e35fe236 --- /dev/null +++ b/kwordquiz/src/dlgspecchar.cpp @@ -0,0 +1,82 @@ +/*************************************************************************** + dlglspecchar.cpp - description + ------------------- + copyright : (C) 2003 by Peter Hedlund + email : peter.hedlund@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "dlgspecchar.h" + +#include + +#include +#include +#include + +DlgSpecChar::DlgSpecChar( QWidget *parent, const char *name, const QString &_font, const QChar &_chr, bool _modal ) + : KDialogBase( Plain, i18n("Select Character"), User1 | Cancel, User1 , parent, name, _modal ) +{ + initDialog(_chr,_font,true); + + setButtonText( User1, i18n("&Select") ); + setButtonTip( User1, i18n("Select this character") ); + +} + +void DlgSpecChar::initDialog(const QChar &_chr, const QString &_font, bool /*_enableFont*/) +{ + QWidget *page = plainPage(); + + grid = new QGridLayout( page, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + + int t = (_chr.unicode()/256); + + charSelect = new KCharSelect( page, "", _font, _chr, t); + connect(charSelect, SIGNAL(doubleClicked()),this, SLOT(slotDoubleClicked())); + charSelect->resize( charSelect->sizeHint() ); + charSelect->enableFontCombo( false ); + grid->addWidget( charSelect, 0, 0 ); + + grid->addColSpacing( 0, charSelect->width() ); + grid->addRowSpacing( 0, charSelect->height() ); + grid->setRowStretch( 0, 0 ); + charSelect->setFocus(); +} + +DlgSpecChar::~DlgSpecChar() +{ +} + +void DlgSpecChar::closeDialog() +{ + KDialogBase::close(); +} + +QChar DlgSpecChar::chr() +{ + return charSelect->chr(); +} + +void DlgSpecChar::slotDoubleClicked() +{ + emit insertChar(chr()); + closeDialog(); +} + +void DlgSpecChar::slotUser1( ) +{ + emit insertChar(chr()); + closeDialog(); +} + + +#include "dlgspecchar.moc" -- cgit v1.2.1