-rw-r--r-- | core/launcher/inputmethods.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 24669ac..9e2a11d 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp @@ -1,179 +1,179 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "inputmethods.h" /* OPIE */ #include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> using namespace Opie::Core; /* QT */ #include <qpopupmenu.h> #include <qtoolbutton.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qdir.h> #include <qtl.h> #ifdef Q_WS_QWS #include <qwindowsystem_qws.h> #include <qwsevent_qws.h> #include <qcopchannel_qws.h> #endif /* STD */ #include <stdlib.h> /* XPM */ static const char * tri_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".........", "....a....", "...aaa...", "..aaaaa..", ".aaaaaaa.", ".........", "........."}; int InputMethod::operator <(const InputMethod& o) const { return name() < o.name(); } int InputMethod::operator >(const InputMethod& o) const { return name() > o.name(); } int InputMethod::operator <=(const InputMethod& o) const { return name() <= o.name(); } /* Slightly hacky: We use WStyle_Tool as a flag to say "this widget belongs to the IM system, so clicking it should not cause a reset". */ class IMToolButton : public QToolButton { public: - IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) + IMToolButton( QWidget *parent ) : QToolButton( parent ) { setWFlags( WStyle_Tool ); setBackgroundOrigin( ParentOrigin ); setBackgroundMode( PaletteBackground ); } }; InputMethods::InputMethods( QWidget *parent ) : QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), mkeyboard(0), imethod(0) { readConfig(); setBackgroundOrigin( ParentOrigin ); setBackgroundMode( PaletteBackground ); QHBoxLayout *hbox = new QHBoxLayout( this ); kbdButton = new IMToolButton( this); kbdButton->setFocusPolicy(NoFocus); kbdButton->setToggleButton( TRUE ); if (parent->sizeHint().height() > 0) kbdButton->setFixedHeight( parent->sizeHint().height() ); kbdButton->setFixedWidth( 32 ); kbdButton->setAutoRaise( TRUE ); kbdButton->setUsesBigPixmap( TRUE ); hbox->addWidget( kbdButton ); connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); kbdChoice = new IMToolButton( this ); kbdChoice->setFocusPolicy(NoFocus); kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); if (parent->sizeHint().height() > 0) kbdChoice->setFixedHeight( parent->sizeHint().height() ); kbdChoice->setFixedWidth( 13 ); kbdChoice->setAutoRaise( TRUE ); hbox->addWidget( kbdChoice ); connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), this, SLOT(resetStates()) ); imButton = new QWidgetStack( this ); // later a widget stack imButton->setFocusPolicy(NoFocus); if (parent->sizeHint().height() > 0) imButton->setFixedHeight( parent->sizeHint().height() ); hbox->addWidget(imButton); imChoice = new QToolButton( this ); imChoice->setFocusPolicy(NoFocus); imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); if (parent->sizeHint().height() > 0) imChoice->setFixedHeight( parent->sizeHint().height() ); imChoice->setFixedWidth( 13 ); imChoice->setAutoRaise( TRUE ); hbox->addWidget( imChoice ); connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); loadInputMethods(); QCopChannel *channel = new QCopChannel( "QPE/IME", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); } InputMethods::~InputMethods() { Config cfg("qpe"); cfg.setGroup("InputMethod"); if (imethod) cfg.writeEntry("im", imethod->name() ); if (mkeyboard) cfg.writeEntry("current", mkeyboard->name() ); unloadInputMethods(); } void InputMethods::hideInputMethod() { kbdButton->setOn( FALSE ); } void InputMethods::showInputMethod() { kbdButton->setOn( TRUE ); } void InputMethods::showInputMethod(const QString& name) { int i = 0; QValueList<InputMethod>::Iterator it; InputMethod *im = 0; for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); if ( (*it).name() == name || lname == name ) { im = &(*it); |