-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 | |||
@@ -1,120 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * make a cursor thing | 4 | * make a cursor thing |
5 | * add meta key support for german, etc | 5 | * add meta key support for german, etc |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <iostream.h> | ||
12 | |||
13 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
15 | 13 | ||
16 | #include <qwidget.h> | 14 | #include <qwidget.h> |
17 | #include <qdialog.h> | 15 | #include <qdialog.h> |
18 | #include <qtabwidget.h> | 16 | #include <qtabwidget.h> |
19 | #include <qvbox.h> | 17 | #include <qvbox.h> |
20 | #include <qgrid.h> | 18 | #include <qgrid.h> |
21 | #include <qgroupbox.h> | 19 | #include <qgroupbox.h> |
22 | #include <qlabel.h> | 20 | #include <qlabel.h> |
23 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
24 | #include <qsizepolicy.h> | 22 | #include <qsizepolicy.h> |
25 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
26 | #include <qlistbox.h> | 24 | #include <qlistbox.h> |
27 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
28 | #include <opie/ofiledialog.h> | 26 | #include <opie/ofiledialog.h> |
29 | #include <opie/colordialog.h> | 27 | #include <opie/colordialog.h> |
30 | #include <qdir.h> | 28 | #include <qdir.h> |
31 | #include <qfileinfo.h> | 29 | #include <qfileinfo.h> |
32 | #include "configdlg.h" | 30 | #include "configdlg.h" |
33 | #include "keyboard.h" | 31 | #include "keyboard.h" |
34 | 32 | ||
35 | // ConfigDlg::ConfigDlg() {{{1 | 33 | // ConfigDlg::ConfigDlg() {{{1 |
36 | ConfigDlg::ConfigDlg () : QTabWidget () | 34 | ConfigDlg::ConfigDlg () : QTabWidget () |
37 | { | 35 | { |
38 | setCaption( tr("Multikey Configuration") ); | 36 | setCaption( tr("Multikey Configuration") ); |
39 | Config config ("multikey"); | 37 | Config config ("multikey"); |
40 | config.setGroup("keymaps"); | 38 | config.setGroup("keymaps"); |
41 | QString current_map = config.readEntry("current", 0); | 39 | QString current_map = config.readEntry("current", 0); |
42 | 40 | ||
43 | /* | 41 | /* |
44 | * 'general config' tab | 42 | * 'general config' tab |
45 | */ | 43 | */ |
46 | 44 | ||
47 | QVBox *gen_box = new QVBox (this); | 45 | QVBox *gen_box = new QVBox (this); |
48 | gen_box->setMargin(3); | 46 | gen_box->setMargin(3); |
49 | addTab(gen_box, tr("General Settings")); | 47 | addTab(gen_box, tr("General Settings")); |
50 | 48 | ||
51 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 49 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
52 | 50 | ||
53 | keymaps = new QListBox (map_group); | 51 | keymaps = new QListBox (map_group); |
54 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 52 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
55 | 53 | ||
56 | QString cur(tr("Current Language")); | 54 | QString cur(tr("Current Language")); |
57 | keymaps->insertItem(cur); | 55 | keymaps->insertItem(cur); |
58 | keymaps->setSelected(0, true); | 56 | keymaps->setSelected(0, true); |
59 | 57 | ||
60 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 58 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); |
61 | default_maps = map_dir.entryList(); // so i can access it in other places | 59 | default_maps = map_dir.entryList(); // so i can access it in other places |
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) { |
67 | 84 | ||
68 | keymaps->setSelected(i + 1, true); | 85 | keymaps->setSelected(i + 1, true); |
69 | } | 86 | } |
70 | 87 | ||
71 | } | 88 | } |
72 | 89 | ||
73 | custom_maps = config.readListEntry("maps", QChar('|')); | 90 | custom_maps = config.readListEntry("maps", QChar('|')); |
74 | 91 | ||
75 | for (uint i = 0; i < custom_maps.count(); i++) { | 92 | for (uint i = 0; i < custom_maps.count(); i++) { |
76 | 93 | ||
77 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) | 94 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) |
78 | || !QFile::exists(custom_maps[i])) { | 95 | || !QFile::exists(custom_maps[i])) { |
79 | 96 | ||
80 | custom_maps.remove(custom_maps.at(i)); | 97 | custom_maps.remove(custom_maps.at(i)); |
81 | 98 | ||
82 | // remove it from the list too | 99 | // remove it from the list too |
83 | config.writeEntry("maps", custom_maps.join("|")); | 100 | config.writeEntry("maps", custom_maps.join("|")); |
84 | 101 | ||
85 | 102 | ||
86 | } else { | 103 | } else { |
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) { |
90 | 126 | ||
91 | keymaps->setSelected(map_dir.count() + i + 1, true); | 127 | keymaps->setSelected(map_dir.count() + i + 1, true); |
92 | } | 128 | } |
93 | } | 129 | } |
94 | } | 130 | } |
95 | 131 | ||
96 | // have to "+1" because the "current language" listItem... remember? | 132 | // have to "+1" because the "current language" listItem... remember? |
97 | 133 | ||
98 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); | 134 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); |
99 | 135 | ||
100 | 136 | ||
101 | QGrid *add_remove_grid = new QGrid(2, map_group); | 137 | QGrid *add_remove_grid = new QGrid(2, map_group); |
102 | add_remove_grid->setMargin(3); | 138 | add_remove_grid->setMargin(3); |
103 | add_remove_grid->setSpacing(3); | 139 | add_remove_grid->setSpacing(3); |
104 | 140 | ||
105 | add_button = new QPushButton(tr("Add"), add_remove_grid); | 141 | add_button = new QPushButton(tr("Add"), add_remove_grid); |
106 | add_button->setFlat((bool)1); | 142 | add_button->setFlat((bool)1); |
107 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); | 143 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); |
108 | 144 | ||
109 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); | 145 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); |
110 | remove_button->setFlat((bool)1); | 146 | remove_button->setFlat((bool)1); |
111 | if ((int)map_dir.count() >= keymaps->currentItem()) | 147 | if ((int)map_dir.count() >= keymaps->currentItem()) |
112 | remove_button->setDisabled(true); | 148 | remove_button->setDisabled(true); |
113 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); | 149 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); |
114 | 150 | ||
115 | // make a box that will contain the buttons on the bottom | 151 | // make a box that will contain the buttons on the bottom |
116 | QGrid *other_grid = new QGrid(2, gen_box); | 152 | QGrid *other_grid = new QGrid(2, gen_box); |
117 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); | 153 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); |
118 | 154 | ||
119 | config.setGroup ("general"); | 155 | config.setGroup ("general"); |
120 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed | 156 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed |
@@ -203,105 +239,103 @@ void ConfigDlg::pickTog() { | |||
203 | 239 | ||
204 | emit pickboardToggled(pick_button->isChecked()); | 240 | emit pickboardToggled(pick_button->isChecked()); |
205 | } | 241 | } |
206 | 242 | ||
207 | void ConfigDlg::repeatTog() { | 243 | void ConfigDlg::repeatTog() { |
208 | 244 | ||
209 | Config config ("multikey"); | 245 | Config config ("multikey"); |
210 | config.setGroup ("general"); | 246 | config.setGroup ("general"); |
211 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed | 247 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed |
212 | 248 | ||
213 | emit repeatToggled(repeat_button->isChecked()); | 249 | emit repeatToggled(repeat_button->isChecked()); |
214 | } | 250 | } |
215 | 251 | ||
216 | // ConfigDlg::setMap {{{1 | 252 | // ConfigDlg::setMap {{{1 |
217 | 253 | ||
218 | /* | 254 | /* |
219 | * the index is kinda screwy, because in the config file, index 0 is just the | 255 | * the index is kinda screwy, because in the config file, index 0 is just the |
220 | * first element in the QStringList, but here it's the "Current Language" | 256 | * first element in the QStringList, but here it's the "Current Language" |
221 | * listItem. therefor you have to minus one to the index before you access it. | 257 | * listItem. therefor you have to minus one to the index before you access it. |
222 | * | 258 | * |
223 | */ | 259 | */ |
224 | 260 | ||
225 | void ConfigDlg::setMap(int index) { | 261 | void ConfigDlg::setMap(int index) { |
226 | 262 | ||
227 | if (index == 0) { | 263 | if (index == 0) { |
228 | 264 | ||
229 | remove_button->setDisabled(true); | 265 | remove_button->setDisabled(true); |
230 | emit setMapToDefault(); | 266 | emit setMapToDefault(); |
231 | } | 267 | } |
232 | else if ((uint)index <= default_maps.count()) { | 268 | else if ((uint)index <= default_maps.count()) { |
233 | 269 | ||
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 | ||
237 | } else { | 273 | } else { |
238 | 274 | ||
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 | } |
242 | } | 278 | } |
243 | 279 | ||
244 | // ConfigDlg::addMap() {{{1 | 280 | // ConfigDlg::addMap() {{{1 |
245 | void ConfigDlg::addMap() { | 281 | void ConfigDlg::addMap() { |
246 | 282 | ||
247 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 283 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
248 | 284 | ||
249 | if (map.isNull()) return; | 285 | if (map.isNull()) return; |
250 | 286 | ||
251 | Config config ("multikey"); | 287 | Config config ("multikey"); |
252 | config.setGroup("keymaps"); | 288 | config.setGroup("keymaps"); |
253 | QStringList maps = config.readListEntry("maps", QChar('|')); | 289 | QStringList maps = config.readListEntry("maps", QChar('|')); |
254 | maps.append(map); | 290 | maps.append(map); |
291 | custom_maps.append(map); | ||
255 | keymaps->insertItem(map); | 292 | keymaps->insertItem(map); |
256 | keymaps->setSelected(keymaps->count() - 1, true); | 293 | keymaps->setSelected(keymaps->count() - 1, true); |
257 | 294 | ||
258 | 295 | ||
259 | config.writeEntry("maps", maps, QChar('|')); | 296 | config.writeEntry("maps", maps, QChar('|')); |
260 | config.writeEntry("current", map); | 297 | config.writeEntry("current", map); |
261 | 298 | ||
262 | } | 299 | } |
263 | 300 | ||
264 | // ConfigDlg::removeMap() {{{1 | 301 | // ConfigDlg::removeMap() {{{1 |
265 | void ConfigDlg::removeMap() { | 302 | 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 |
271 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 305 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
272 | // delete the next selected item cus you just moved it up | 306 | // delete the next selected item cus you just moved it up |
273 | keymaps->removeItem(keymaps->currentItem() + 1); | 307 | keymaps->removeItem(keymaps->currentItem() + 1); |
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 | ||
277 | // write the changes | 311 | // write the changes |
278 | Config config ("multikey"); | 312 | Config config ("multikey"); |
279 | config.setGroup("keymaps"); | 313 | config.setGroup("keymaps"); |
280 | config.writeEntry("maps", custom_maps, QChar('|')); | 314 | config.writeEntry("maps", custom_maps, QChar('|')); |
281 | } | 315 | } |
282 | 316 | ||
283 | /* ConfigDlg::slots for the color buttons {{{1 | 317 | /* ConfigDlg::slots for the color buttons {{{1 |
284 | * | 318 | * |
285 | * these four slots are almost the same, except for the names. i was thinking | 319 | * these four slots are almost the same, except for the names. i was thinking |
286 | * of making a map with pointers to the buttons and names of the configEntry | 320 | * of making a map with pointers to the buttons and names of the configEntry |
287 | * so it could be one slot, but then there would be no way of telling which | 321 | * so it could be one slot, but then there would be no way of telling which |
288 | * of the buttons was clicked if they all connect to the same slot. | 322 | * of the buttons was clicked if they all connect to the same slot. |
289 | * | 323 | * |
290 | */ | 324 | */ |
291 | 325 | ||
292 | void ConfigDlg::keyColorClicked() { | 326 | void ConfigDlg::keyColorClicked() { |
293 | 327 | ||
294 | Config config ("multikey"); | 328 | Config config ("multikey"); |
295 | config.setGroup ("colors"); | 329 | config.setGroup ("colors"); |
296 | 330 | ||
297 | QStringList color = config.readListEntry("keycolor", QChar(',')); | 331 | QStringList color = config.readListEntry("keycolor", QChar(',')); |
298 | 332 | ||
299 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 333 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
300 | 334 | ||
301 | color[0].setNum(newcolor.red()); | 335 | color[0].setNum(newcolor.red()); |
302 | color[1].setNum(newcolor.green()); | 336 | color[1].setNum(newcolor.green()); |
303 | color[2].setNum(newcolor.blue()); | 337 | color[2].setNum(newcolor.blue()); |
304 | 338 | ||
305 | config.writeEntry("keycolor", color, QChar(',')); | 339 | config.writeEntry("keycolor", color, QChar(',')); |
306 | config.write(); | 340 | config.write(); |
307 | 341 | ||
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 | |||
@@ -5,65 +5,64 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | #include "configdlg.h" | 22 | #include "configdlg.h" |
23 | 23 | ||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | 26 | ||
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qfontmetrics.h> | 29 | #include <qfontmetrics.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | #include <iostream.h> | ||
38 | 37 | ||
39 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
40 | 39 | ||
41 | 40 | ||
42 | /* Keyboard::Keyboard {{{1 */ | 41 | /* Keyboard::Keyboard {{{1 */ |
43 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 42 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
44 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), | 43 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), |
45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), | 44 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), |
46 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 45 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
47 | configdlg(0) | 46 | configdlg(0) |
48 | 47 | ||
49 | { | 48 | { |
50 | 49 | ||
51 | // get the default font | 50 | // get the default font |
52 | Config *config = new Config( "qpe" ); | 51 | Config *config = new Config( "qpe" ); |
53 | config->setGroup( "Appearance" ); | 52 | config->setGroup( "Appearance" ); |
54 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); | 53 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); |
55 | delete config; | 54 | delete config; |
56 | 55 | ||
57 | config = new Config("multikey"); | 56 | config = new Config("multikey"); |
58 | config->setGroup ("general"); | 57 | config->setGroup ("general"); |
59 | usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed | 58 | usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed |
60 | useRepeat = config->readBoolEntry ("useRepeat", "1"); | 59 | useRepeat = config->readBoolEntry ("useRepeat", "1"); |
61 | delete config; | 60 | delete config; |
62 | 61 | ||
63 | 62 | ||
64 | setFont( QFont( familyStr, 10 ) ); | 63 | setFont( QFont( familyStr, 10 ) ); |
65 | 64 | ||
66 | picks = new KeyboardPicks( this ); | 65 | picks = new KeyboardPicks( this ); |
67 | picks->setFont( QFont( familyStr, 10 ) ); | 66 | picks->setFont( QFont( familyStr, 10 ) ); |
68 | picks->initialise(); | 67 | picks->initialise(); |
69 | if (usePicks) { | 68 | if (usePicks) { |
@@ -573,65 +572,65 @@ void Keyboard::resetState() | |||
573 | } | 572 | } |
574 | 573 | ||
575 | /* Keyboard::togglePickboard {{{1 */ | 574 | /* Keyboard::togglePickboard {{{1 */ |
576 | void Keyboard::togglePickboard(bool on_off) | 575 | void Keyboard::togglePickboard(bool on_off) |
577 | { | 576 | { |
578 | usePicks = on_off; | 577 | usePicks = on_off; |
579 | if (usePicks) { | 578 | if (usePicks) { |
580 | picks->show(); | 579 | picks->show(); |
581 | //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send | 580 | //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send |
582 | //adjustSize(); | 581 | //adjustSize(); |
583 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 582 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
584 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 583 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
585 | } else { | 584 | } else { |
586 | 585 | ||
587 | picks->hide(); | 586 | picks->hide(); |
588 | picks->resetState(); | 587 | picks->resetState(); |
589 | //move(x(), y() + picks->height()); | 588 | //move(x(), y() + picks->height()); |
590 | //adjustSize(); | 589 | //adjustSize(); |
591 | QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 590 | QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
592 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 591 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
593 | 592 | ||
594 | } | 593 | } |
595 | /* | 594 | /* |
596 | * this closes && opens the input method | 595 | * this closes && opens the input method |
597 | */ | 596 | */ |
598 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); | 597 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); |
599 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); | 598 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); |
600 | } | 599 | } |
601 | 600 | ||
602 | void Keyboard::toggleRepeat(bool on) { | 601 | void Keyboard::toggleRepeat(bool on) { |
603 | 602 | ||
604 | useRepeat = on; | 603 | useRepeat = on; |
605 | cout << "setting useRepeat to: " << useRepeat << "\n"; | 604 | //cout << "setting useRepeat to: " << useRepeat << "\n"; |
606 | } | 605 | } |
607 | 606 | ||
608 | /* Keyboard::setMapTo ... {{{1 */ | 607 | /* Keyboard::setMapTo ... {{{1 */ |
609 | void Keyboard::setMapToDefault() { | 608 | void Keyboard::setMapToDefault() { |
610 | 609 | ||
611 | 610 | ||
612 | /* load current locale language map */ | 611 | /* load current locale language map */ |
613 | Config *config = new Config("locale"); | 612 | Config *config = new Config("locale"); |
614 | config->setGroup( "Language" ); | 613 | config->setGroup( "Language" ); |
615 | QString l = config->readEntry( "Language" , "en" ); | 614 | QString l = config->readEntry( "Language" , "en" ); |
616 | delete config; | 615 | delete config; |
617 | 616 | ||
618 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" | 617 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" |
619 | + l + ".keymap"; | 618 | + l + ".keymap"; |
620 | 619 | ||
621 | /* save change to multikey config file */ | 620 | /* save change to multikey config file */ |
622 | config = new Config("multikey"); | 621 | config = new Config("multikey"); |
623 | config->setGroup ("keymaps"); | 622 | config->setGroup ("keymaps"); |
624 | config->writeEntry ("current", key_map); // default closed | 623 | config->writeEntry ("current", key_map); // default closed |
625 | delete config; | 624 | delete config; |
626 | 625 | ||
627 | delete keys; | 626 | delete keys; |
628 | keys = new Keys(key_map); | 627 | keys = new Keys(key_map); |
629 | 628 | ||
630 | // have to repaint the keyboard | 629 | // have to repaint the keyboard |
631 | repaint(FALSE); | 630 | repaint(FALSE); |
632 | } | 631 | } |
633 | 632 | ||
634 | void Keyboard::setMapToFile(QString map) { | 633 | void Keyboard::setMapToFile(QString map) { |
635 | 634 | ||
636 | /* save change to multikey config file */ | 635 | /* save change to multikey config file */ |
637 | Config *config = new Config("multikey"); | 636 | Config *config = new Config("multikey"); |