-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 1 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 89b713e..a9137b9 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -1,68 +1,69 @@ | |||
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 | * | 6 | * |
6 | * | 7 | * |
7 | * | 8 | * |
8 | */ | 9 | */ |
9 | 10 | ||
10 | #include <iostream.h> | 11 | #include <iostream.h> |
11 | 12 | ||
12 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
13 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
14 | 15 | ||
15 | #include <qwidget.h> | 16 | #include <qwidget.h> |
16 | #include <qdialog.h> | 17 | #include <qdialog.h> |
17 | #include <qtabwidget.h> | 18 | #include <qtabwidget.h> |
18 | #include <qvbox.h> | 19 | #include <qvbox.h> |
19 | #include <qgrid.h> | 20 | #include <qgrid.h> |
20 | #include <qgroupbox.h> | 21 | #include <qgroupbox.h> |
21 | #include <qlabel.h> | 22 | #include <qlabel.h> |
22 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
23 | #include <qsizepolicy.h> | 24 | #include <qsizepolicy.h> |
24 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
25 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
26 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
27 | #include <opie/ofiledialog.h> | 28 | #include <opie/ofiledialog.h> |
28 | #include <opie/colordialog.h> | 29 | #include <opie/colordialog.h> |
29 | #include <qdir.h> | 30 | #include <qdir.h> |
30 | #include <qfileinfo.h> | 31 | #include <qfileinfo.h> |
31 | #include "configdlg.h" | 32 | #include "configdlg.h" |
32 | #include "keyboard.h" | 33 | #include "keyboard.h" |
33 | 34 | ||
34 | // ConfigDlg::ConfigDlg() {{{1 | 35 | // ConfigDlg::ConfigDlg() {{{1 |
35 | ConfigDlg::ConfigDlg () : QTabWidget () | 36 | ConfigDlg::ConfigDlg () : QTabWidget () |
36 | { | 37 | { |
37 | setCaption( tr("Multikey Configuration") ); | 38 | setCaption( tr("Multikey Configuration") ); |
38 | Config config ("multikey"); | 39 | Config config ("multikey"); |
39 | config.setGroup("keymaps"); | 40 | config.setGroup("keymaps"); |
40 | QString current_map = config.readEntry("current", 0); | 41 | QString current_map = config.readEntry("current", 0); |
41 | 42 | ||
42 | /* | 43 | /* |
43 | * 'general config' tab | 44 | * 'general config' tab |
44 | */ | 45 | */ |
45 | 46 | ||
46 | QVBox *gen_box = new QVBox (this); | 47 | QVBox *gen_box = new QVBox (this); |
47 | gen_box->setMargin(3); | 48 | gen_box->setMargin(3); |
48 | addTab(gen_box, tr("General Settings")); | 49 | addTab(gen_box, tr("General Settings")); |
49 | 50 | ||
50 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 51 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
51 | 52 | ||
52 | keymaps = new QListBox (map_group); | 53 | keymaps = new QListBox (map_group); |
53 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 54 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
54 | 55 | ||
55 | QString cur(tr("Current Language")); | 56 | QString cur(tr("Current Language")); |
56 | keymaps->insertItem(cur); | 57 | keymaps->insertItem(cur); |
57 | keymaps->setSelected(0, true); | 58 | keymaps->setSelected(0, true); |
58 | 59 | ||
59 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 60 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); |
60 | default_maps = map_dir.entryList(); // so i can access it in other places | 61 | default_maps = map_dir.entryList(); // so i can access it in other places |
61 | 62 | ||
62 | for (uint i = 0; i <map_dir.count(); i++) { | 63 | for (uint i = 0; i <map_dir.count(); i++) { |
63 | 64 | ||
64 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); | 65 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); |
65 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { | 66 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { |
66 | 67 | ||
67 | keymaps->setSelected(i + 1, true); | 68 | keymaps->setSelected(i + 1, true); |
68 | } | 69 | } |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 7334c1c..949164a 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -297,129 +297,135 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
297 | configdlg->showMaximized(); | 297 | configdlg->showMaximized(); |
298 | configdlg->show(); | 298 | configdlg->show(); |
299 | configdlg->raise(); | 299 | configdlg->raise(); |
300 | } | 300 | } |
301 | 301 | ||
302 | } else if (qkeycode == Qt::Key_Control) { | 302 | } else if (qkeycode == Qt::Key_Control) { |
303 | ctrl = keys->pressedPtr(row, col); | 303 | ctrl = keys->pressedPtr(row, col); |
304 | need_repaint = TRUE; | 304 | need_repaint = TRUE; |
305 | *ctrl = !keys->pressed(row, col); | 305 | *ctrl = !keys->pressed(row, col); |
306 | 306 | ||
307 | } else if (qkeycode == Qt::Key_Alt) { | 307 | } else if (qkeycode == Qt::Key_Alt) { |
308 | alt = keys->pressedPtr(row, col); | 308 | alt = keys->pressedPtr(row, col); |
309 | need_repaint = TRUE; | 309 | need_repaint = TRUE; |
310 | *alt = !keys->pressed(row, col); | 310 | *alt = !keys->pressed(row, col); |
311 | 311 | ||
312 | } else if (qkeycode == Qt::Key_Shift) { | 312 | } else if (qkeycode == Qt::Key_Shift) { |
313 | need_repaint = TRUE; | 313 | need_repaint = TRUE; |
314 | 314 | ||
315 | if (shift) { | 315 | if (shift) { |
316 | *shift = 0; | 316 | *shift = 0; |
317 | shift = 0; | 317 | shift = 0; |
318 | } | 318 | } |
319 | else { | 319 | else { |
320 | shift = keys->pressedPtr(row, col); | 320 | shift = keys->pressedPtr(row, col); |
321 | *shift = 1; | 321 | *shift = 1; |
322 | if (lock) { | 322 | if (lock) { |
323 | *lock = 0; | 323 | *lock = 0; |
324 | lock = 0; | 324 | lock = 0; |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | } else if (qkeycode == Qt::Key_CapsLock) { | 328 | } else if (qkeycode == Qt::Key_CapsLock) { |
329 | need_repaint = TRUE; | 329 | need_repaint = TRUE; |
330 | 330 | ||
331 | if (lock) { | 331 | if (lock) { |
332 | *lock = 0; | 332 | *lock = 0; |
333 | lock = 0; | 333 | lock = 0; |
334 | } | 334 | } |
335 | else { | 335 | else { |
336 | lock = keys->pressedPtr(row, col);; | 336 | lock = keys->pressedPtr(row, col);; |
337 | *lock = 1; | 337 | *lock = 1; |
338 | if (shift) { | 338 | if (shift) { |
339 | *shift = 0; | 339 | *shift = 0; |
340 | shift = 0; | 340 | shift = 0; |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | } | 344 | } |
345 | 345 | ||
346 | } | 346 | } |
347 | else { // normal char | 347 | else { // normal char |
348 | if ((shift || lock) && keys->shift(unicode)) { | 348 | if ((shift || lock) && keys->shift(unicode)) { |
349 | unicode = keys->shift(unicode); | 349 | unicode = keys->shift(unicode); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | 352 | ||
353 | // korean parsing | 353 | // korean parsing |
354 | if (keys->lang == "ko") { | 354 | if (keys->lang == "ko") { |
355 | 355 | ||
356 | unicode = parseKoreanInput(unicode); | 356 | unicode = parseKoreanInput(unicode); |
357 | } | 357 | } |
358 | 358 | ||
359 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); | 359 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); |
360 | 360 | ||
361 | emit key(unicode, qkeycode, modifiers, true, false); | 361 | if ('A' <= unicode && unicode <= 'z' && modifiers) { |
362 | |||
363 | qkeycode = QChar(unicode).upper(); | ||
364 | unicode = qkeycode - '@'; | ||
365 | } | ||
366 | |||
367 | QWSServer::sendKeyEvent(unicode, qkeycode, modifiers, true, false); | ||
362 | 368 | ||
363 | // pickboard stuff | 369 | // pickboard stuff |
364 | if (usePicks) { | 370 | if (usePicks) { |
365 | 371 | ||
366 | KeyboardConfig *dc = picks->dc; | 372 | KeyboardConfig *dc = picks->dc; |
367 | 373 | ||
368 | if (dc) { | 374 | if (dc) { |
369 | if (qkeycode == Qt::Key_Backspace) { | 375 | if (qkeycode == Qt::Key_Backspace) { |
370 | dc->input.remove(dc->input.last()); // remove last input | 376 | dc->input.remove(dc->input.last()); // remove last input |
371 | dc->decBackspaces(); | 377 | dc->decBackspaces(); |
372 | } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) { | 378 | } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) { |
373 | dc->input.clear(); | 379 | dc->input.clear(); |
374 | dc->resetBackspaces(); | 380 | dc->resetBackspaces(); |
375 | } else { | 381 | } else { |
376 | dc->add(QString(QChar(unicode))); | 382 | dc->add(QString(QChar(unicode))); |
377 | dc->incBackspaces(); | 383 | dc->incBackspaces(); |
378 | } | 384 | } |
379 | } | 385 | } |
380 | picks->repaint(); | 386 | picks->repaint(); |
381 | } | 387 | } |
382 | 388 | ||
383 | 389 | ||
384 | // painting | 390 | // painting |
385 | pressed = TRUE; | 391 | pressed = TRUE; |
386 | 392 | ||
387 | pressedKeyRow = row; | 393 | pressedKeyRow = row; |
388 | pressedKeyCol = col; | 394 | pressedKeyCol = col; |
389 | 395 | ||
390 | if (need_repaint) repaint(FALSE); | 396 | if (need_repaint) repaint(FALSE); |
391 | else { // just paint the one key pressed | 397 | else { // just paint the one key pressed |
392 | 398 | ||
393 | 399 | ||
394 | 400 | ||
395 | QPainter p(this); | 401 | QPainter p(this); |
396 | drawKeyboard(p, row, col); | 402 | drawKeyboard(p, row, col); |
397 | 403 | ||
398 | } | 404 | } |
399 | 405 | ||
400 | if (useRepeat) repeatTimer->start( 800 ); | 406 | if (useRepeat) repeatTimer->start( 800 ); |
401 | //pressTid = startTimer(80); | 407 | //pressTid = startTimer(80); |
402 | 408 | ||
403 | } | 409 | } |
404 | 410 | ||
405 | 411 | ||
406 | /* Keyboard::mouseReleaseEvent {{{1 */ | 412 | /* Keyboard::mouseReleaseEvent {{{1 */ |
407 | void Keyboard::mouseReleaseEvent(QMouseEvent*) | 413 | void Keyboard::mouseReleaseEvent(QMouseEvent*) |
408 | { | 414 | { |
409 | pressed = FALSE; | 415 | pressed = FALSE; |
410 | //if ( pressTid == 0 ) | 416 | //if ( pressTid == 0 ) |
411 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 417 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
412 | if ( unicode != -1 ) { | 418 | if ( unicode != -1 ) { |
413 | emit key( unicode, qkeycode, modifiers, false, false ); | 419 | emit key( unicode, qkeycode, modifiers, false, false ); |
414 | repeatTimer->stop(); | 420 | repeatTimer->stop(); |
415 | } | 421 | } |
416 | #endif | 422 | #endif |
417 | if (shift && unicode != 0) { | 423 | if (shift && unicode != 0) { |
418 | 424 | ||
419 | 425 | ||
420 | *shift = 0; // unpress shift key | 426 | *shift = 0; // unpress shift key |
421 | shift = 0; // reset the shift pointer | 427 | shift = 0; // reset the shift pointer |
422 | repaint(FALSE); | 428 | repaint(FALSE); |
423 | 429 | ||
424 | } | 430 | } |
425 | else | 431 | else |