summaryrefslogtreecommitdiff
path: root/inputmethods
authorhash <hash>2002-08-18 06:18:18 (UTC)
committer hash <hash>2002-08-18 06:18:18 (UTC)
commit229a66f5a955ec71bd5973ac6961cd694692856a (patch) (unidiff)
treee2fa7e43d90728b972933e3fca77a897aa376287 /inputmethods
parent5f271187a72b18339310f12a2c753e9b8548c078 (diff)
downloadopie-229a66f5a955ec71bd5973ac6961cd694692856a.zip
opie-229a66f5a955ec71bd5973ac6961cd694692856a.tar.gz
opie-229a66f5a955ec71bd5973ac6961cd694692856a.tar.bz2
paths to maps are now saved in config dialog
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp29
-rw-r--r--inputmethods/multikey/configdlg.h2
-rw-r--r--inputmethods/multikey/keyboard.cpp33
-rw-r--r--inputmethods/multikey/keyboard.h2
4 files changed, 53 insertions, 13 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 7bea589..c4f7413 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -22,2 +22,3 @@
22#include <qlistbox.h> 22#include <qlistbox.h>
23#include <qstringlist.h>
23#include "configdlg.h" 24#include "configdlg.h"
@@ -28,2 +29,3 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
28 setCaption( tr("Multikey Configuration") ); 29 setCaption( tr("Multikey Configuration") );
30 Config config ("multikey");
29 31
@@ -41,3 +43,2 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
41 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 43 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
42 //keymaps->setMaximumHeight(150);
43 44
@@ -45,4 +46,17 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
45 keymaps->insertItem(cur); 46 keymaps->insertItem(cur);
47
48 config.setGroup ("keymaps");
49 QStringList maps = config.readListEntry("maps", QChar('|'));
50
51 for (unsigned int i = 0; i < maps.count(); i++) {
52
53 keymaps->insertItem(maps[i]);
54 }
55
56 // have to "+1" because the "current language" listItem... remember?
57 keymaps->setSelected(config.readNumEntry("current", 0) + 1, true);
58
46 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 59 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
47 60
61 /*
48 QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap"); 62 QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap");
@@ -55,2 +69,3 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
55 keymaps->insertItem(de); 69 keymaps->insertItem(de);
70 */
56 71
@@ -68,3 +83,2 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
68 83
69 Config config ("multikey");
70 config.setGroup ("pickboard"); 84 config.setGroup ("pickboard");
@@ -118,2 +132,11 @@ void ConfigDlg::pickTog() {
118 132
133/*
134 * the index is kinda screwy, because in the config file, index 0 is just the
135 * first element in the QStringList, but here it's the "Current Language"
136 * listItem. therefor you have to minus one to the index before you access
137 * it from the config file.
138 *
139 * and later on, the "current language" setting should be -1 in the config file
140 */
141
119void ConfigDlg::setMap(int index) { 142void ConfigDlg::setMap(int index) {
@@ -132,3 +155,3 @@ void ConfigDlg::setMap(int index) {
132 155
133 emit setMapToFile(keymaps->text(index)); 156 emit setMapToFile(index - 1);
134 } 157 }
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index 1a64764..03a3547 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -19,3 +19,3 @@ signals:
19 void setMapToDefault(); 19 void setMapToDefault();
20 void setMapToFile(QString file); 20 void setMapToFile(int index);
21 21
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 671868c..c53ae6c 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -35,2 +35,4 @@
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qstringlist.h>
37#include <iostream.h>
36 38
@@ -290,4 +292,4 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
290 this, SLOT(setMapToDefault())); 292 this, SLOT(setMapToDefault()));
291 connect(configdlg, SIGNAL(setMapToFile(QString)), 293 connect(configdlg, SIGNAL(setMapToFile(int)),
292 this, SLOT(setMapToFile(QString))); 294 this, SLOT(setMapToFile(int)));
293 configdlg->showMaximized(); 295 configdlg->showMaximized();
@@ -519,3 +521,3 @@ void Keyboard::setMapToDefault() {
519 config->setGroup ("keymaps"); 521 config->setGroup ("keymaps");
520 config->writeEntry ("current", key_map); // default closed 522 config->writeEntry ("current", -1); // default closed
521 delete config; 523 delete config;
@@ -529,3 +531,3 @@ void Keyboard::setMapToDefault() {
529 531
530void Keyboard::setMapToFile(QString file) { 532void Keyboard::setMapToFile(int index) {
531 533
@@ -534,3 +536,7 @@ void Keyboard::setMapToFile(QString file) {
534 config->setGroup ("keymaps"); 536 config->setGroup ("keymaps");
535 config->writeEntry ("current", file); // default closed 537 config->writeEntry ("current", index); // default closed
538
539
540 /* now you have to retrieve the map */
541 QStringList maps = config->readListEntry("maps", QChar('|'));
536 delete config; 542 delete config;
@@ -538,3 +544,7 @@ void Keyboard::setMapToFile(QString file) {
538 delete keys; 544 delete keys;
539 keys = new Keys(file); 545 if (index < 0 || (int)maps.count() <= index)
546 keys = new Keys();
547 else
548 keys = new Keys(maps[index]);
549
540 repaint(FALSE); 550 repaint(FALSE);
@@ -851,6 +861,10 @@ Keys::Keys() {
851 config->setGroup( "keymaps" ); 861 config->setGroup( "keymaps" );
852 QString key_map = config->readEntry( "current" ); 862 QStringList maps = config->readListEntry ("maps", QChar('|'));
863
864 int index = config->readNumEntry( "current", -1 );
853 delete config; 865 delete config;
854 866
855 if (key_map.isNull()) { 867 QString key_map;
868
869 if (index < 0 || (int)maps.count() <= index) {
856 870
@@ -864,2 +878,5 @@ Keys::Keys() {
864 878
879 } else {
880
881 key_map = maps[index];
865 } 882 }
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index 400edc0..7a8d4b4 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -115,3 +115,3 @@ private slots:
115 void setMapToDefault(); 115 void setMapToDefault();
116 void setMapToFile(QString file); 116 void setMapToFile(int index);
117 117