Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 37 |
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) this, SLOT(setMapToDefault())); - connect(configdlg, SIGNAL(setMapToFile(int)), - this, SLOT(setMapToFile(int))); + connect(configdlg, SIGNAL(setMapToFile(QString)), + this, SLOT(setMapToFile(QString))); configdlg->showMaximized(); @@ -521,3 +521,3 @@ void Keyboard::setMapToDefault() { config->setGroup ("keymaps"); - config->writeEntry ("current", -1); // default closed + config->writeEntry ("current", key_map); // default closed delete config; @@ -531,3 +531,3 @@ void Keyboard::setMapToDefault() { -void Keyboard::setMapToFile(int index) { +void Keyboard::setMapToFile(QString map) { @@ -536,7 +536,4 @@ void Keyboard::setMapToFile(int index) { config->setGroup ("keymaps"); - config->writeEntry ("current", index); // default closed + config->writeEntry ("current", map); // default closed - - /* now you have to retrieve the map */ - QStringList maps = config->readListEntry("maps", QChar('|')); delete config; @@ -544,6 +541,6 @@ void Keyboard::setMapToFile(int index) { delete keys; - if (index < 0 || (int)maps.count() <= index) - keys = new Keys(); + if (QFile(map).exists()) + keys = new Keys(map); else - keys = new Keys(maps[index]); + keys = new Keys(); @@ -861,10 +858,6 @@ Keys::Keys() { config->setGroup( "keymaps" ); - QStringList maps = config->readListEntry ("maps", QChar('|')); - - int index = config->readNumEntry( "current", -1 ); + QString map = config->readEntry( "current" ); delete config; - QString key_map; - - if (index < 0 || (int)maps.count() <= index) { + if (map.isNull() || !(QFile(map).exists())) { @@ -875,12 +868,8 @@ Keys::Keys() { - key_map = QPEApplication::qpeDir() + "/share/multikey/" + map = QPEApplication::qpeDir() + "/share/multikey/" + l + ".keymap"; - } else { - - key_map = maps[index]; - } - + } - setKeysFromFile(key_map); + setKeysFromFile(map); } |