Diffstat (limited to 'inputmethods/multikey/configdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 29 |
1 files changed, 26 insertions, 3 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 @@ -21,4 +21,5 @@ #include <qpushbutton.h> #include <qlistbox.h> +#include <qstringlist.h> #include "configdlg.h" #include "keyboard.h" @@ -27,4 +28,5 @@ ConfigDlg::ConfigDlg () : QTabWidget () { setCaption( tr("Multikey Configuration") ); + Config config ("multikey"); /* @@ -40,10 +42,22 @@ ConfigDlg::ConfigDlg () : QTabWidget () keymaps = new QListBox (map_group); keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); - //keymaps->setMaximumHeight(150); QString cur(tr("Current Language")); keymaps->insertItem(cur); + + config.setGroup ("keymaps"); + QStringList maps = config.readListEntry("maps", QChar('|')); + + for (unsigned int i = 0; i < maps.count(); i++) { + + keymaps->insertItem(maps[i]); + } + + // have to "+1" because the "current language" listItem... remember? + keymaps->setSelected(config.readNumEntry("current", 0) + 1, true); + connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); + /* QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap"); keymaps->insertItem(ko); @@ -54,4 +68,5 @@ ConfigDlg::ConfigDlg () : QTabWidget () QString de(QPEApplication::qpeDir() + "/share/multikey/de.keymap"); keymaps->insertItem(de); + */ QGrid *add_remove_grid = new QGrid(2, map_group); @@ -67,5 +82,4 @@ ConfigDlg::ConfigDlg () : QTabWidget () pick_button = new QCheckBox(tr("Pickboard"), gen_box); - Config config ("multikey"); config.setGroup ("pickboard"); bool pick_open = config.readBoolEntry ("open", "0"); // default closed @@ -117,4 +131,13 @@ void ConfigDlg::pickTog() { } +/* + * the index is kinda screwy, because in the config file, index 0 is just the + * first element in the QStringList, but here it's the "Current Language" + * listItem. therefor you have to minus one to the index before you access + * it from the config file. + * + * and later on, the "current language" setting should be -1 in the config file + */ + void ConfigDlg::setMap(int index) { @@ -131,5 +154,5 @@ void ConfigDlg::setMap(int index) { remove_button->setEnabled(true); - emit setMapToFile(keymaps->text(index)); + emit setMapToFile(index - 1); } } |