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
@@ -80,29 +80,25 @@ int InputMethod::operator <=(const InputMethod& o) const
class IMToolButton : public QToolButton
{
public:
IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
{ 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)
kbdButton->setFixedHeight( parent->sizeHint().height() );
kbdButton->setFixedWidth( 32 );
kbdButton->setAutoRaise( TRUE );
kbdButton->setUsesBigPixmap( TRUE );
@@ -523,25 +519,25 @@ void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data )
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" );
int l = cfg.readNumEntry( "absX", -1 );
int t = cfg.readNumEntry( "absY", -1 );
int w = cfg.readNumEntry( "absWidth", -1 );
int h = cfg.readNumEntry( "absHeight", -1 );
@@ -599,23 +595,33 @@ QString InputMethods::currentShown() const
{
return mkeyboard && mkeyboard->widget->isVisible()
? mkeyboard->name() : QString::null;
}
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
@@ -65,24 +65,25 @@ public:
InputMethods( QWidget * );
~InputMethods();
QRect inputRect() const;
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 );
void resetStates();
void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool );
void qcopReceive( const QCString &msg, const QByteArray &data );
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
@@ -167,27 +167,26 @@ private:
bool nl, cl;
};
//---------------------------------------------------------------------------
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()) );
stack = new QWidgetStack( this );
stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
label = new QLabel(stack);
@@ -326,24 +325,26 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
QString text;
stream >> text;
setStatusMessage( text );
} else if ( msg == "hideInputMethod()" ) {
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();
else
QCopEnvelope e( "QPE/System", "toggleApplicationMenu()" );
}else if ( msg == "toggleStartMenu()" )
sm->launch();
@@ -368,13 +369,19 @@ void TaskBar::toggleCapsLockState()
}
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
@@ -56,29 +56,32 @@ public slots:
void stopWait();
void clearStatusBar();
void toggleNumLockState();
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;
LockKeyState* lockState;
StartMenu *sm;
bool resizeRunningApp;
};
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
@@ -22,24 +22,25 @@
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#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>
InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
{
QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
@@ -47,42 +48,60 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW
_resize = new QCheckBox( tr( "Resize application on Popup" ), this );
_float = new QCheckBox( tr( "Enable floating and resizing" ), this );
QHBoxLayout* hbox = new QHBoxLayout( lay, 4 );
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
@@ -33,25 +33,28 @@
class QCheckBox;
class QSpinBox;
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