-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 @@ -84,21 +84,17 @@ public: { setWFlags( WStyle_Tool ); } }; 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); kbdButton->setToggleButton( TRUE ); if (parent->sizeHint().height() > 0) @@ -527,17 +523,17 @@ void InputMethods::showKbd( bool on ) if ( !mkeyboard ) return; 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; Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); @@ -603,19 +599,29 @@ QString InputMethods::currentShown() const void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) { #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 ); +} 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 @@ -69,16 +69,17 @@ public: bool shown() const; QString currentShown() const; // name of interface void showInputMethod(const QString& id); void showInputMethod(); void hideInputMethod(); void unloadInputMethods(); void loadInputMethods(); virtual bool eventFilter( QObject *, QEvent * ); + void readConfig(); signals: void inputToggled( bool on ); private slots: void chooseKbd(); void chooseIm(); void showKbd( bool ); 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 @@ -171,19 +171,18 @@ private: 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 ); connect( sm, SIGNAL(tabSelected(const QString&)), this, SIGNAL(tabSelected(const QString&)) ); inputMethods = new InputMethods( this ); connect( inputMethods, SIGNAL(inputToggled(bool)), this, SLOT(calcMaxWindowRect()) ); @@ -330,16 +329,18 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) inputMethods->hideInputMethod(); } else if ( msg == "showInputMethod()" ) { inputMethods->showInputMethod(); } else if ( msg == "showInputMethod(QString)" ) { QString name; stream >> name; inputMethods->showInputMethod(name); } else if ( msg == "reloadInputMethods()" ) { + readConfig(); + inputMethods->readConfig(); inputMethods->loadInputMethods(); } else if ( msg == "reloadApplets()" ) { sysTray->clearApplets(); sm->createMenu(); sysTray->addApplets(); }else if ( msg == "toggleMenu()" ) { if ( sm-> launchMenu-> isVisible() ) sm-> launch(); @@ -372,9 +373,15 @@ void TaskBar::toggleSymbolInput() QString unicodeInput = qApp->translate( "InputMethods", "Unicode" ); if ( inputMethods->currentShown() == unicodeInput ) { inputMethods->hideInputMethod(); } else { inputMethods->showInputMethod( unicodeInput ); } } +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 @@ -60,21 +60,24 @@ public slots: void toggleCapsLockState(); void toggleSymbolInput(); void calcMaxWindowRect(); protected: void resizeEvent( QResizeEvent * ); 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; InputMethods *inputMethods; SysTray *sysTray; RunningAppBar* runningAppBar; QWidgetStack *stack; QTimer *clearer; QLabel *label; 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 @@ -26,16 +26,17 @@ */ #include "inputmethodsettings.h" /* OPIE */ #include <qpe/config.h> #include <opie2/odebug.h> +#include <qpe/qcopenvelope_qws.h> /* QT */ #include <qspinbox.h> #include <qcheckbox.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> @@ -51,38 +52,56 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW hbox->addWidget( new QLabel( "Initial Width:", this ) ); _size = new QSpinBox( 10, 100, 10, this ); _size->setSuffix( "%" ); hbox->addWidget( _size ); hbox->addStretch(); 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 ); lay->addWidget( _float ); lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); lay->addStretch(); QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); } -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; } void InputMethodSettings::accept() { odebug << "InputMethodSettings::accept()" << oendl; Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); cfg.writeEntry( "Resize", _resize->isChecked() ); cfg.writeEntry( "Float", _float->isChecked() ); 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 @@ -37,21 +37,24 @@ class InputMethodSettings : public QWidget { Q_OBJECT public: InputMethodSettings ( QWidget *parent = 0, const char *name = 0 ); void accept ( ); - protected slots: - void appletChanged ( ); - protected: void init ( ); private: QCheckBox* _resize; QCheckBox* _float; QSpinBox* _size; + + private: + bool changed()const; + bool _wasResize : 1; + bool _wasFloat : 1; + int _wasWidth; }; #endif |