Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

inputmethodsettings.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the OPIE Project
00003                =.            Copyright (c)  2002 Trolltech AS <info@trolltech.com>
00004              .=l.            Copyright (c)  2003 Michael Lauer <mickeyl@handhelds.org>
00005            .>+-=
00006  _;:,     .>    :=|.         This file is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00011      ._= =}       :          or (at your option) any later version.
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This file is distributed in the hope that
00014      +  .  -:.       =       it will be useful, but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU General
00018 ..}^=.=       =       ;      Public License for more details.
00019 ++=   -.     .`     .:
00020  :     =  ...= . :.=-        You should have received a copy of the GNU
00021  -.   .:....=;==+<;          General Public License along with this file;
00022   -_. . .   )=.  =           see the file COPYING. If not, write to the
00023     --        :-=`           Free Software Foundation, Inc.,
00024                              59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 #include "inputmethodsettings.h"
00030 
00031 /* OPIE */
00032 #include <qpe/config.h>
00033 #include <opie2/odebug.h>
00034 #include <qpe/qcopenvelope_qws.h>
00035 
00036 /* QT */
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      * load the values to see if something was changed
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 

Generated on Sat Nov 5 16:15:57 2005 for OPIE by  doxygen 1.4.2