author | zecke <zecke> | 2004-08-22 21:35:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-22 21:35:22 (UTC) |
commit | 8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5 (patch) (side-by-side diff) | |
tree | caf4d5d4cab240f2e7653b394666c5e2fb178798 | |
parent | 2304c546ec73f2643621f04d61128c2686812cd1 (diff) | |
download | opie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.zip opie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.tar.gz opie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.tar.bz2 |
Reload InputMethods when LauncherSettings changed InputMethod Options
-rw-r--r-- | core/launcher/inputmethods.cpp | 20 | ||||
-rw-r--r-- | core/launcher/inputmethods.h | 1 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 13 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 5 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.cpp | 29 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.h | 9 |
6 files changed, 58 insertions, 19 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 @@ -90,9 +90,5 @@ InputMethods::InputMethods( QWidget *parent ) : 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 ); @@ -533,5 +529,5 @@ void InputMethods::showKbd( bool on ) 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; @@ -609,5 +605,5 @@ void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool pr } -bool InputMethods::eventFilter( QObject* o, QEvent* e ) +bool InputMethods::eventFilter( QObject* , QEvent* e ) { if ( e->type() == QEvent::Close ) @@ -620,2 +616,12 @@ bool InputMethods::eventFilter( QObject* o, QEvent* e ) 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 ); +} diff --git a/core/launcher/inputmethods.h b/core/launcher/inputmethods.h index 55ac020..2e0b1e8 100644 --- a/core/launcher/inputmethods.h +++ b/core/launcher/inputmethods.h @@ -75,4 +75,5 @@ public: void loadInputMethods(); virtual bool eventFilter( QObject *, QEvent * ); + void readConfig(); signals: diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index abe238f..63361fe 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -177,7 +177,6 @@ TaskBar::~TaskBar() TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) { - Config cfg( "Launcher" ); - cfg.setGroup( "InputMethods" ); - resizeRunningApp = cfg.readBoolEntry( "Resize", true ); + /* Read InputMethod Config */ + readConfig(); sm = new StartMenu( this ); @@ -336,4 +335,6 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) inputMethods->showInputMethod(name); } else if ( msg == "reloadInputMethods()" ) { + readConfig(); + inputMethods->readConfig(); inputMethods->loadInputMethods(); } else if ( msg == "reloadApplets()" ) { @@ -378,3 +379,9 @@ void TaskBar::toggleSymbolInput() } +void TaskBar::readConfig() { + Config cfg( "Launcher" ); + cfg.setGroup( "InputMethods" ); + resizeRunningApp = cfg.readBoolEntry( "Resize", true ); +} + #include "taskbar.moc" diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index ed558b1..be5fda8 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h @@ -66,9 +66,12 @@ protected: void styleChange( QStyle & ); void setStatusMessage( const QString &text ); - + private slots: void receive( const QCString &msg, const QByteArray &data ); private: + void readConfig(); + +private: QTimer *waitTimer; Wait *waitIcon; diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index 0422075..125b178 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp @@ -32,4 +32,5 @@ #include <qpe/config.h> #include <opie2/odebug.h> +#include <qpe/qcopenvelope_qws.h> /* QT */ @@ -57,7 +58,15 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); - _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); - _float->setChecked( cfg.readBoolEntry( "Float", false ) ); - _size->setValue( cfg.readNumEntry( "Width", 100 ) ); + + /* + * load the values to see if something was changed + */ + _wasResize = cfg.readBoolEntry( "Resize", true ); + _wasFloat = cfg.readBoolEntry( "Float", false ); + _wasWidth = cfg.readNumEntry( "Width", 100 ); + + _resize->setChecked( _wasResize ); + _float ->setChecked( _wasFloat ); + _size ->setValue( _wasWidth ); lay->addWidget( _resize ); @@ -72,6 +81,13 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW } -void InputMethodSettings::appletChanged() -{ +bool InputMethodSettings::changed()const{ + if ( _wasResize != _resize->isChecked() ) + return true; + else if ( _wasFloat != _float->isChecked() ) + return true; + else if ( _wasWidth != _size->value() ) + return true; + else + return false; } @@ -85,4 +101,7 @@ void InputMethodSettings::accept() cfg.writeEntry( "Width", _size->value() ); cfg.write(); + + if ( changed() ) + QCopEnvelope( "QPE/TaskBar", "reloadInputMethods()" ); } diff --git a/core/settings/launcher/inputmethodsettings.h b/core/settings/launcher/inputmethodsettings.h index 486ee5e..2ae43f2 100644 --- a/core/settings/launcher/inputmethodsettings.h +++ b/core/settings/launcher/inputmethodsettings.h @@ -43,7 +43,4 @@ class InputMethodSettings : public QWidget void accept ( ); - protected slots: - void appletChanged ( ); - protected: void init ( ); @@ -53,4 +50,10 @@ class InputMethodSettings : public QWidget QCheckBox* _float; QSpinBox* _size; + + private: + bool changed()const; + bool _wasResize : 1; + bool _wasFloat : 1; + int _wasWidth; }; |