Diffstat (limited to 'core/launcher/inputmethods.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/inputmethods.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index a0e8939..7e99796 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -80,29 +80,25 @@ int InputMethod::operator <=(const InputMethod& o) const | |||
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::IMToolButton( QWidget *parent ) : QToolButton( parent ) |
84 | { setWFlags( WStyle_Tool ); } | 84 | { setWFlags( WStyle_Tool ); } |
85 | }; | 85 | }; |
86 | 86 | ||
87 | 87 | ||
88 | InputMethods::InputMethods( QWidget *parent ) : | 88 | InputMethods::InputMethods( QWidget *parent ) : |
89 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), | 89 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), |
90 | mkeyboard(0), imethod(0) | 90 | mkeyboard(0), imethod(0) |
91 | { | 91 | { |
92 | Config cfg( "Launcher" ); | 92 | readConfig(); |
93 | cfg.setGroup( "InputMethods" ); | ||
94 | inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; | ||
95 | inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0; | ||
96 | inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); | ||
97 | 93 | ||
98 | setBackgroundMode( PaletteBackground ); | 94 | setBackgroundMode( PaletteBackground ); |
99 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 95 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
100 | 96 | ||
101 | kbdButton = new IMToolButton( this); | 97 | kbdButton = new IMToolButton( this); |
102 | kbdButton->setFocusPolicy(NoFocus); | 98 | kbdButton->setFocusPolicy(NoFocus); |
103 | kbdButton->setToggleButton( TRUE ); | 99 | kbdButton->setToggleButton( TRUE ); |
104 | if (parent->sizeHint().height() > 0) | 100 | if (parent->sizeHint().height() > 0) |
105 | kbdButton->setFixedHeight( parent->sizeHint().height() ); | 101 | kbdButton->setFixedHeight( parent->sizeHint().height() ); |
106 | kbdButton->setFixedWidth( 32 ); | 102 | kbdButton->setFixedWidth( 32 ); |
107 | kbdButton->setAutoRaise( TRUE ); | 103 | kbdButton->setAutoRaise( TRUE ); |
108 | kbdButton->setUsesBigPixmap( TRUE ); | 104 | kbdButton->setUsesBigPixmap( TRUE ); |
@@ -523,25 +519,25 @@ void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) | |||
523 | 519 | ||
524 | 520 | ||
525 | void InputMethods::showKbd( bool on ) | 521 | void InputMethods::showKbd( bool on ) |
526 | { | 522 | { |
527 | if ( !mkeyboard ) | 523 | if ( !mkeyboard ) |
528 | return; | 524 | return; |
529 | 525 | ||
530 | if ( on ) | 526 | if ( on ) |
531 | { | 527 | { |
532 | mkeyboard->resetState(); | 528 | mkeyboard->resetState(); |
533 | 529 | ||
534 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); | 530 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); |
535 | int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); | 531 | int width = static_cast<int>( qApp->desktop()->width() * (inputWidgetWidth*0.01) ); |
536 | int left = 0; | 532 | int left = 0; |
537 | int top = mapToGlobal( QPoint() ).y() - height; | 533 | int top = mapToGlobal( QPoint() ).y() - height; |
538 | 534 | ||
539 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 535 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
540 | { | 536 | { |
541 | odebug << "InputMethods: reading geometry." << oendl; | 537 | odebug << "InputMethods: reading geometry." << oendl; |
542 | Config cfg( "Launcher" ); | 538 | Config cfg( "Launcher" ); |
543 | cfg.setGroup( "InputMethods" ); | 539 | cfg.setGroup( "InputMethods" ); |
544 | int l = cfg.readNumEntry( "absX", -1 ); | 540 | int l = cfg.readNumEntry( "absX", -1 ); |
545 | int t = cfg.readNumEntry( "absY", -1 ); | 541 | int t = cfg.readNumEntry( "absY", -1 ); |
546 | int w = cfg.readNumEntry( "absWidth", -1 ); | 542 | int w = cfg.readNumEntry( "absWidth", -1 ); |
547 | int h = cfg.readNumEntry( "absHeight", -1 ); | 543 | int h = cfg.readNumEntry( "absHeight", -1 ); |
@@ -599,23 +595,33 @@ QString InputMethods::currentShown() const | |||
599 | { | 595 | { |
600 | return mkeyboard && mkeyboard->widget->isVisible() | 596 | return mkeyboard && mkeyboard->widget->isVisible() |
601 | ? mkeyboard->name() : QString::null; | 597 | ? mkeyboard->name() : QString::null; |
602 | } | 598 | } |
603 | 599 | ||
604 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) | 600 | void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) |
605 | { | 601 | { |
606 | #if defined(Q_WS_QWS) | 602 | #if defined(Q_WS_QWS) |
607 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); | 603 | QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); |
608 | #endif | 604 | #endif |
609 | } | 605 | } |
610 | 606 | ||
611 | bool InputMethods::eventFilter( QObject* o, QEvent* e ) | 607 | bool InputMethods::eventFilter( QObject* , QEvent* e ) |
612 | { | 608 | { |
613 | if ( e->type() == QEvent::Close ) | 609 | if ( e->type() == QEvent::Close ) |
614 | { | 610 | { |
615 | ( (QCloseEvent*) e )->ignore(); | 611 | ( (QCloseEvent*) e )->ignore(); |
616 | showKbd( false ); | 612 | showKbd( false ); |
617 | kbdButton->setOn( false ); | 613 | kbdButton->setOn( false ); |
618 | return true; | 614 | return true; |
619 | } | 615 | } |
620 | return false; | 616 | return false; |
621 | } | 617 | } |
618 | |||
619 | void InputMethods::readConfig() { | ||
620 | Config cfg( "Launcher" ); | ||
621 | cfg.setGroup( "InputMethods" ); | ||
622 | |||
623 | inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; | ||
624 | inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? | ||
625 | QWidget::WStyle_DialogBorder : 0; | ||
626 | inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); | ||
627 | } | ||