Diffstat (limited to 'core/launcher/inputmethods.cpp') (more/less context) (show 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 @@ -86,17 +86,13 @@ public: InputMethods::InputMethods( QWidget *parent ) : QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), mkeyboard(0), imethod(0) { - Config cfg( "Launcher" ); - cfg.setGroup( "InputMethods" ); - inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; - inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0; - inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); + readConfig(); setBackgroundMode( PaletteBackground ); QHBoxLayout *hbox = new QHBoxLayout( this ); kbdButton = new IMToolButton( this); kbdButton->setFocusPolicy(NoFocus); @@ -529,13 +525,13 @@ void InputMethods::showKbd( bool on ) if ( on ) { mkeyboard->resetState(); int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); - int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); + int width = static_cast<int>( qApp->desktop()->width() * (inputWidgetWidth*0.01) ); int left = 0; int top = mapToGlobal( QPoint() ).y() - height; if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) { odebug << "InputMethods: reading geometry." << oendl; @@ -605,17 +601,27 @@ void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool pr { #if defined(Q_WS_QWS) QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); #endif } -bool InputMethods::eventFilter( QObject* o, QEvent* e ) +bool InputMethods::eventFilter( QObject* , QEvent* e ) { if ( e->type() == QEvent::Close ) { ( (QCloseEvent*) e )->ignore(); showKbd( false ); kbdButton->setOn( false ); return true; } return false; } + +void InputMethods::readConfig() { + Config cfg( "Launcher" ); + cfg.setGroup( "InputMethods" ); + + inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; + inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? + QWidget::WStyle_DialogBorder : 0; + inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); +} |