summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Unidiff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index c53ae6c..ac3d9be 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -292,4 +292,4 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
292 this, SLOT(setMapToDefault())); 292 this, SLOT(setMapToDefault()));
293 connect(configdlg, SIGNAL(setMapToFile(int)), 293 connect(configdlg, SIGNAL(setMapToFile(QString)),
294 this, SLOT(setMapToFile(int))); 294 this, SLOT(setMapToFile(QString)));
295 configdlg->showMaximized(); 295 configdlg->showMaximized();
@@ -521,3 +521,3 @@ void Keyboard::setMapToDefault() {
521 config->setGroup ("keymaps"); 521 config->setGroup ("keymaps");
522 config->writeEntry ("current", -1); // default closed 522 config->writeEntry ("current", key_map); // default closed
523 delete config; 523 delete config;
@@ -531,3 +531,3 @@ void Keyboard::setMapToDefault() {
531 531
532void Keyboard::setMapToFile(int index) { 532void Keyboard::setMapToFile(QString map) {
533 533
@@ -536,7 +536,4 @@ void Keyboard::setMapToFile(int index) {
536 config->setGroup ("keymaps"); 536 config->setGroup ("keymaps");
537 config->writeEntry ("current", index); // default closed 537 config->writeEntry ("current", map); // default closed
538 538
539
540 /* now you have to retrieve the map */
541 QStringList maps = config->readListEntry("maps", QChar('|'));
542 delete config; 539 delete config;
@@ -544,6 +541,6 @@ void Keyboard::setMapToFile(int index) {
544 delete keys; 541 delete keys;
545 if (index < 0 || (int)maps.count() <= index) 542 if (QFile(map).exists())
546 keys = new Keys(); 543 keys = new Keys(map);
547 else 544 else
548 keys = new Keys(maps[index]); 545 keys = new Keys();
549 546
@@ -861,10 +858,6 @@ Keys::Keys() {
861 config->setGroup( "keymaps" ); 858 config->setGroup( "keymaps" );
862 QStringList maps = config->readListEntry ("maps", QChar('|')); 859 QString map = config->readEntry( "current" );
863
864 int index = config->readNumEntry( "current", -1 );
865 delete config; 860 delete config;
866 861
867 QString key_map; 862 if (map.isNull() || !(QFile(map).exists())) {
868
869 if (index < 0 || (int)maps.count() <= index) {
870 863
@@ -875,12 +868,8 @@ Keys::Keys() {
875 868
876 key_map = QPEApplication::qpeDir() + "/share/multikey/" 869 map = QPEApplication::qpeDir() + "/share/multikey/"
877 + l + ".keymap"; 870 + l + ".keymap";
878 871
879 } else { 872 }
880
881 key_map = maps[index];
882 }
883
884 873
885 setKeysFromFile(key_map); 874 setKeysFromFile(map);
886} 875}