Diffstat (limited to 'core/launcher/inputmethods.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/launcher/inputmethods.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index f0d8294..d89a366 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -59,30 +59,24 @@ static const char * tri_xpm[]={ | |||
59 | "a c #000000", | 59 | "a c #000000", |
60 | ". c None", | 60 | ". c None", |
61 | ".........", | 61 | ".........", |
62 | ".........", | 62 | ".........", |
63 | ".........", | 63 | ".........", |
64 | "....a....", | 64 | "....a....", |
65 | "...aaa...", | 65 | "...aaa...", |
66 | "..aaaaa..", | 66 | "..aaaaa..", |
67 | ".aaaaaaa.", | 67 | ".aaaaaaa.", |
68 | ".........", | 68 | ".........", |
69 | "........."}; | 69 | "........."}; |
70 | 70 | ||
71 | static const int inputWidgetStyle = QWidget::WStyle_Customize | | ||
72 | QWidget::WStyle_Tool | | ||
73 | QWidget::WStyle_StaysOnTop | | ||
74 | QWidget::WGroupLeader; | ||
75 | |||
76 | |||
77 | int InputMethod::operator <(const InputMethod& o) const | 71 | int InputMethod::operator <(const InputMethod& o) const |
78 | { | 72 | { |
79 | return name() < o.name(); | 73 | return name() < o.name(); |
80 | } | 74 | } |
81 | int InputMethod::operator >(const InputMethod& o) const | 75 | int InputMethod::operator >(const InputMethod& o) const |
82 | { | 76 | { |
83 | return name() > o.name(); | 77 | return name() > o.name(); |
84 | } | 78 | } |
85 | int InputMethod::operator <=(const InputMethod& o) const | 79 | int InputMethod::operator <=(const InputMethod& o) const |
86 | { | 80 | { |
87 | return name() <= o.name(); | 81 | return name() <= o.name(); |
88 | } | 82 | } |
@@ -95,24 +89,30 @@ int InputMethod::operator <=(const InputMethod& o) const | |||
95 | class IMToolButton : public QToolButton | 89 | class IMToolButton : public QToolButton |
96 | { | 90 | { |
97 | public: | 91 | public: |
98 | IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) | 92 | IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) |
99 | { setWFlags( WStyle_Tool ); } | 93 | { setWFlags( WStyle_Tool ); } |
100 | }; | 94 | }; |
101 | 95 | ||
102 | 96 | ||
103 | InputMethods::InputMethods( QWidget *parent ) : | 97 | InputMethods::InputMethods( QWidget *parent ) : |
104 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), | 98 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), |
105 | mkeyboard(0), imethod(0) | 99 | mkeyboard(0), imethod(0) |
106 | { | 100 | { |
101 | Config cfg( "Launcher" ); | ||
102 | cfg.setGroup( "InputMethods" ); | ||
103 | inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader; | ||
104 | inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : QWidget::WStyle_Tool; | ||
105 | inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); | ||
106 | |||
107 | setBackgroundMode( PaletteBackground ); | 107 | setBackgroundMode( PaletteBackground ); |
108 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 108 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
109 | 109 | ||
110 | kbdButton = new IMToolButton( this); | 110 | kbdButton = new IMToolButton( this); |
111 | kbdButton->setFocusPolicy(NoFocus); | 111 | kbdButton->setFocusPolicy(NoFocus); |
112 | kbdButton->setToggleButton( TRUE ); | 112 | kbdButton->setToggleButton( TRUE ); |
113 | if (parent->sizeHint().height() > 0) | 113 | if (parent->sizeHint().height() > 0) |
114 | kbdButton->setFixedHeight( parent->sizeHint().height() ); | 114 | kbdButton->setFixedHeight( parent->sizeHint().height() ); |
115 | kbdButton->setFixedWidth( 32 ); | 115 | kbdButton->setFixedWidth( 32 ); |
116 | kbdButton->setAutoRaise( TRUE ); | 116 | kbdButton->setAutoRaise( TRUE ); |
117 | kbdButton->setUsesBigPixmap( TRUE ); | 117 | kbdButton->setUsesBigPixmap( TRUE ); |
118 | hbox->addWidget( kbdButton ); | 118 | hbox->addWidget( kbdButton ); |
@@ -528,25 +528,25 @@ void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) | |||
528 | 528 | ||
529 | 529 | ||
530 | void InputMethods::showKbd( bool on ) | 530 | void InputMethods::showKbd( bool on ) |
531 | { | 531 | { |
532 | if ( !mkeyboard ) | 532 | if ( !mkeyboard ) |
533 | return; | 533 | return; |
534 | 534 | ||
535 | if ( on ) { | 535 | if ( on ) { |
536 | mkeyboard->resetState(); | 536 | mkeyboard->resetState(); |
537 | // HACK... Make the texteditor fit with all input methods | 537 | // HACK... Make the texteditor fit with all input methods |
538 | // Input methods should also never use more than about 40% of the screen | 538 | // Input methods should also never use more than about 40% of the screen |
539 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); | 539 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); |
540 | mkeyboard->widget->resize( qApp->desktop()->width(), height ); | 540 | mkeyboard->widget->resize( qApp->desktop()->width() * (inputWidgetWidth*0.01), height ); |
541 | mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); | 541 | mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); |
542 | mkeyboard->widget->show(); | 542 | mkeyboard->widget->show(); |
543 | } else { | 543 | } else { |
544 | mkeyboard->widget->hide(); | 544 | mkeyboard->widget->hide(); |
545 | } | 545 | } |
546 | 546 | ||
547 | emit inputToggled( on ); | 547 | emit inputToggled( on ); |
548 | } | 548 | } |
549 | 549 | ||
550 | bool InputMethods::shown() const | 550 | bool InputMethods::shown() const |
551 | { | 551 | { |
552 | return mkeyboard && mkeyboard->widget->isVisible(); | 552 | return mkeyboard && mkeyboard->widget->isVisible(); |