summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-22 21:35:22 (UTC)
committer zecke <zecke>2004-08-22 21:35:22 (UTC)
commit8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5 (patch) (side-by-side diff)
treecaf4d5d4cab240f2e7653b394666c5e2fb178798
parent2304c546ec73f2643621f04d61128c2686812cd1 (diff)
downloadopie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.zip
opie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.tar.gz
opie-8b5ab9a283c219aaba84a8b23adc6c3d29cef7d5.tar.bz2
Reload InputMethods when LauncherSettings changed InputMethod Options
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp20
-rw-r--r--core/launcher/inputmethods.h1
-rw-r--r--core/launcher/taskbar.cpp13
-rw-r--r--core/launcher/taskbar.h5
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp29
-rw-r--r--core/settings/launcher/inputmethodsettings.h9
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
@@ -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 );
+}
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
@@ -71,12 +71,13 @@ public:
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();
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
@@ -173,15 +173,14 @@ 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 );
@@ -332,12 +331,14 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
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()" ) {
@@ -374,7 +375,13 @@ void TaskBar::toggleSymbolInput()
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
@@ -62,17 +62,20 @@ public slots:
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;
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
@@ -28,12 +28,13 @@
#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>
@@ -53,36 +54,54 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW
_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
@@ -39,19 +39,22 @@ class InputMethodSettings : public QWidget
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