summaryrefslogtreecommitdiff
path: root/core/launcher/inputmethods.cpp
authorllornkcor <llornkcor>2002-03-16 22:22:53 (UTC)
committer llornkcor <llornkcor>2002-03-16 22:22:53 (UTC)
commit152ca79d3a2d0277934eb0c844c15f0170de2044 (patch) (unidiff)
tree5cf8fd5c17e14a6266912103d125153a3b860bf6 /core/launcher/inputmethods.cpp
parent8111d4bf6281420b7f44ae70c26d2531cfe34401 (diff)
downloadopie-152ca79d3a2d0277934eb0c844c15f0170de2044.zip
opie-152ca79d3a2d0277934eb0c844c15f0170de2044.tar.gz
opie-152ca79d3a2d0277934eb0c844c15f0170de2044.tar.bz2
added ability to remember the preferred (last used) input method on qpe restart
Diffstat (limited to 'core/launcher/inputmethods.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 003dc77..da98e07 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -19,4 +19,5 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST
21#include "inputmethods.h" 22#include "inputmethods.h"
22 23
@@ -25,4 +26,5 @@
25#include <qpe/inputmethodinterface.h> 26#include <qpe/inputmethodinterface.h>
26#include <qpe/qlibrary.h> 27#include <qpe/qlibrary.h>
28#include <qpe/global.h>
27 29
28#include <qpopupmenu.h> 30#include <qpopupmenu.h>
@@ -179,13 +181,16 @@ void InputMethods::loadInputMethods()
179 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); 181 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
180 inputMethodList.append( input ); 182 inputMethodList.append( input );
181 QString lang = getenv( "LANG" ); 183
182 QTranslator * trans = new QTranslator(qApp);
183 QString type = (*it).left( (*it).find(".") ); 184 QString type = (*it).left( (*it).find(".") );
185 QStringList langs = Global::languageList();
186 for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) {
187 QString lang = *lit;
188 QTranslator * trans = new QTranslator(qApp);
184 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 189 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
185 qDebug("tr for inputmethod: %s", tfn.latin1() );
186 if ( trans->load( tfn )) 190 if ( trans->load( tfn ))
187 qApp->installTranslator( trans ); 191 qApp->installTranslator( trans );
188 else 192 else
189 delete trans; 193 delete trans;
194 }
190 } else { 195 } else {
191 delete lib; 196 delete lib;
@@ -208,5 +213,19 @@ void InputMethods::loadInputMethods()
208#endif 213#endif
209 if ( !inputMethodList.isEmpty() ) { 214 if ( !inputMethodList.isEmpty() ) {
215 Config cfg("qpe");
216 cfg.setGroup("InputMethod");
217 QString curMethod = cfg.readEntry("current","");
218 if(curMethod.isEmpty()) {
210 method = &inputMethodList[0]; 219 method = &inputMethodList[0];
220 } else {
221 int i = 0;
222 QValueList<InputMethod>::Iterator it;
223 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
224 if((*it).interface->name() == curMethod) {
225 method = &inputMethodList[i];
226// qDebug(curMethod);
227 }
228 }
229 }
211 kbdButton->setPixmap( *method->interface->icon() ); 230 kbdButton->setPixmap( *method->interface->icon() );
212 } 231 }
@@ -250,4 +269,7 @@ void InputMethods::chooseMethod(InputMethod* im)
250 method->widget->hide(); 269 method->widget->hide();
251 method = im; 270 method = im;
271 Config cfg("qpe");
272 cfg.setGroup("InputMethod");
273 cfg.writeEntry("current", method->interface->name());
252 kbdButton->setPixmap( *method->interface->icon() ); 274 kbdButton->setPixmap( *method->interface->icon() );
253 } 275 }