author | hash <hash> | 2002-08-27 02:05:55 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-27 02:05:55 (UTC) |
commit | 59172653912647168c44ec30c66458b7ed4c5a41 (patch) (side-by-side diff) | |
tree | dff146bf9812c39764ef2c134a9bb0764b3dc104 | |
parent | b35f6fbca5a2720044e0a1dc309191e9b39eb3ce (diff) | |
download | opie-59172653912647168c44ec30c66458b7ed4c5a41.zip opie-59172653912647168c44ec30c66458b7ed4c5a41.tar.gz opie-59172653912647168c44ec30c66458b7ed4c5a41.tar.bz2 |
now shows whatever you wrote in the keymap 'title' var as the listItem
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 23 | ||||
-rw-r--r-- | inputmethods/multikey/multikey.pro | 2 |
2 files changed, 23 insertions, 2 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index c5ebe3c..f6507b4 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp @@ -260,65 +260,86 @@ void ConfigDlg::repeatTog() { void ConfigDlg::setMap(int index) { if (index == 0) { remove_button->setDisabled(true); emit setMapToDefault(); } else if ((uint)index <= default_maps.count()) { remove_button->setDisabled(true); emit setMapToFile(QPEApplication::qpeDir() + "/share/multikey/" + default_maps[index - 1]); } else { remove_button->setEnabled(true); emit setMapToFile(custom_maps[index - default_maps.count() - 1]); } } // ConfigDlg::addMap() {{{1 void ConfigDlg::addMap() { QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); if (map.isNull()) return; Config config ("multikey"); config.setGroup("keymaps"); QStringList maps = config.readListEntry("maps", QChar('|')); maps.append(map); custom_maps.append(map); - keymaps->insertItem(map); + + QFile map_file (map); + if (map_file.open(IO_ReadOnly)) { + + QString line; bool found = 0; + + map_file.readLine(line, 1024); + while (!map_file.atEnd()) { + + if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { + + keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); + found = 1; + break; + } + map_file.readLine(line, 1024); + } + if (!found) keymaps->insertItem(map); + + map_file.close(); + } + keymaps->setSelected(keymaps->count() - 1, true); config.writeEntry("maps", maps, QChar('|')); config.writeEntry("current", map); } // ConfigDlg::removeMap() {{{1 void ConfigDlg::removeMap() { // move selection up one keymaps->setSelected(keymaps->currentItem() - 1, true); // delete the next selected item cus you just moved it up keymaps->removeItem(keymaps->currentItem() + 1); custom_maps.remove(custom_maps.at(keymaps->currentItem() - default_maps.count())); // write the changes Config config ("multikey"); config.setGroup("keymaps"); config.writeEntry("maps", custom_maps, QChar('|')); } /* ConfigDlg::slots for the color buttons {{{1 * * these four slots are almost the same, except for the names. i was thinking * of making a map with pointers to the buttons and names of the configEntry * so it could be one slot, but then there would be no way of telling which * of the buttons was clicked if they all connect to the same slot. * */ diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro index 9d76a3d..1171602 100644 --- a/inputmethods/multikey/multikey.pro +++ b/inputmethods/multikey/multikey.pro @@ -1,31 +1,31 @@ TEMPLATE = lib CONFIG += qt warn_on release HEADERS = keyboard.h \ configdlg.h \ ../pickboard/pickboardcfg.h \ ../pickboard/pickboardpicks.h \ keyboardimpl.h SOURCES = keyboard.cpp \ configdlg.cpp \ ../pickboard/pickboardcfg.cpp \ ../pickboard/pickboardpicks.cpp \ keyboardimpl.cpp TARGET = qmultikey -DESTDIR = ../../plugins/inputmethods +DESTDIR = $(OPIEDIR)/plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts TRANSLATIONS += ../../i18n/de/libqmultikey.ts TRANSLATIONS += ../../i18n/en/libqmultikey.ts TRANSLATIONS += ../../i18n/hu/libqmultikey.ts TRANSLATIONS += ../../i18n/sl/libqmultikey.ts TRANSLATIONS += ../../i18n/ja/libqmultikey.ts TRANSLATIONS += ../../i18n/ko/libqmultikey.ts TRANSLATIONS += ../../i18n/pl/libqmultikey.ts TRANSLATIONS += ../../i18n/no/libqmultikey.ts TRANSLATIONS += ../../i18n/zh_CN/libqmultikey.ts TRANSLATIONS += ../../i18n/zh_TW/libqmultikey.ts TRANSLATIONS += ../../i18n/fr/libqmultikey.ts |