00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "inputmethodsettings.h"
00030
00031
00032 #include <qpe/config.h>
00033 #include <opie2/odebug.h>
00034 #include <qpe/qcopenvelope_qws.h>
00035
00036
00037 #include <qspinbox.h>
00038 #include <qcheckbox.h>
00039 #include <qlayout.h>
00040 #include <qlabel.h>
00041 #include <qwhatsthis.h>
00042
00043
00044 InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
00045 {
00046 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
00047
00048 _resize = new QCheckBox( tr( "Resize application on Popup" ), this );
00049 _float = new QCheckBox( tr( "Enable floating and resizing" ), this );
00050
00051 QHBoxLayout* hbox = new QHBoxLayout( lay, 4 );
00052 hbox->addWidget( new QLabel( "Initial Width:", this ) );
00053 _size = new QSpinBox( 10, 100, 10, this );
00054 _size->setSuffix( "%" );
00055 hbox->addWidget( _size );
00056 hbox->addStretch();
00057
00058 Config cfg( "Launcher" );
00059 cfg.setGroup( "InputMethods" );
00060
00061
00062
00063
00064 _wasResize = cfg.readBoolEntry( "Resize", true );
00065 _wasFloat = cfg.readBoolEntry( "Float", false );
00066 _wasWidth = cfg.readNumEntry( "Width", 100 );
00067
00068 _resize->setChecked( _wasResize );
00069 _float ->setChecked( _wasFloat );
00070 _size ->setValue( _wasWidth );
00071
00072 lay->addWidget( _resize );
00073 lay->addWidget( _float );
00074 lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) );
00075
00076 lay->addStretch();
00077
00078 QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) );
00079 QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) );
00080 QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) );
00081 }
00082
00083 bool InputMethodSettings::changed()const{
00084 if ( _wasResize != _resize->isChecked() )
00085 return true;
00086 else if ( _wasFloat != _float->isChecked() )
00087 return true;
00088 else if ( _wasWidth != _size->value() )
00089 return true;
00090 else
00091 return false;
00092 }
00093
00094 void InputMethodSettings::accept()
00095 {
00096 odebug << "InputMethodSettings::accept()" << oendl;
00097 Config cfg( "Launcher" );
00098 cfg.setGroup( "InputMethods" );
00099 cfg.writeEntry( "Resize", _resize->isChecked() );
00100 cfg.writeEntry( "Float", _float->isChecked() );
00101 cfg.writeEntry( "Width", _size->value() );
00102 cfg.write();
00103
00104 if ( changed() )
00105 QCopEnvelope( "QPE/TaskBar", "reloadInputMethods()" );
00106 }
00107