author | mickeyl <mickeyl> | 2003-07-08 10:12:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-07-08 10:12:26 (UTC) |
commit | 86cfa9479c119d581808f53f7b46e9cfeb127ccd (patch) (unidiff) | |
tree | 615df0595ee711c8d479dd9b3be5d19d9deee20e | |
parent | 7fed22ccbc1272fe0c5fb1c7f47bc330f118b854 (diff) | |
download | opie-86cfa9479c119d581808f53f7b46e9cfeb127ccd.zip opie-86cfa9479c119d581808f53f7b46e9cfeb127ccd.tar.gz opie-86cfa9479c119d581808f53f7b46e9cfeb127ccd.tar.bz2 |
make inputmethods half the desktop width on the SIMpad
-rw-r--r-- | core/launcher/inputmethods.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 765dfe9..09b9a83 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -227,91 +227,95 @@ void InputMethods::loadInputMethods() | |||
227 | } | 227 | } |
228 | kbdButton->setPixmap( *method->interface->icon() ); | 228 | kbdButton->setPixmap( *method->interface->icon() ); |
229 | } | 229 | } |
230 | if ( !inputMethodList.isEmpty() ) | 230 | if ( !inputMethodList.isEmpty() ) |
231 | kbdButton->show(); | 231 | kbdButton->show(); |
232 | else | 232 | else |
233 | kbdButton->hide(); | 233 | kbdButton->hide(); |
234 | if ( inputMethodList.count() > 1 ) | 234 | if ( inputMethodList.count() > 1 ) |
235 | kbdChoice->show(); | 235 | kbdChoice->show(); |
236 | else | 236 | else |
237 | kbdChoice->hide(); | 237 | kbdChoice->hide(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void InputMethods::chooseKbd() | 240 | void InputMethods::chooseKbd() |
241 | { | 241 | { |
242 | QPopupMenu pop( this ); | 242 | QPopupMenu pop( this ); |
243 | 243 | ||
244 | int i = 0; | 244 | int i = 0; |
245 | QValueList<InputMethod>::Iterator it; | 245 | QValueList<InputMethod>::Iterator it; |
246 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { | 246 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { |
247 | pop.insertItem( (*it).interface->name(), i ); | 247 | pop.insertItem( (*it).interface->name(), i ); |
248 | if ( method == &(*it) ) | 248 | if ( method == &(*it) ) |
249 | pop.setItemChecked( i, TRUE ); | 249 | pop.setItemChecked( i, TRUE ); |
250 | } | 250 | } |
251 | 251 | ||
252 | QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); | 252 | QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); |
253 | QSize s = pop.sizeHint(); | 253 | QSize s = pop.sizeHint(); |
254 | pt.ry() -= s.height(); | 254 | pt.ry() -= s.height(); |
255 | pt.rx() -= s.width(); | 255 | pt.rx() -= s.width(); |
256 | i = pop.exec( pt ); | 256 | i = pop.exec( pt ); |
257 | if ( i == -1 ) | 257 | if ( i == -1 ) |
258 | return; | 258 | return; |
259 | InputMethod *im = &inputMethodList[i]; | 259 | InputMethod *im = &inputMethodList[i]; |
260 | chooseMethod(im); | 260 | chooseMethod(im); |
261 | } | 261 | } |
262 | 262 | ||
263 | void InputMethods::chooseMethod(InputMethod* im) | 263 | void InputMethods::chooseMethod(InputMethod* im) |
264 | { | 264 | { |
265 | if ( im != method ) { | 265 | if ( im != method ) { |
266 | if ( method && method->widget->isVisible() ) | 266 | if ( method && method->widget->isVisible() ) |
267 | method->widget->hide(); | 267 | method->widget->hide(); |
268 | method = im; | 268 | method = im; |
269 | Config cfg("qpe"); | 269 | Config cfg("qpe"); |
270 | cfg.setGroup("InputMethod"); | 270 | cfg.setGroup("InputMethod"); |
271 | cfg.writeEntry("current", method->interface->name()); | 271 | cfg.writeEntry("current", method->interface->name()); |
272 | kbdButton->setPixmap( *method->interface->icon() ); | 272 | kbdButton->setPixmap( *method->interface->icon() ); |
273 | } | 273 | } |
274 | if ( !kbdButton->isOn() ) | 274 | if ( !kbdButton->isOn() ) |
275 | kbdButton->setOn( TRUE ); | 275 | kbdButton->setOn( TRUE ); |
276 | else | 276 | else |
277 | showKbd( TRUE ); | 277 | showKbd( TRUE ); |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | void InputMethods::showKbd( bool on ) | 281 | void InputMethods::showKbd( bool on ) |
282 | { | 282 | { |
283 | if ( !method ) | 283 | if ( !method ) |
284 | return; | 284 | return; |
285 | 285 | ||
286 | if ( on ) { | 286 | if ( on ) { |
287 | method->interface->resetState(); | 287 | method->interface->resetState(); |
288 | // HACK... Make the texteditor fit with all input methods | 288 | // HACK... Make the texteditor fit with all input methods |
289 | // Input methods should also never use more than about 40% of the screen | 289 | // Input methods should also never use more than about 40% of the screen |
290 | int height = QMIN( method->widget->sizeHint().height(), 134 ); | 290 | int height = QMIN( method->widget->sizeHint().height(), 134 ); |
291 | #ifdef QT_QWS_SIMPAD | ||
292 | method->widget->resize( qApp->desktop()->width() / 2, height ); // make it half the width on the SIMpad | ||
293 | #else | ||
291 | method->widget->resize( qApp->desktop()->width(), height ); | 294 | method->widget->resize( qApp->desktop()->width(), height ); |
295 | #endif | ||
292 | method->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); | 296 | method->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); |
293 | method->widget->show(); | 297 | method->widget->show(); |
294 | } else { | 298 | } else { |
295 | method->widget->hide(); | 299 | method->widget->hide(); |
296 | } | 300 | } |
297 | 301 | ||
298 | emit inputToggled( on ); | 302 | emit inputToggled( on ); |
299 | } | 303 | } |
300 | 304 | ||
301 | bool InputMethods::shown() const | 305 | bool InputMethods::shown() const |
302 | { | 306 | { |
303 | return method && method->widget->isVisible(); | 307 | return method && method->widget->isVisible(); |
304 | } | 308 | } |
305 | 309 | ||
306 | QString InputMethods::currentShown() const | 310 | QString InputMethods::currentShown() const |
307 | { | 311 | { |
308 | return method && method->widget->isVisible() | 312 | return method && method->widget->isVisible() |
309 | ? method->interface->name() : QString::null; | 313 | ? method->interface->name() : QString::null; |
310 | } | 314 | } |
311 | 315 | ||
312 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) | 316 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) |
313 | { | 317 | { |
314 | #if defined(Q_WS_QWS) | 318 | #if defined(Q_WS_QWS) |
315 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); | 319 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); |
316 | #endif | 320 | #endif |
317 | } | 321 | } |