author | hash <hash> | 2002-08-27 02:05:55 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-27 02:05:55 (UTC) |
commit | 59172653912647168c44ec30c66458b7ed4c5a41 (patch) (unidiff) | |
tree | dff146bf9812c39764ef2c134a9bb0764b3dc104 /inputmethods | |
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() { | |||
260 | 260 | ||
261 | void ConfigDlg::setMap(int index) { | 261 | void ConfigDlg::setMap(int index) { |
262 | 262 | ||
263 | if (index == 0) { | 263 | if (index == 0) { |
264 | 264 | ||
265 | remove_button->setDisabled(true); | 265 | remove_button->setDisabled(true); |
266 | emit setMapToDefault(); | 266 | emit setMapToDefault(); |
267 | } | 267 | } |
268 | else if ((uint)index <= default_maps.count()) { | 268 | else if ((uint)index <= default_maps.count()) { |
269 | 269 | ||
270 | remove_button->setDisabled(true); | 270 | remove_button->setDisabled(true); |
271 | emit setMapToFile(QPEApplication::qpeDir() + "/share/multikey/" + default_maps[index - 1]); | 271 | emit setMapToFile(QPEApplication::qpeDir() + "/share/multikey/" + default_maps[index - 1]); |
272 | 272 | ||
273 | } else { | 273 | } else { |
274 | 274 | ||
275 | remove_button->setEnabled(true); | 275 | remove_button->setEnabled(true); |
276 | emit setMapToFile(custom_maps[index - default_maps.count() - 1]); | 276 | emit setMapToFile(custom_maps[index - default_maps.count() - 1]); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | // ConfigDlg::addMap() {{{1 | 280 | // ConfigDlg::addMap() {{{1 |
281 | void ConfigDlg::addMap() { | 281 | void ConfigDlg::addMap() { |
282 | 282 | ||
283 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 283 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
284 | 284 | ||
285 | if (map.isNull()) return; | 285 | if (map.isNull()) return; |
286 | 286 | ||
287 | Config config ("multikey"); | 287 | Config config ("multikey"); |
288 | config.setGroup("keymaps"); | 288 | config.setGroup("keymaps"); |
289 | QStringList maps = config.readListEntry("maps", QChar('|')); | 289 | QStringList maps = config.readListEntry("maps", QChar('|')); |
290 | maps.append(map); | 290 | maps.append(map); |
291 | custom_maps.append(map); | 291 | custom_maps.append(map); |
292 | keymaps->insertItem(map); | 292 | |
293 | QFile map_file (map); | ||
294 | if (map_file.open(IO_ReadOnly)) { | ||
295 | |||
296 | QString line; bool found = 0; | ||
297 | |||
298 | map_file.readLine(line, 1024); | ||
299 | while (!map_file.atEnd()) { | ||
300 | |||
301 | if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { | ||
302 | |||
303 | keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | ||
304 | found = 1; | ||
305 | break; | ||
306 | } | ||
307 | map_file.readLine(line, 1024); | ||
308 | } | ||
309 | if (!found) keymaps->insertItem(map); | ||
310 | |||
311 | map_file.close(); | ||
312 | } | ||
313 | |||
293 | keymaps->setSelected(keymaps->count() - 1, true); | 314 | keymaps->setSelected(keymaps->count() - 1, true); |
294 | 315 | ||
295 | 316 | ||
296 | config.writeEntry("maps", maps, QChar('|')); | 317 | config.writeEntry("maps", maps, QChar('|')); |
297 | config.writeEntry("current", map); | 318 | config.writeEntry("current", map); |
298 | 319 | ||
299 | } | 320 | } |
300 | 321 | ||
301 | // ConfigDlg::removeMap() {{{1 | 322 | // ConfigDlg::removeMap() {{{1 |
302 | void ConfigDlg::removeMap() { | 323 | void ConfigDlg::removeMap() { |
303 | 324 | ||
304 | // move selection up one | 325 | // move selection up one |
305 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 326 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
306 | // delete the next selected item cus you just moved it up | 327 | // delete the next selected item cus you just moved it up |
307 | keymaps->removeItem(keymaps->currentItem() + 1); | 328 | keymaps->removeItem(keymaps->currentItem() + 1); |
308 | 329 | ||
309 | custom_maps.remove(custom_maps.at(keymaps->currentItem() - default_maps.count())); | 330 | custom_maps.remove(custom_maps.at(keymaps->currentItem() - default_maps.count())); |
310 | 331 | ||
311 | // write the changes | 332 | // write the changes |
312 | Config config ("multikey"); | 333 | Config config ("multikey"); |
313 | config.setGroup("keymaps"); | 334 | config.setGroup("keymaps"); |
314 | config.writeEntry("maps", custom_maps, QChar('|')); | 335 | config.writeEntry("maps", custom_maps, QChar('|')); |
315 | } | 336 | } |
316 | 337 | ||
317 | /* ConfigDlg::slots for the color buttons {{{1 | 338 | /* ConfigDlg::slots for the color buttons {{{1 |
318 | * | 339 | * |
319 | * these four slots are almost the same, except for the names. i was thinking | 340 | * these four slots are almost the same, except for the names. i was thinking |
320 | * of making a map with pointers to the buttons and names of the configEntry | 341 | * of making a map with pointers to the buttons and names of the configEntry |
321 | * so it could be one slot, but then there would be no way of telling which | 342 | * so it could be one slot, but then there would be no way of telling which |
322 | * of the buttons was clicked if they all connect to the same slot. | 343 | * of the buttons was clicked if they all connect to the same slot. |
323 | * | 344 | * |
324 | */ | 345 | */ |
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 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS= keyboard.h \ | 3 | HEADERS= keyboard.h \ |
4 | configdlg.h \ | 4 | configdlg.h \ |
5 | ../pickboard/pickboardcfg.h \ | 5 | ../pickboard/pickboardcfg.h \ |
6 | ../pickboard/pickboardpicks.h \ | 6 | ../pickboard/pickboardpicks.h \ |
7 | keyboardimpl.h | 7 | keyboardimpl.h |
8 | SOURCES= keyboard.cpp \ | 8 | SOURCES= keyboard.cpp \ |
9 | configdlg.cpp \ | 9 | configdlg.cpp \ |
10 | ../pickboard/pickboardcfg.cpp \ | 10 | ../pickboard/pickboardcfg.cpp \ |
11 | ../pickboard/pickboardpicks.cpp \ | 11 | ../pickboard/pickboardpicks.cpp \ |
12 | keyboardimpl.cpp | 12 | keyboardimpl.cpp |
13 | TARGET = qmultikey | 13 | TARGET = qmultikey |
14 | DESTDIR = ../../plugins/inputmethods | 14 | DESTDIR = $(OPIEDIR)/plugins/inputmethods |
15 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
16 | DEPENDPATH += ../$(OPIEDIR)/include ../../launcher | 16 | DEPENDPATH += ../$(OPIEDIR)/include ../../launcher |
17 | LIBS += -lqpe | 17 | LIBS += -lqpe |
18 | VERSION = 1.0.0 | 18 | VERSION = 1.0.0 |
19 | 19 | ||
20 | TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts | 20 | TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts |
21 | TRANSLATIONS += ../../i18n/de/libqmultikey.ts | 21 | TRANSLATIONS += ../../i18n/de/libqmultikey.ts |
22 | TRANSLATIONS += ../../i18n/en/libqmultikey.ts | 22 | TRANSLATIONS += ../../i18n/en/libqmultikey.ts |
23 | TRANSLATIONS += ../../i18n/hu/libqmultikey.ts | 23 | TRANSLATIONS += ../../i18n/hu/libqmultikey.ts |
24 | TRANSLATIONS += ../../i18n/sl/libqmultikey.ts | 24 | TRANSLATIONS += ../../i18n/sl/libqmultikey.ts |
25 | TRANSLATIONS += ../../i18n/ja/libqmultikey.ts | 25 | TRANSLATIONS += ../../i18n/ja/libqmultikey.ts |
26 | TRANSLATIONS += ../../i18n/ko/libqmultikey.ts | 26 | TRANSLATIONS += ../../i18n/ko/libqmultikey.ts |
27 | TRANSLATIONS += ../../i18n/pl/libqmultikey.ts | 27 | TRANSLATIONS += ../../i18n/pl/libqmultikey.ts |
28 | TRANSLATIONS += ../../i18n/no/libqmultikey.ts | 28 | TRANSLATIONS += ../../i18n/no/libqmultikey.ts |
29 | TRANSLATIONS += ../../i18n/zh_CN/libqmultikey.ts | 29 | TRANSLATIONS += ../../i18n/zh_CN/libqmultikey.ts |
30 | TRANSLATIONS += ../../i18n/zh_TW/libqmultikey.ts | 30 | TRANSLATIONS += ../../i18n/zh_TW/libqmultikey.ts |
31 | TRANSLATIONS += ../../i18n/fr/libqmultikey.ts | 31 | TRANSLATIONS += ../../i18n/fr/libqmultikey.ts |