author | mickeyl <mickeyl> | 2006-05-25 22:17:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2006-05-25 22:17:56 (UTC) |
commit | 3939f306b734491e04ee3df7043302bd0990df05 (patch) (unidiff) | |
tree | 519da8af233b8a07ca95049deb936dd17df4b8fe | |
parent | db458e08c0dbd03f575c2c99592a828e3791abd5 (diff) | |
download | opie-3939f306b734491e04ee3df7043302bd0990df05.zip opie-3939f306b734491e04ee3df7043302bd0990df05.tar.gz opie-3939f306b734491e04ee3df7043302bd0990df05.tar.bz2 |
g++ 4.1.1 fix
-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,631 +1,631 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_LANGLIST | 21 | #define QTOPIA_INTERNAL_LANGLIST |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | 23 | ||
24 | /* OPIE */ | 24 | /* OPIE */ |
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | using namespace Opie::Core; | 29 | using namespace Opie::Core; |
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
34 | #include <qwidgetstack.h> | 34 | #include <qwidgetstack.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | #include <qtl.h> | 37 | #include <qtl.h> |
38 | #ifdef Q_WS_QWS | 38 | #ifdef Q_WS_QWS |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #include <qwsevent_qws.h> | 40 | #include <qwsevent_qws.h> |
41 | #include <qcopchannel_qws.h> | 41 | #include <qcopchannel_qws.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | /* XPM */ | 47 | /* XPM */ |
48 | static const char * tri_xpm[]={ | 48 | static const char * tri_xpm[]={ |
49 | "9 9 2 1", | 49 | "9 9 2 1", |
50 | "a c #000000", | 50 | "a c #000000", |
51 | ". c None", | 51 | ". c None", |
52 | ".........", | 52 | ".........", |
53 | ".........", | 53 | ".........", |
54 | ".........", | 54 | ".........", |
55 | "....a....", | 55 | "....a....", |
56 | "...aaa...", | 56 | "...aaa...", |
57 | "..aaaaa..", | 57 | "..aaaaa..", |
58 | ".aaaaaaa.", | 58 | ".aaaaaaa.", |
59 | ".........", | 59 | ".........", |
60 | "........."}; | 60 | "........."}; |
61 | 61 | ||
62 | int InputMethod::operator <(const InputMethod& o) const | 62 | int InputMethod::operator <(const InputMethod& o) const |
63 | { | 63 | { |
64 | return name() < o.name(); | 64 | return name() < o.name(); |
65 | } | 65 | } |
66 | int InputMethod::operator >(const InputMethod& o) const | 66 | int InputMethod::operator >(const InputMethod& o) const |
67 | { | 67 | { |
68 | return name() > o.name(); | 68 | return name() > o.name(); |
69 | } | 69 | } |
70 | int InputMethod::operator <=(const InputMethod& o) const | 70 | int InputMethod::operator <=(const InputMethod& o) const |
71 | { | 71 | { |
72 | return name() <= o.name(); | 72 | return name() <= o.name(); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | /* | 76 | /* |
77 | Slightly hacky: We use WStyle_Tool as a flag to say "this widget | 77 | Slightly hacky: We use WStyle_Tool as a flag to say "this widget |
78 | belongs to the IM system, so clicking it should not cause a reset". | 78 | belongs to the IM system, so clicking it should not cause a reset". |
79 | */ | 79 | */ |
80 | class IMToolButton : public QToolButton | 80 | class IMToolButton : public QToolButton |
81 | { | 81 | { |
82 | public: | 82 | public: |
83 | IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) | 83 | IMToolButton( QWidget *parent ) : QToolButton( parent ) |
84 | { setWFlags( WStyle_Tool ); | 84 | { setWFlags( WStyle_Tool ); |
85 | setBackgroundOrigin( ParentOrigin ); | 85 | setBackgroundOrigin( ParentOrigin ); |
86 | setBackgroundMode( PaletteBackground ); | 86 | setBackgroundMode( PaletteBackground ); |
87 | } | 87 | } |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | InputMethods::InputMethods( QWidget *parent ) : | 91 | InputMethods::InputMethods( QWidget *parent ) : |
92 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), | 92 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), |
93 | mkeyboard(0), imethod(0) | 93 | mkeyboard(0), imethod(0) |
94 | { | 94 | { |
95 | readConfig(); | 95 | readConfig(); |
96 | 96 | ||
97 | setBackgroundOrigin( ParentOrigin ); | 97 | setBackgroundOrigin( ParentOrigin ); |
98 | setBackgroundMode( PaletteBackground ); | 98 | setBackgroundMode( PaletteBackground ); |
99 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 99 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
100 | 100 | ||
101 | kbdButton = new IMToolButton( this); | 101 | kbdButton = new IMToolButton( this); |
102 | kbdButton->setFocusPolicy(NoFocus); | 102 | kbdButton->setFocusPolicy(NoFocus); |
103 | kbdButton->setToggleButton( TRUE ); | 103 | kbdButton->setToggleButton( TRUE ); |
104 | if (parent->sizeHint().height() > 0) | 104 | if (parent->sizeHint().height() > 0) |
105 | kbdButton->setFixedHeight( parent->sizeHint().height() ); | 105 | kbdButton->setFixedHeight( parent->sizeHint().height() ); |
106 | kbdButton->setFixedWidth( 32 ); | 106 | kbdButton->setFixedWidth( 32 ); |
107 | kbdButton->setAutoRaise( TRUE ); | 107 | kbdButton->setAutoRaise( TRUE ); |
108 | kbdButton->setUsesBigPixmap( TRUE ); | 108 | kbdButton->setUsesBigPixmap( TRUE ); |
109 | hbox->addWidget( kbdButton ); | 109 | hbox->addWidget( kbdButton ); |
110 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); | 110 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); |
111 | 111 | ||
112 | kbdChoice = new IMToolButton( this ); | 112 | kbdChoice = new IMToolButton( this ); |
113 | kbdChoice->setFocusPolicy(NoFocus); | 113 | kbdChoice->setFocusPolicy(NoFocus); |
114 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); | 114 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); |
115 | if (parent->sizeHint().height() > 0) | 115 | if (parent->sizeHint().height() > 0) |
116 | kbdChoice->setFixedHeight( parent->sizeHint().height() ); | 116 | kbdChoice->setFixedHeight( parent->sizeHint().height() ); |
117 | kbdChoice->setFixedWidth( 13 ); | 117 | kbdChoice->setFixedWidth( 13 ); |
118 | kbdChoice->setAutoRaise( TRUE ); | 118 | kbdChoice->setAutoRaise( TRUE ); |
119 | hbox->addWidget( kbdChoice ); | 119 | hbox->addWidget( kbdChoice ); |
120 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); | 120 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); |
121 | 121 | ||
122 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), | 122 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), |
123 | this, SLOT(resetStates()) ); | 123 | this, SLOT(resetStates()) ); |
124 | 124 | ||
125 | 125 | ||
126 | imButton = new QWidgetStack( this ); // later a widget stack | 126 | imButton = new QWidgetStack( this ); // later a widget stack |
127 | imButton->setFocusPolicy(NoFocus); | 127 | imButton->setFocusPolicy(NoFocus); |
128 | if (parent->sizeHint().height() > 0) | 128 | if (parent->sizeHint().height() > 0) |
129 | imButton->setFixedHeight( parent->sizeHint().height() ); | 129 | imButton->setFixedHeight( parent->sizeHint().height() ); |
130 | hbox->addWidget(imButton); | 130 | hbox->addWidget(imButton); |
131 | 131 | ||
132 | imChoice = new QToolButton( this ); | 132 | imChoice = new QToolButton( this ); |
133 | imChoice->setFocusPolicy(NoFocus); | 133 | imChoice->setFocusPolicy(NoFocus); |
134 | imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); | 134 | imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); |
135 | if (parent->sizeHint().height() > 0) | 135 | if (parent->sizeHint().height() > 0) |
136 | imChoice->setFixedHeight( parent->sizeHint().height() ); | 136 | imChoice->setFixedHeight( parent->sizeHint().height() ); |
137 | imChoice->setFixedWidth( 13 ); | 137 | imChoice->setFixedWidth( 13 ); |
138 | imChoice->setAutoRaise( TRUE ); | 138 | imChoice->setAutoRaise( TRUE ); |
139 | hbox->addWidget( imChoice ); | 139 | hbox->addWidget( imChoice ); |
140 | connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); | 140 | connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); |
141 | 141 | ||
142 | loadInputMethods(); | 142 | loadInputMethods(); |
143 | 143 | ||
144 | QCopChannel *channel = new QCopChannel( "QPE/IME", this ); | 144 | QCopChannel *channel = new QCopChannel( "QPE/IME", this ); |
145 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 145 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
146 | this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); | 146 | this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); |
147 | } | 147 | } |
148 | 148 | ||
149 | InputMethods::~InputMethods() | 149 | InputMethods::~InputMethods() |
150 | { | 150 | { |
151 | Config cfg("qpe"); | 151 | Config cfg("qpe"); |
152 | cfg.setGroup("InputMethod"); | 152 | cfg.setGroup("InputMethod"); |
153 | if (imethod) | 153 | if (imethod) |
154 | cfg.writeEntry("im", imethod->name() ); | 154 | cfg.writeEntry("im", imethod->name() ); |
155 | if (mkeyboard) | 155 | if (mkeyboard) |
156 | cfg.writeEntry("current", mkeyboard->name() ); | 156 | cfg.writeEntry("current", mkeyboard->name() ); |
157 | 157 | ||
158 | unloadInputMethods(); | 158 | unloadInputMethods(); |
159 | } | 159 | } |
160 | 160 | ||
161 | void InputMethods::hideInputMethod() | 161 | void InputMethods::hideInputMethod() |
162 | { | 162 | { |
163 | kbdButton->setOn( FALSE ); | 163 | kbdButton->setOn( FALSE ); |
164 | } | 164 | } |
165 | 165 | ||
166 | void InputMethods::showInputMethod() | 166 | void InputMethods::showInputMethod() |
167 | { | 167 | { |
168 | kbdButton->setOn( TRUE ); | 168 | kbdButton->setOn( TRUE ); |
169 | } | 169 | } |
170 | 170 | ||
171 | void InputMethods::showInputMethod(const QString& name) | 171 | void InputMethods::showInputMethod(const QString& name) |
172 | { | 172 | { |
173 | int i = 0; | 173 | int i = 0; |
174 | QValueList<InputMethod>::Iterator it; | 174 | QValueList<InputMethod>::Iterator it; |
175 | InputMethod *im = 0; | 175 | InputMethod *im = 0; |
176 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { | 176 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { |
177 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); | 177 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); |
178 | if ( (*it).name() == name || lname == name ) { | 178 | if ( (*it).name() == name || lname == name ) { |
179 | im = &(*it); | 179 | im = &(*it); |
180 | break; | 180 | break; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | if ( im ) | 183 | if ( im ) |
184 | chooseKeyboard(im); | 184 | chooseKeyboard(im); |
185 | } | 185 | } |
186 | 186 | ||
187 | void InputMethods::resetStates() | 187 | void InputMethods::resetStates() |
188 | { | 188 | { |
189 | if ( mkeyboard && !mkeyboard->newIM ) | 189 | if ( mkeyboard && !mkeyboard->newIM ) |
190 | mkeyboard->interface->resetState(); | 190 | mkeyboard->interface->resetState(); |
191 | } | 191 | } |
192 | 192 | ||
193 | QRect InputMethods::inputRect() const | 193 | QRect InputMethods::inputRect() const |
194 | { | 194 | { |
195 | if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) | 195 | if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) |
196 | return QRect(); | 196 | return QRect(); |
197 | else | 197 | else |
198 | return mkeyboard->widget->geometry(); | 198 | return mkeyboard->widget->geometry(); |
199 | } | 199 | } |
200 | 200 | ||
201 | void InputMethods::unloadInputMethods() | 201 | void InputMethods::unloadInputMethods() |
202 | { | 202 | { |
203 | unloadMethod( inputMethodList ); | 203 | unloadMethod( inputMethodList ); |
204 | unloadMethod( inputModifierList ); | 204 | unloadMethod( inputModifierList ); |
205 | inputMethodList.clear(); | 205 | inputMethodList.clear(); |
206 | inputModifierList.clear(); | 206 | inputModifierList.clear(); |
207 | 207 | ||
208 | } | 208 | } |
209 | 209 | ||
210 | void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { | 210 | void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { |
211 | QValueList<InputMethod>::Iterator it; | 211 | QValueList<InputMethod>::Iterator it; |
212 | 212 | ||
213 | for (it = list.begin(); it != list.end(); ++it ) | 213 | for (it = list.begin(); it != list.end(); ++it ) |
214 | (*it).releaseInterface(); | 214 | (*it).releaseInterface(); |
215 | 215 | ||
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | QStringList InputMethods::plugins()const { | 219 | QStringList InputMethods::plugins()const { |
220 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; | 220 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; |
221 | #ifdef Q_OS_MACX | 221 | #ifdef Q_OS_MACX |
222 | QDir dir( path, "lib*.dylib" ); | 222 | QDir dir( path, "lib*.dylib" ); |
223 | #else | 223 | #else |
224 | QDir dir( path, "lib*.so" ); | 224 | QDir dir( path, "lib*.so" ); |
225 | #endif /* Q_OS_MACX */ | 225 | #endif /* Q_OS_MACX */ |
226 | return dir.entryList(); | 226 | return dir.entryList(); |
227 | } | 227 | } |
228 | 228 | ||
229 | void InputMethods::installTranslator( const QString& type ) { | 229 | void InputMethods::installTranslator( const QString& type ) { |
230 | QStringList langs = Global::languageList(); | 230 | QStringList langs = Global::languageList(); |
231 | QStringList::ConstIterator lit; | 231 | QStringList::ConstIterator lit; |
232 | for ( lit= langs.begin(); lit!=langs.end(); ++lit) { | 232 | for ( lit= langs.begin(); lit!=langs.end(); ++lit) { |
233 | QString lang = *lit; | 233 | QString lang = *lit; |
234 | QTranslator * trans = new QTranslator(qApp); | 234 | QTranslator * trans = new QTranslator(qApp); |
235 | 235 | ||
236 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; | 236 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; |
237 | 237 | ||
238 | if ( trans->load( tfn )) | 238 | if ( trans->load( tfn )) |
239 | qApp->installTranslator( trans ); | 239 | qApp->installTranslator( trans ); |
240 | else | 240 | else |
241 | delete trans; | 241 | delete trans; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void InputMethods::setPreferedHandlers() { | 245 | void InputMethods::setPreferedHandlers() { |
246 | Config cfg("qpe"); | 246 | Config cfg("qpe"); |
247 | cfg.setGroup("InputMethod"); | 247 | cfg.setGroup("InputMethod"); |
248 | QString current = cfg.readEntry("current"); | 248 | QString current = cfg.readEntry("current"); |
249 | QString im = cfg.readEntry("im"); | 249 | QString im = cfg.readEntry("im"); |
250 | 250 | ||
251 | QValueList<InputMethod>::Iterator it; | 251 | QValueList<InputMethod>::Iterator it; |
252 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { | 252 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { |
253 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) | 253 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) |
254 | if ( (*it).name() == im ) { | 254 | if ( (*it).name() == im ) { |
255 | imethod = &(*it); break; | 255 | imethod = &(*it); break; |
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { | 259 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { |
260 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) | 260 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) |
261 | if ( (*it).name() == current ) { | 261 | if ( (*it).name() == current ) { |
262 | owarn << "preferred keyboard is " << current << "" << oendl; | 262 | owarn << "preferred keyboard is " << current << "" << oendl; |
263 | mkeyboard = &(*it); | 263 | mkeyboard = &(*it); |
264 | kbdButton->setPixmap( *mkeyboard->icon() ); | 264 | kbdButton->setPixmap( *mkeyboard->icon() ); |
265 | break; | 265 | break; |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | } | 269 | } |
270 | 270 | ||
271 | void InputMethods::loadInputMethods() | 271 | void InputMethods::loadInputMethods() |
272 | { | 272 | { |
273 | #ifndef QT_NO_COMPONENT | 273 | #ifndef QT_NO_COMPONENT |
274 | hideInputMethod(); | 274 | hideInputMethod(); |
275 | mkeyboard = 0; | 275 | mkeyboard = 0; |
276 | 276 | ||
277 | unloadInputMethods(); | 277 | unloadInputMethods(); |
278 | 278 | ||
279 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; | 279 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; |
280 | QStringList list = plugins(); | 280 | QStringList list = plugins(); |
281 | QStringList::Iterator it; | 281 | QStringList::Iterator it; |
282 | for ( it = list.begin(); it != list.end(); ++it ) { | 282 | for ( it = list.begin(); it != list.end(); ++it ) { |
283 | InputMethodInterface *iface = 0; | 283 | InputMethodInterface *iface = 0; |
284 | ExtInputMethodInterface *eface = 0; | 284 | ExtInputMethodInterface *eface = 0; |
285 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 285 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
286 | 286 | ||
287 | if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { | 287 | if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { |
288 | InputMethod input; | 288 | InputMethod input; |
289 | input.newIM = FALSE; | 289 | input.newIM = FALSE; |
290 | input.library = lib; | 290 | input.library = lib; |
291 | input.libName = *it; | 291 | input.libName = *it; |
292 | input.interface = iface; | 292 | input.interface = iface; |
293 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); | 293 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); |
294 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); | 294 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); |
295 | inputMethodList.append( input ); | 295 | inputMethodList.append( input ); |
296 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { | 296 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { |
297 | InputMethod input; | 297 | InputMethod input; |
298 | input.newIM = TRUE; | 298 | input.newIM = TRUE; |
299 | input.library = lib; | 299 | input.library = lib; |
300 | input.libName = *it; | 300 | input.libName = *it; |
301 | input.extInterface = eface; | 301 | input.extInterface = eface; |
302 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); | 302 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); |
303 | // may be either a simple, or advanced. | 303 | // may be either a simple, or advanced. |
304 | if (input.widget) { | 304 | if (input.widget) { |
305 | //odebug << "its a keyboard" << oendl; | 305 | //odebug << "its a keyboard" << oendl; |
306 | inputMethodList.append( input ); | 306 | inputMethodList.append( input ); |
307 | } else { | 307 | } else { |
308 | //odebug << "its a real im" << oendl; | 308 | //odebug << "its a real im" << oendl; |
309 | input.widget = input.extInterface->statusWidget( 0, 0 ); | 309 | input.widget = input.extInterface->statusWidget( 0, 0 ); |
310 | if (input.widget) { | 310 | if (input.widget) { |
311 | //odebug << "blah" << oendl; | 311 | //odebug << "blah" << oendl; |
312 | inputModifierList.append( input ); | 312 | inputModifierList.append( input ); |
313 | imButton->addWidget(input.widget, inputModifierList.count()); | 313 | imButton->addWidget(input.widget, inputModifierList.count()); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | }else{ | 316 | }else{ |
317 | delete lib; | 317 | delete lib; |
318 | lib = 0l; | 318 | lib = 0l; |
319 | } | 319 | } |
320 | installTranslator( (*it).left( (*it).find(".") ) ); | 320 | installTranslator( (*it).left( (*it).find(".") ) ); |
321 | } | 321 | } |
322 | qHeapSort( inputMethodList ); | 322 | qHeapSort( inputMethodList ); |
323 | #endif /* killed BUILT in cause they would not compile */ | 323 | #endif /* killed BUILT in cause they would not compile */ |
324 | 324 | ||
325 | QWSServer::setCurrentInputMethod( 0 ); | 325 | QWSServer::setCurrentInputMethod( 0 ); |
326 | 326 | ||
327 | /* set the prefered IM + handler */ | 327 | /* set the prefered IM + handler */ |
328 | setPreferedHandlers(); | 328 | setPreferedHandlers(); |
329 | if ( !inputModifierList.isEmpty() ) { | 329 | if ( !inputModifierList.isEmpty() ) { |
330 | if (!imethod) | 330 | if (!imethod) |
331 | imethod = &inputModifierList[0]; | 331 | imethod = &inputModifierList[0]; |
332 | imButton->raiseWidget(imethod->widget); | 332 | imButton->raiseWidget(imethod->widget); |
333 | QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); | 333 | QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); |
334 | } else { | 334 | } else { |
335 | imethod = 0; | 335 | imethod = 0; |
336 | } | 336 | } |
337 | 337 | ||
338 | // we need to update keyboards afterwards, as some of them may not be compatible with | 338 | // we need to update keyboards afterwards, as some of them may not be compatible with |
339 | // the current input method | 339 | // the current input method |
340 | updateKeyboards(imethod); | 340 | updateKeyboards(imethod); |
341 | 341 | ||
342 | if ( !inputModifierList.isEmpty() ) | 342 | if ( !inputModifierList.isEmpty() ) |
343 | imButton->show(); | 343 | imButton->show(); |
344 | else | 344 | else |
345 | imButton->hide(); | 345 | imButton->hide(); |
346 | 346 | ||
347 | if ( inputModifierList.count() > 1 ) | 347 | if ( inputModifierList.count() > 1 ) |
348 | imChoice->show(); | 348 | imChoice->show(); |
349 | else | 349 | else |
350 | imChoice->hide(); | 350 | imChoice->hide(); |
351 | } | 351 | } |
352 | 352 | ||
353 | void InputMethods::chooseKbd() | 353 | void InputMethods::chooseKbd() |
354 | { | 354 | { |
355 | QPopupMenu pop( this ); | 355 | QPopupMenu pop( this ); |
356 | pop.setFocusPolicy( NoFocus ); //don't reset IM | 356 | pop.setFocusPolicy( NoFocus ); //don't reset IM |
357 | 357 | ||
358 | QString imname; | 358 | QString imname; |
359 | if (imethod) | 359 | if (imethod) |
360 | imname = imethod->libName.mid(imethod->libName.findRev('/') + 1); | 360 | imname = imethod->libName.mid(imethod->libName.findRev('/') + 1); |
361 | 361 | ||
362 | int i = 0; | 362 | int i = 0; |
363 | int firstDepKbd = 0; | 363 | int firstDepKbd = 0; |
364 | 364 | ||
365 | QValueList<InputMethod>::Iterator it; | 365 | QValueList<InputMethod>::Iterator it; |
366 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { | 366 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { |
367 | // add empty new items, all old items. | 367 | // add empty new items, all old items. |
368 | if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) { | 368 | if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) { |
369 | pop.insertItem( (*it).name(), i, firstDepKbd); | 369 | pop.insertItem( (*it).name(), i, firstDepKbd); |
370 | if ( mkeyboard == &(*it) ) | 370 | if ( mkeyboard == &(*it) ) |
371 | pop.setItemChecked( i, TRUE ); | 371 | pop.setItemChecked( i, TRUE ); |
372 | 372 | ||
373 | firstDepKbd++; | 373 | firstDepKbd++; |
374 | } else if ( (*it).extInterface->compatible().contains(imname)) { | 374 | } else if ( (*it).extInterface->compatible().contains(imname)) { |
375 | // check if we need to insert a sep. | 375 | // check if we need to insert a sep. |
376 | if (firstDepKbd == i) | 376 | if (firstDepKbd == i) |
377 | pop.insertSeparator(); | 377 | pop.insertSeparator(); |
378 | pop.insertItem( (*it).name(), i, -1); | 378 | pop.insertItem( (*it).name(), i, -1); |
379 | if ( mkeyboard == &(*it) ) | 379 | if ( mkeyboard == &(*it) ) |
380 | pop.setItemChecked( i, TRUE ); | 380 | pop.setItemChecked( i, TRUE ); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); | 384 | QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); |
385 | QSize s = pop.sizeHint(); | 385 | QSize s = pop.sizeHint(); |
386 | pt.ry() -= s.height(); | 386 | pt.ry() -= s.height(); |
387 | pt.rx() -= s.width(); | 387 | pt.rx() -= s.width(); |
388 | i = pop.exec( pt ); | 388 | i = pop.exec( pt ); |
389 | if ( i == -1 ) | 389 | if ( i == -1 ) |
390 | return; | 390 | return; |
391 | InputMethod *im = &inputMethodList[i]; | 391 | InputMethod *im = &inputMethodList[i]; |
392 | chooseKeyboard(im); | 392 | chooseKeyboard(im); |
393 | } | 393 | } |
394 | 394 | ||
395 | void InputMethods::chooseIm() | 395 | void InputMethods::chooseIm() |
396 | { | 396 | { |
397 | QPopupMenu pop( this ); | 397 | QPopupMenu pop( this ); |
398 | 398 | ||
399 | int i = 0; | 399 | int i = 0; |
400 | QValueList<InputMethod>::Iterator it; | 400 | QValueList<InputMethod>::Iterator it; |
401 | for ( it = inputModifierList.begin(); it != inputModifierList.end(); ++it, i++ ) { | 401 | for ( it = inputModifierList.begin(); it != inputModifierList.end(); ++it, i++ ) { |
402 | pop.insertItem( (*it).name(), i ); | 402 | pop.insertItem( (*it).name(), i ); |
403 | if ( imethod == &(*it) ) | 403 | if ( imethod == &(*it) ) |
404 | pop.setItemChecked( i, TRUE ); | 404 | pop.setItemChecked( i, TRUE ); |
405 | } | 405 | } |
406 | 406 | ||
407 | QPoint pt = mapToGlobal(imChoice->geometry().topRight()); | 407 | QPoint pt = mapToGlobal(imChoice->geometry().topRight()); |
408 | QSize s = pop.sizeHint(); | 408 | QSize s = pop.sizeHint(); |
409 | pt.ry() -= s.height(); | 409 | pt.ry() -= s.height(); |
410 | pt.rx() -= s.width(); | 410 | pt.rx() -= s.width(); |
411 | i = pop.exec( pt ); | 411 | i = pop.exec( pt ); |
412 | if ( i == -1 ) | 412 | if ( i == -1 ) |
413 | return; | 413 | return; |
414 | InputMethod *im = &inputModifierList[i]; | 414 | InputMethod *im = &inputModifierList[i]; |
415 | 415 | ||
416 | chooseMethod(im); | 416 | chooseMethod(im); |
417 | } | 417 | } |
418 | 418 | ||
419 | void InputMethods::chooseKeyboard(InputMethod* im) | 419 | void InputMethods::chooseKeyboard(InputMethod* im) |
420 | { | 420 | { |
421 | if ( im != mkeyboard ) { | 421 | if ( im != mkeyboard ) { |
422 | if ( mkeyboard && mkeyboard->widget->isVisible() ) | 422 | if ( mkeyboard && mkeyboard->widget->isVisible() ) |
423 | mkeyboard->widget->hide(); | 423 | mkeyboard->widget->hide(); |
424 | mkeyboard = im; | 424 | mkeyboard = im; |
425 | kbdButton->setPixmap( *mkeyboard->icon() ); | 425 | kbdButton->setPixmap( *mkeyboard->icon() ); |
426 | } | 426 | } |
427 | if ( !kbdButton->isOn() ) | 427 | if ( !kbdButton->isOn() ) |
428 | kbdButton->setOn( TRUE ); | 428 | kbdButton->setOn( TRUE ); |
429 | else | 429 | else |
430 | showKbd( TRUE ); | 430 | showKbd( TRUE ); |
431 | } | 431 | } |
432 | 432 | ||
433 | static bool keyboardCompatible(InputMethod *keyb, const QString &imname ) | 433 | static bool keyboardCompatible(InputMethod *keyb, const QString &imname ) |
434 | { | 434 | { |
435 | if ( !keyb || !keyb->newIM || !keyb->extInterface->compatible().count() ) | 435 | if ( !keyb || !keyb->newIM || !keyb->extInterface->compatible().count() ) |
436 | return TRUE; | 436 | return TRUE; |
437 | 437 | ||
438 | if ( keyb->extInterface->compatible().contains(imname) ) | 438 | if ( keyb->extInterface->compatible().contains(imname) ) |
439 | return TRUE; | 439 | return TRUE; |
440 | 440 | ||
441 | return FALSE; | 441 | return FALSE; |
442 | } | 442 | } |
443 | 443 | ||
444 | // Updates the display of the soft keyboards available to the current input method | 444 | // Updates the display of the soft keyboards available to the current input method |
445 | void InputMethods::updateKeyboards(InputMethod *im ) | 445 | void InputMethods::updateKeyboards(InputMethod *im ) |
446 | { | 446 | { |
447 | uint count; | 447 | uint count; |
448 | 448 | ||
449 | if ( im ) { | 449 | if ( im ) { |
450 | QString imname = im->libName.mid(im->libName.findRev('/') + 1); | 450 | QString imname = im->libName.mid(im->libName.findRev('/') + 1); |
451 | 451 | ||
452 | if ( mkeyboard && !keyboardCompatible(mkeyboard, imname) ) { | 452 | if ( mkeyboard && !keyboardCompatible(mkeyboard, imname) ) { |
453 | kbdButton->setOn( FALSE ); | 453 | kbdButton->setOn( FALSE ); |
454 | showKbd( FALSE ); | 454 | showKbd( FALSE ); |
455 | mkeyboard = 0; | 455 | mkeyboard = 0; |
456 | } | 456 | } |
457 | 457 | ||
458 | count = 0; | 458 | count = 0; |
459 | 459 | ||
460 | QValueList<InputMethod>::Iterator it; | 460 | QValueList<InputMethod>::Iterator it; |
461 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) { | 461 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) { |
462 | if ( keyboardCompatible( &(*it), imname ) ) { | 462 | if ( keyboardCompatible( &(*it), imname ) ) { |
463 | if ( !mkeyboard ) { | 463 | if ( !mkeyboard ) { |
464 | mkeyboard = &(*it); | 464 | mkeyboard = &(*it); |
465 | kbdButton->setPixmap( *mkeyboard->icon() ); | 465 | kbdButton->setPixmap( *mkeyboard->icon() ); |
466 | } | 466 | } |
467 | 467 | ||
468 | count++; | 468 | count++; |
469 | } | 469 | } |
470 | } | 470 | } |
471 | } else { | 471 | } else { |
472 | count = inputMethodList.count(); | 472 | count = inputMethodList.count(); |
473 | if ( count && !mkeyboard ) { | 473 | if ( count && !mkeyboard ) { |
474 | mkeyboard = &inputMethodList[0]; | 474 | mkeyboard = &inputMethodList[0]; |
475 | kbdButton->setPixmap( *mkeyboard->icon() ); | 475 | kbdButton->setPixmap( *mkeyboard->icon() ); |
476 | } else if (!count){ | 476 | } else if (!count){ |
477 | mkeyboard = 0; //might be redundant | 477 | mkeyboard = 0; //might be redundant |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | if ( count > 1 ) | 481 | if ( count > 1 ) |
482 | kbdChoice->show(); | 482 | kbdChoice->show(); |
483 | else | 483 | else |
484 | kbdChoice->hide(); | 484 | kbdChoice->hide(); |
485 | 485 | ||
486 | if ( count ) | 486 | if ( count ) |
487 | kbdButton->show(); | 487 | kbdButton->show(); |
488 | else | 488 | else |
489 | kbdButton->hide(); | 489 | kbdButton->hide(); |
490 | } | 490 | } |
491 | 491 | ||
492 | void InputMethods::chooseMethod(InputMethod* im) | 492 | void InputMethods::chooseMethod(InputMethod* im) |
493 | { | 493 | { |
494 | if ( im != imethod ) { | 494 | if ( im != imethod ) { |
495 | updateKeyboards( im ); | 495 | updateKeyboards( im ); |
496 | 496 | ||
497 | Config cfg("qpe"); | 497 | Config cfg("qpe"); |
498 | cfg.setGroup("InputMethod"); | 498 | cfg.setGroup("InputMethod"); |
499 | if (im ) | 499 | if (im ) |
500 | cfg.writeEntry("im", im->name() ); | 500 | cfg.writeEntry("im", im->name() ); |
501 | if (mkeyboard) | 501 | if (mkeyboard) |
502 | cfg.writeEntry("current", mkeyboard->name() ); | 502 | cfg.writeEntry("current", mkeyboard->name() ); |
503 | 503 | ||
504 | QWSServer::setCurrentInputMethod( 0 ); | 504 | QWSServer::setCurrentInputMethod( 0 ); |
505 | imethod = im; | 505 | imethod = im; |
506 | if ( imethod && imethod->newIM ) | 506 | if ( imethod && imethod->newIM ) |
507 | QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); | 507 | QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); |
508 | else | 508 | else |
509 | QWSServer::setCurrentInputMethod( 0 ); | 509 | QWSServer::setCurrentInputMethod( 0 ); |
510 | 510 | ||
511 | if ( im ) | 511 | if ( im ) |
512 | imButton->raiseWidget(im->widget); | 512 | imButton->raiseWidget(im->widget); |
513 | else | 513 | else |
514 | imButton->hide(); //### good UI? make sure it is shown again! | 514 | imButton->hide(); //### good UI? make sure it is shown again! |
515 | } | 515 | } |
516 | } | 516 | } |
517 | 517 | ||
518 | void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) | 518 | void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) |
519 | { | 519 | { |
520 | if ( imethod && imethod->newIM ) | 520 | if ( imethod && imethod->newIM ) |
521 | imethod->extInterface->qcopReceive( msg, data ); | 521 | imethod->extInterface->qcopReceive( msg, data ); |
522 | } | 522 | } |
523 | 523 | ||
524 | 524 | ||
525 | void InputMethods::showKbd( bool on ) | 525 | void InputMethods::showKbd( bool on ) |
526 | { | 526 | { |
527 | if ( !mkeyboard ) | 527 | if ( !mkeyboard ) |
528 | return; | 528 | return; |
529 | 529 | ||
530 | if ( on ) | 530 | if ( on ) |
531 | { | 531 | { |
532 | mkeyboard->resetState(); | 532 | mkeyboard->resetState(); |
533 | 533 | ||
534 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); | 534 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); |
535 | int width = static_cast<int>( qApp->desktop()->width() * (inputWidgetWidth*0.01) ); | 535 | int width = static_cast<int>( qApp->desktop()->width() * (inputWidgetWidth*0.01) ); |
536 | int left = 0; | 536 | int left = 0; |
537 | int top = mapToGlobal( QPoint() ).y() - height; | 537 | int top = mapToGlobal( QPoint() ).y() - height; |
538 | 538 | ||
539 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 539 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
540 | { | 540 | { |
541 | odebug << "InputMethods: reading geometry." << oendl; | 541 | odebug << "InputMethods: reading geometry." << oendl; |
542 | Config cfg( "Launcher" ); | 542 | Config cfg( "Launcher" ); |
543 | cfg.setGroup( "InputMethods" ); | 543 | cfg.setGroup( "InputMethods" ); |
544 | int l = cfg.readNumEntry( "absX", -1 ); | 544 | int l = cfg.readNumEntry( "absX", -1 ); |
545 | int t = cfg.readNumEntry( "absY", -1 ); | 545 | int t = cfg.readNumEntry( "absY", -1 ); |
546 | int w = cfg.readNumEntry( "absWidth", -1 ); | 546 | int w = cfg.readNumEntry( "absWidth", -1 ); |
547 | int h = cfg.readNumEntry( "absHeight", -1 ); | 547 | int h = cfg.readNumEntry( "absHeight", -1 ); |
548 | 548 | ||
549 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) | 549 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) |
550 | { | 550 | { |
551 | odebug << "InputMethods: config values ( " << l << ", " << t << ", " << w << ", " << h << " ) are ok." << oendl; | 551 | odebug << "InputMethods: config values ( " << l << ", " << t << ", " << w << ", " << h << " ) are ok." << oendl; |
552 | left = l; | 552 | left = l; |
553 | top = t; | 553 | top = t; |
554 | width = w; | 554 | width = w; |
555 | height = h; | 555 | height = h; |
556 | } | 556 | } |
557 | else | 557 | else |
558 | { | 558 | { |
559 | odebug << "InputMethods: config values are new or not ok." << oendl; | 559 | odebug << "InputMethods: config values are new or not ok." << oendl; |
560 | } | 560 | } |
561 | } | 561 | } |
562 | else | 562 | else |
563 | { | 563 | { |
564 | odebug << "InputMethods: no floating selected." << oendl; | 564 | odebug << "InputMethods: no floating selected." << oendl; |
565 | } | 565 | } |
566 | mkeyboard->widget->resize( width, height ); | 566 | mkeyboard->widget->resize( width, height ); |
567 | mkeyboard->widget->move( left, top ); | 567 | mkeyboard->widget->move( left, top ); |
568 | mkeyboard->widget->show(); | 568 | mkeyboard->widget->show(); |
569 | mkeyboard->widget->installEventFilter( this ); | 569 | mkeyboard->widget->installEventFilter( this ); |
570 | } | 570 | } |
571 | else | 571 | else |
572 | { | 572 | { |
573 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 573 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
574 | { | 574 | { |
575 | QPoint pos = mkeyboard->widget->pos(); | 575 | QPoint pos = mkeyboard->widget->pos(); |
576 | QSize siz = mkeyboard->widget->size(); | 576 | QSize siz = mkeyboard->widget->size(); |
577 | odebug << "InputMethods: saving geometry." << oendl; | 577 | odebug << "InputMethods: saving geometry." << oendl; |
578 | Config cfg( "Launcher" ); | 578 | Config cfg( "Launcher" ); |
579 | cfg.setGroup( "InputMethods" ); | 579 | cfg.setGroup( "InputMethods" ); |
580 | cfg.writeEntry( "absX", pos.x() ); | 580 | cfg.writeEntry( "absX", pos.x() ); |
581 | cfg.writeEntry( "absY", pos.y() ); | 581 | cfg.writeEntry( "absY", pos.y() ); |
582 | cfg.writeEntry( "absWidth", siz.width() ); | 582 | cfg.writeEntry( "absWidth", siz.width() ); |
583 | cfg.writeEntry( "absHeight", siz.height() ); | 583 | cfg.writeEntry( "absHeight", siz.height() ); |
584 | cfg.write(); | 584 | cfg.write(); |
585 | mkeyboard->widget->removeEventFilter( this ); | 585 | mkeyboard->widget->removeEventFilter( this ); |
586 | } | 586 | } |
587 | mkeyboard->widget->hide(); | 587 | mkeyboard->widget->hide(); |
588 | } | 588 | } |
589 | 589 | ||
590 | emit inputToggled( on ); | 590 | emit inputToggled( on ); |
591 | } | 591 | } |
592 | 592 | ||
593 | bool InputMethods::shown() const | 593 | bool InputMethods::shown() const |
594 | { | 594 | { |
595 | return mkeyboard && mkeyboard->widget->isVisible(); | 595 | return mkeyboard && mkeyboard->widget->isVisible(); |
596 | } | 596 | } |
597 | 597 | ||
598 | QString InputMethods::currentShown() const | 598 | QString InputMethods::currentShown() const |
599 | { | 599 | { |
600 | return mkeyboard && mkeyboard->widget->isVisible() | 600 | return mkeyboard && mkeyboard->widget->isVisible() |
601 | ? mkeyboard->name() : QString::null; | 601 | ? mkeyboard->name() : QString::null; |
602 | } | 602 | } |
603 | 603 | ||
604 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) | 604 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) |
605 | { | 605 | { |
606 | #if defined(Q_WS_QWS) | 606 | #if defined(Q_WS_QWS) |
607 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); | 607 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); |
608 | #endif | 608 | #endif |
609 | } | 609 | } |
610 | 610 | ||
611 | bool InputMethods::eventFilter( QObject* , QEvent* e ) | 611 | bool InputMethods::eventFilter( QObject* , QEvent* e ) |
612 | { | 612 | { |
613 | if ( e->type() == QEvent::Close ) | 613 | if ( e->type() == QEvent::Close ) |
614 | { | 614 | { |
615 | ( (QCloseEvent*) e )->ignore(); | 615 | ( (QCloseEvent*) e )->ignore(); |
616 | showKbd( false ); | 616 | showKbd( false ); |
617 | kbdButton->setOn( false ); | 617 | kbdButton->setOn( false ); |
618 | return true; | 618 | return true; |
619 | } | 619 | } |
620 | return false; | 620 | return false; |
621 | } | 621 | } |
622 | 622 | ||
623 | void InputMethods::readConfig() { | 623 | void InputMethods::readConfig() { |
624 | Config cfg( "Launcher" ); | 624 | Config cfg( "Launcher" ); |
625 | cfg.setGroup( "InputMethods" ); | 625 | cfg.setGroup( "InputMethods" ); |
626 | 626 | ||
627 | inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; | 627 | inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; |
628 | inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? | 628 | inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? |
629 | QWidget::WStyle_DialogBorder : 0; | 629 | QWidget::WStyle_DialogBorder : 0; |
630 | inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); | 630 | inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); |
631 | } | 631 | } |