Diffstat (limited to 'core/launcher/inputmethods.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/inputmethods.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 19e799a..cef16bf 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -12,49 +12,45 @@ | |||
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 */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <qtopia/config.h> | 26 | #include <qtopia/config.h> |
25 | #include <qtopia/qpeapplication.h> | 27 | #include <qtopia/qpeapplication.h> |
28 | using namespace Opie::Core; | ||
26 | 29 | ||
30 | /* QT */ | ||
27 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
28 | #include <qtoolbutton.h> | 32 | #include <qtoolbutton.h> |
29 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
30 | #include <qlayout.h> | 34 | #include <qlayout.h> |
31 | #include <qdir.h> | 35 | #include <qdir.h> |
32 | #include <stdlib.h> | ||
33 | #include <qtl.h> | 36 | #include <qtl.h> |
34 | |||
35 | #ifdef Q_WS_QWS | 37 | #ifdef Q_WS_QWS |
36 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
37 | #include <qwsevent_qws.h> | 39 | #include <qwsevent_qws.h> |
38 | #include <qcopchannel_qws.h> | 40 | #include <qcopchannel_qws.h> |
39 | #endif | 41 | #endif |
40 | 42 | ||
41 | /* ### SingleFloppy if someone is interested? */ | 43 | /* STD */ |
42 | #if 0 | 44 | #include <stdlib.h> |
43 | #ifdef QT_NO_COMPONENT | ||
44 | #include "../plugins/inputmethods/handwriting/handwritingimpl.h" | ||
45 | #include "../plugins/inputmethods/keyboard/keyboardimpl.h" | ||
46 | #include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" | ||
47 | #endif | ||
48 | #endif | ||
49 | 45 | ||
50 | /* XPM */ | 46 | /* XPM */ |
51 | static const char * tri_xpm[]={ | 47 | static const char * tri_xpm[]={ |
52 | "9 9 2 1", | 48 | "9 9 2 1", |
53 | "a c #000000", | 49 | "a c #000000", |
54 | ". c None", | 50 | ". c None", |
55 | ".........", | 51 | ".........", |
56 | ".........", | 52 | ".........", |
57 | ".........", | 53 | ".........", |
58 | "....a....", | 54 | "....a....", |
59 | "...aaa...", | 55 | "...aaa...", |
60 | "..aaaaa..", | 56 | "..aaaaa..", |
@@ -253,25 +249,25 @@ void InputMethods::setPreferedHandlers() { | |||
253 | 249 | ||
254 | QValueList<InputMethod>::Iterator it; | 250 | QValueList<InputMethod>::Iterator it; |
255 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { | 251 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { |
256 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) | 252 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) |
257 | if ( (*it).name() == im ) { | 253 | if ( (*it).name() == im ) { |
258 | imethod = &(*it); break; | 254 | imethod = &(*it); break; |
259 | } | 255 | } |
260 | 256 | ||
261 | } | 257 | } |
262 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { | 258 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { |
263 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) | 259 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) |
264 | if ( (*it).name() == current ) { | 260 | if ( (*it).name() == current ) { |
265 | qWarning("preferred keyboard is %s", current.latin1() ); | 261 | owarn << "preferred keyboard is " << current << "" << oendl; |
266 | mkeyboard = &(*it); | 262 | mkeyboard = &(*it); |
267 | kbdButton->setPixmap( *mkeyboard->icon() ); | 263 | kbdButton->setPixmap( *mkeyboard->icon() ); |
268 | break; | 264 | break; |
269 | } | 265 | } |
270 | } | 266 | } |
271 | 267 | ||
272 | } | 268 | } |
273 | 269 | ||
274 | void InputMethods::loadInputMethods() | 270 | void InputMethods::loadInputMethods() |
275 | { | 271 | { |
276 | #ifndef QT_NO_COMPONENT | 272 | #ifndef QT_NO_COMPONENT |
277 | hideInputMethod(); | 273 | hideInputMethod(); |
@@ -296,31 +292,31 @@ void InputMethods::loadInputMethods() | |||
296 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); | 292 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); |
297 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); | 293 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); |
298 | inputMethodList.append( input ); | 294 | inputMethodList.append( input ); |
299 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { | 295 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { |
300 | InputMethod input; | 296 | InputMethod input; |
301 | input.newIM = TRUE; | 297 | input.newIM = TRUE; |
302 | input.library = lib; | 298 | input.library = lib; |
303 | input.libName = *it; | 299 | input.libName = *it; |
304 | input.extInterface = eface; | 300 | input.extInterface = eface; |
305 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); | 301 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); |
306 | // may be either a simple, or advanced. | 302 | // may be either a simple, or advanced. |
307 | if (input.widget) { | 303 | if (input.widget) { |
308 | //qDebug("its a keyboard"); | 304 | //odebug << "its a keyboard" << oendl; |
309 | inputMethodList.append( input ); | 305 | inputMethodList.append( input ); |
310 | } else { | 306 | } else { |
311 | //qDebug("its a real im"); | 307 | //odebug << "its a real im" << oendl; |
312 | input.widget = input.extInterface->statusWidget( 0, 0 ); | 308 | input.widget = input.extInterface->statusWidget( 0, 0 ); |
313 | if (input.widget) { | 309 | if (input.widget) { |
314 | //qDebug("blah"); | 310 | //odebug << "blah" << oendl; |
315 | inputModifierList.append( input ); | 311 | inputModifierList.append( input ); |
316 | imButton->addWidget(input.widget, inputModifierList.count()); | 312 | imButton->addWidget(input.widget, inputModifierList.count()); |
317 | } | 313 | } |
318 | } | 314 | } |
319 | }else{ | 315 | }else{ |
320 | delete lib; | 316 | delete lib; |
321 | lib = 0l; | 317 | lib = 0l; |
322 | } | 318 | } |
323 | installTranslator( (*it).left( (*it).find(".") ) ); | 319 | installTranslator( (*it).left( (*it).find(".") ) ); |
324 | } | 320 | } |
325 | qHeapSort( inputMethodList ); | 321 | qHeapSort( inputMethodList ); |
326 | #endif /* killed BUILT in cause they would not compile */ | 322 | #endif /* killed BUILT in cause they would not compile */ |
@@ -532,61 +528,61 @@ void InputMethods::showKbd( bool on ) | |||
532 | 528 | ||
533 | if ( on ) | 529 | if ( on ) |
534 | { | 530 | { |
535 | mkeyboard->resetState(); | 531 | mkeyboard->resetState(); |
536 | 532 | ||
537 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); | 533 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); |
538 | int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); | 534 | int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); |
539 | int left = 0; | 535 | int left = 0; |
540 | int top = mapToGlobal( QPoint() ).y() - height; | 536 | int top = mapToGlobal( QPoint() ).y() - height; |
541 | 537 | ||
542 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 538 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
543 | { | 539 | { |
544 | qDebug( "InputMethods: reading geometry." ); | 540 | odebug << "InputMethods: reading geometry." << oendl; |
545 | Config cfg( "Launcher" ); | 541 | Config cfg( "Launcher" ); |
546 | cfg.setGroup( "InputMethods" ); | 542 | cfg.setGroup( "InputMethods" ); |
547 | int l = cfg.readNumEntry( "absX", -1 ); | 543 | int l = cfg.readNumEntry( "absX", -1 ); |
548 | int t = cfg.readNumEntry( "absY", -1 ); | 544 | int t = cfg.readNumEntry( "absY", -1 ); |
549 | int w = cfg.readNumEntry( "absWidth", -1 ); | 545 | int w = cfg.readNumEntry( "absWidth", -1 ); |
550 | int h = cfg.readNumEntry( "absHeight", -1 ); | 546 | int h = cfg.readNumEntry( "absHeight", -1 ); |
551 | 547 | ||
552 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) | 548 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) |
553 | { | 549 | { |
554 | qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h ); | 550 | odebug << "InputMethods: config values ( " << l << ", " << t << ", " << w << ", " << h << " ) are ok." << oendl; |
555 | left = l; | 551 | left = l; |
556 | top = t; | 552 | top = t; |
557 | width = w; | 553 | width = w; |
558 | height = h; | 554 | height = h; |
559 | } | 555 | } |
560 | else | 556 | else |
561 | { | 557 | { |
562 | qDebug( "InputMethods: config values are new or not ok." ); | 558 | odebug << "InputMethods: config values are new or not ok." << oendl; |
563 | } | 559 | } |
564 | } | 560 | } |
565 | else | 561 | else |
566 | { | 562 | { |
567 | qDebug( "InputMethods: no floating selected." ); | 563 | odebug << "InputMethods: no floating selected." << oendl; |
568 | } | 564 | } |
569 | mkeyboard->widget->resize( width, height ); | 565 | mkeyboard->widget->resize( width, height ); |
570 | mkeyboard->widget->move( left, top ); | 566 | mkeyboard->widget->move( left, top ); |
571 | mkeyboard->widget->show(); | 567 | mkeyboard->widget->show(); |
572 | mkeyboard->widget->installEventFilter( this ); | 568 | mkeyboard->widget->installEventFilter( this ); |
573 | } | 569 | } |
574 | else | 570 | else |
575 | { | 571 | { |
576 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 572 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
577 | { | 573 | { |
578 | QPoint pos = mkeyboard->widget->pos(); | 574 | QPoint pos = mkeyboard->widget->pos(); |
579 | QSize siz = mkeyboard->widget->size(); | 575 | QSize siz = mkeyboard->widget->size(); |
580 | qDebug( "InputMethods: saving geometry." ); | 576 | odebug << "InputMethods: saving geometry." << oendl; |
581 | Config cfg( "Launcher" ); | 577 | Config cfg( "Launcher" ); |
582 | cfg.setGroup( "InputMethods" ); | 578 | cfg.setGroup( "InputMethods" ); |
583 | cfg.writeEntry( "absX", pos.x() ); | 579 | cfg.writeEntry( "absX", pos.x() ); |
584 | cfg.writeEntry( "absY", pos.y() ); | 580 | cfg.writeEntry( "absY", pos.y() ); |
585 | cfg.writeEntry( "absWidth", siz.width() ); | 581 | cfg.writeEntry( "absWidth", siz.width() ); |
586 | cfg.writeEntry( "absHeight", siz.height() ); | 582 | cfg.writeEntry( "absHeight", siz.height() ); |
587 | cfg.write(); | 583 | cfg.write(); |
588 | mkeyboard->widget->removeEventFilter( this ); | 584 | mkeyboard->widget->removeEventFilter( this ); |
589 | } | 585 | } |
590 | mkeyboard->widget->hide(); | 586 | mkeyboard->widget->hide(); |
591 | } | 587 | } |
592 | 588 | ||