-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 56 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 3 |
2 files changed, 46 insertions, 13 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 10bc611..c5ebe3c 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -10,4 +10,2 @@ | |||
10 | 10 | ||
11 | #include <iostream.h> | ||
12 | |||
13 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
@@ -62,5 +60,24 @@ ConfigDlg::ConfigDlg () : QTabWidget () | |||
62 | 60 | ||
63 | for (uint i = 0; i <map_dir.count(); i++) { | 61 | for (uint i = 0; i < map_dir.count(); i++) { |
62 | |||
63 | QFile map (map_dir.absPath() + "/" + map_dir[i]); | ||
64 | if (map.open(IO_ReadOnly)) { | ||
65 | |||
66 | QString line; bool found = 0; | ||
67 | |||
68 | map.readLine(line, 1024); | ||
69 | while (!map.atEnd()) { | ||
64 | 70 | ||
65 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); | 71 | if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { |
72 | |||
73 | keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | ||
74 | found = 1; | ||
75 | break; | ||
76 | } | ||
77 | map.readLine(line, 1024); | ||
78 | } | ||
79 | if (!found) keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); | ||
80 | |||
81 | map.close(); | ||
82 | } | ||
66 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { | 83 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { |
@@ -87,3 +104,22 @@ ConfigDlg::ConfigDlg () : QTabWidget () | |||
87 | 104 | ||
88 | keymaps->insertItem(custom_maps[i]); | 105 | QFile map (custom_maps[i]); |
106 | if (map.open(IO_ReadOnly)) { | ||
107 | |||
108 | QString line; bool found = 0; | ||
109 | |||
110 | map.readLine(line, 1024); | ||
111 | while (!map.atEnd()) { | ||
112 | |||
113 | if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { | ||
114 | |||
115 | keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | ||
116 | found = 1; | ||
117 | break; | ||
118 | } | ||
119 | map.readLine(line, 1024); | ||
120 | } | ||
121 | if (!found) keymaps->insertItem(custom_maps[i]); | ||
122 | |||
123 | map.close(); | ||
124 | } | ||
89 | if (custom_maps[i] == current_map) { | 125 | if (custom_maps[i] == current_map) { |
@@ -234,3 +270,3 @@ void ConfigDlg::setMap(int index) { | |||
234 | remove_button->setDisabled(true); | 270 | remove_button->setDisabled(true); |
235 | emit setMapToFile(keymaps->text(index)); | 271 | emit setMapToFile(QPEApplication::qpeDir() + "/share/multikey/" + default_maps[index - 1]); |
236 | 272 | ||
@@ -239,3 +275,3 @@ void ConfigDlg::setMap(int index) { | |||
239 | remove_button->setEnabled(true); | 275 | remove_button->setEnabled(true); |
240 | emit setMapToFile(keymaps->text(index)); | 276 | emit setMapToFile(custom_maps[index - default_maps.count() - 1]); |
241 | } | 277 | } |
@@ -254,2 +290,3 @@ void ConfigDlg::addMap() { | |||
254 | maps.append(map); | 290 | maps.append(map); |
291 | custom_maps.append(map); | ||
255 | keymaps->insertItem(map); | 292 | keymaps->insertItem(map); |
@@ -266,5 +303,2 @@ void ConfigDlg::removeMap() { | |||
266 | 303 | ||
267 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; | ||
268 | cout << "currentItem : " << keymaps->currentItem() << "\n"; | ||
269 | |||
270 | // move selection up one | 304 | // move selection up one |
@@ -274,3 +308,3 @@ void ConfigDlg::removeMap() { | |||
274 | 308 | ||
275 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); | 309 | custom_maps.remove(custom_maps.at(keymaps->currentItem() - default_maps.count())); |
276 | 310 | ||
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 3f6f73b..c3ee8f3 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -36,3 +36,2 @@ | |||
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | #include <iostream.h> | ||
38 | 37 | ||
@@ -604,3 +603,3 @@ void Keyboard::toggleRepeat(bool on) { | |||
604 | useRepeat = on; | 603 | useRepeat = on; |
605 | cout << "setting useRepeat to: " << useRepeat << "\n"; | 604 | //cout << "setting useRepeat to: " << useRepeat << "\n"; |
606 | } | 605 | } |