summaryrefslogtreecommitdiff
path: root/inputmethods
Unidiff
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp3
-rw-r--r--inputmethods/multikey/keyboard.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 68c31be..6ec8d0e 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,120 +1,123 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing 3 * make a font selection thing
4 * 4 *
5 * FIXME 5 * FIXME
6 * if you open the config dialog and close it from the little (x) button on the title bar, 6 * if you open the config dialog and close it from the little (x) button on the title bar,
7 * you have to hit the button on the keyboard twice for it to open the next time 7 * you have to hit the button on the keyboard twice for it to open the next time
8 * 8 *
9 * 9 *
10 */ 10 */
11 11
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14 14
15#include <qwidget.h> 15#include <qwidget.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qtabwidget.h> 17#include <qtabwidget.h>
18#include <qvbox.h> 18#include <qvbox.h>
19#include <qgrid.h> 19#include <qgrid.h>
20#include <qgroupbox.h> 20#include <qgroupbox.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qsizepolicy.h> 23#include <qsizepolicy.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include "configdlg.h" 26#include "configdlg.h"
27#include "keyboard.h" 27#include "keyboard.h"
28 28
29ConfigDlg::ConfigDlg () : QTabWidget () 29ConfigDlg::ConfigDlg () : QTabWidget ()
30{ 30{
31 setCaption( tr("Multikey Configuration") ); 31 setCaption( tr("Multikey Configuration") );
32 32
33 /* 33 /*
34 * 'general config' tab 34 * 'general config' tab
35 */ 35 */
36 36
37 QVBox *gen_box = new QVBox (this); 37 QVBox *gen_box = new QVBox (this);
38 gen_box->setMargin(3); 38 gen_box->setMargin(3);
39 addTab(gen_box, tr("General Settings")); 39 addTab(gen_box, tr("General Settings"));
40 40
41 QGroupBox *map_group = new QGroupBox (2, Qt::Horizontal, tr("Keymap File"), gen_box); 41 QGroupBox *map_group = new QGroupBox (2, Qt::Horizontal, tr("Keymap File"), gen_box);
42 42
43 map_combo = new QComboBox ((bool)0, map_group); 43 map_combo = new QComboBox ((bool)0, map_group);
44 map_combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 44 map_combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
45 45
46 QString cur(tr("Current Language")); 46 QString cur(tr("Current Language"));
47 map_combo->insertItem(cur); 47 map_combo->insertItem(cur);
48 connect(map_combo, SIGNAL(activated(int)), SLOT(setMap(int))); 48 connect(map_combo, SIGNAL(activated(int)), SLOT(setMap(int)));
49 49
50 QString ko(tr("/opt/opie/share/multikey/ko.keymap")); 50 QString ko(tr("/opt/opie/share/multikey/ko.keymap"));
51 map_combo->insertItem(ko); 51 map_combo->insertItem(ko);
52 52
53 QString en(tr("/opt/opie/share/multikey/en.keymap")); 53 QString en(tr("/opt/opie/share/multikey/en.keymap"));
54 map_combo->insertItem(en); 54 map_combo->insertItem(en);
55 55
56 QString de(tr("/opt/opie/share/multikey/de.keymap"));
57 map_combo->insertItem(de);
58
56 QPushButton *button = new QPushButton(tr("Browse..."), map_group); 59 QPushButton *button = new QPushButton(tr("Browse..."), map_group);
57 button->setFlat((bool)1); 60 button->setFlat((bool)1);
58 61
59 pick_button = new QCheckBox(tr("Pickboard"), gen_box); 62 pick_button = new QCheckBox(tr("Pickboard"), gen_box);
60 63
61 Config config ("multikey"); 64 Config config ("multikey");
62 config.setGroup ("pickboard"); 65 config.setGroup ("pickboard");
63 bool pick_open = config.readBoolEntry ("open", "0"); // default closed 66 bool pick_open = config.readBoolEntry ("open", "0"); // default closed
64 if (pick_open) { 67 if (pick_open) {
65 68
66 pick_button->setChecked(true); 69 pick_button->setChecked(true);
67 } 70 }
68 71
69 // by connecting it after checking it, the signal isn't emmited 72 // by connecting it after checking it, the signal isn't emmited
70 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); 73 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
71 74
72 /* 75 /*
73 * 'color' tab 76 * 'color' tab
74 */ 77 */
75 78
76 QGrid *color_box = new QGrid(2, this); 79 QGrid *color_box = new QGrid(2, this);
77 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 80 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
78 color_box->setMargin(3); 81 color_box->setMargin(3);
79 addTab(color_box, tr("Colors")); 82 addTab(color_box, tr("Colors"));
80 83
81 QLabel *label; 84 QLabel *label;
82 85
83 label = new QLabel(tr("Key Color"), color_box); 86 label = new QLabel(tr("Key Color"), color_box);
84 button = new QPushButton(color_box); 87 button = new QPushButton(color_box);
85 button->setFlat((bool)1); 88 button->setFlat((bool)1);
86 label = new QLabel(tr("Key Pressed Color"), color_box); 89 label = new QLabel(tr("Key Pressed Color"), color_box);
87 button = new QPushButton(color_box); 90 button = new QPushButton(color_box);
88 button->setFlat((bool)1); 91 button->setFlat((bool)1);
89 label = new QLabel(tr("Line Color"), color_box); 92 label = new QLabel(tr("Line Color"), color_box);
90 button = new QPushButton(color_box); 93 button = new QPushButton(color_box);
91 button->setFlat((bool)1); 94 button->setFlat((bool)1);
92 label = new QLabel(tr("Text Color"), color_box); 95 label = new QLabel(tr("Text Color"), color_box);
93 button = new QPushButton(color_box); 96 button = new QPushButton(color_box);
94 button->setFlat((bool)1); 97 button->setFlat((bool)1);
95 98
96 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 99 label = new QLabel("", color_box); // a spacer so the above buttons dont expand
97 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 100 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
98 101
99} 102}
100 103
101void ConfigDlg::pickTog() { 104void ConfigDlg::pickTog() {
102 105
103 Config config ("multikey"); 106 Config config ("multikey");
104 config.setGroup ("pickboard"); 107 config.setGroup ("pickboard");
105 config.writeEntry ("open", pick_button->isChecked()); // default closed 108 config.writeEntry ("open", pick_button->isChecked()); // default closed
106 109
107 emit pickboardToggled(pick_button->isChecked()); 110 emit pickboardToggled(pick_button->isChecked());
108} 111}
109 112
110void ConfigDlg::setMap(int index) { 113void ConfigDlg::setMap(int index) {
111 114
112 if (index == 0) { 115 if (index == 0) {
113 116
114 emit setMapToDefault(); 117 emit setMapToDefault();
115 } 118 }
116 else { 119 else {
117 120
118 emit setMapToFile(map_combo->text(index)); 121 emit setMapToFile(map_combo->text(index));
119 } 122 }
120} 123}
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 1d91b82..b793391 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -266,385 +266,385 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
266 // might need to repaint if two or more of the same keys. 266 // might need to repaint if two or more of the same keys.
267 // should be faster if just paint one key even though multiple keys exist. 267 // should be faster if just paint one key even though multiple keys exist.
268 bool need_repaint = FALSE; 268 bool need_repaint = FALSE;
269 269
270 if (unicode == 0) { // either Qt char, or nothing 270 if (unicode == 0) { // either Qt char, or nothing
271 271
272 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 272 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
273 273
274 if ( configdlg ) { 274 if ( configdlg ) {
275 delete (ConfigDlg *) configdlg; 275 delete (ConfigDlg *) configdlg;
276 configdlg = 0; 276 configdlg = 0;
277 } 277 }
278 else { 278 else {
279 configdlg = new ConfigDlg (); 279 configdlg = new ConfigDlg ();
280 connect(configdlg, SIGNAL(pickboardToggled(bool)), 280 connect(configdlg, SIGNAL(pickboardToggled(bool)),
281 this, SLOT(togglePickboard(bool))); 281 this, SLOT(togglePickboard(bool)));
282 connect(configdlg, SIGNAL(setMapToDefault()), 282 connect(configdlg, SIGNAL(setMapToDefault()),
283 this, SLOT(setMapToDefault())); 283 this, SLOT(setMapToDefault()));
284 connect(configdlg, SIGNAL(setMapToFile(QString)), 284 connect(configdlg, SIGNAL(setMapToFile(QString)),
285 this, SLOT(setMapToFile(QString))); 285 this, SLOT(setMapToFile(QString)));
286 configdlg->showMaximized(); 286 configdlg->showMaximized();
287 configdlg->show(); 287 configdlg->show();
288 configdlg->raise(); 288 configdlg->raise();
289 } 289 }
290 290
291 } else if (qkeycode == Qt::Key_Control) { 291 } else if (qkeycode == Qt::Key_Control) {
292 ctrl = keys->pressedPtr(row, col); 292 ctrl = keys->pressedPtr(row, col);
293 need_repaint = TRUE; 293 need_repaint = TRUE;
294 *ctrl = !keys->pressed(row, col); 294 *ctrl = !keys->pressed(row, col);
295 295
296 } else if (qkeycode == Qt::Key_Alt) { 296 } else if (qkeycode == Qt::Key_Alt) {
297 alt = keys->pressedPtr(row, col); 297 alt = keys->pressedPtr(row, col);
298 need_repaint = TRUE; 298 need_repaint = TRUE;
299 *alt = !keys->pressed(row, col); 299 *alt = !keys->pressed(row, col);
300 300
301 } else if (qkeycode == Qt::Key_Shift) { 301 } else if (qkeycode == Qt::Key_Shift) {
302 need_repaint = TRUE; 302 need_repaint = TRUE;
303 303
304 if (shift) { 304 if (shift) {
305 *shift = 0; 305 *shift = 0;
306 shift = 0; 306 shift = 0;
307 } 307 }
308 else { 308 else {
309 shift = keys->pressedPtr(row, col); 309 shift = keys->pressedPtr(row, col);
310 *shift = 1; 310 *shift = 1;
311 if (lock) { 311 if (lock) {
312 *lock = 0; 312 *lock = 0;
313 lock = 0; 313 lock = 0;
314 } 314 }
315 } 315 }
316 316
317 } else if (qkeycode == Qt::Key_CapsLock) { 317 } else if (qkeycode == Qt::Key_CapsLock) {
318 need_repaint = TRUE; 318 need_repaint = TRUE;
319 319
320 if (lock) { 320 if (lock) {
321 *lock = 0; 321 *lock = 0;
322 lock = 0; 322 lock = 0;
323 } 323 }
324 else { 324 else {
325 lock = keys->pressedPtr(row, col);; 325 lock = keys->pressedPtr(row, col);;
326 *lock = 1; 326 *lock = 1;
327 if (shift) { 327 if (shift) {
328 *shift = 0; 328 *shift = 0;
329 shift = 0; 329 shift = 0;
330 } 330 }
331 } 331 }
332 332
333 } 333 }
334 334
335 } 335 }
336 else { // normal char 336 else { // normal char
337 if ((shift || lock) && keys->shift(unicode)) { 337 if ((shift || lock) && keys->shift(unicode)) {
338 unicode = keys->shift(unicode); 338 unicode = keys->shift(unicode);
339 } 339 }
340 } 340 }
341 341
342 // korean parsing 342 // korean parsing
343 if (keys->lang == "ko") { 343 if (keys->lang == "ko") {
344 344
345 unicode = parseKoreanInput(unicode); 345 unicode = parseKoreanInput(unicode);
346 } 346 }
347 347
348 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); 348 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0);
349 349
350 emit key(unicode, qkeycode, modifiers, true, false); 350 emit key(unicode, qkeycode, modifiers, true, false);
351 351
352 // pickboard stuff 352 // pickboard stuff
353 if (usePicks) { 353 if (usePicks) {
354 354
355 KeyboardConfig *dc = picks->dc; 355 KeyboardConfig *dc = picks->dc;
356 356
357 if (dc) { 357 if (dc) {
358 if (qkeycode == Qt::Key_Backspace) { 358 if (qkeycode == Qt::Key_Backspace) {
359 dc->input.remove(dc->input.last()); // remove last input 359 dc->input.remove(dc->input.last()); // remove last input
360 dc->decBackspaces(); 360 dc->decBackspaces();
361 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) { 361 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) {
362 dc->input.clear(); 362 dc->input.clear();
363 dc->resetBackspaces(); 363 dc->resetBackspaces();
364 } else { 364 } else {
365 dc->add(QString(QChar(unicode))); 365 dc->add(QString(QChar(unicode)));
366 dc->incBackspaces(); 366 dc->incBackspaces();
367 } 367 }
368 } 368 }
369 picks->repaint(); 369 picks->repaint();
370 } 370 }
371 371
372 372
373 // painting 373 // painting
374 pressed = TRUE; 374 pressed = TRUE;
375 375
376 pressedKeyRow = row; 376 pressedKeyRow = row;
377 pressedKeyCol = col; 377 pressedKeyCol = col;
378 378
379 if (need_repaint) repaint(FALSE); 379 if (need_repaint) repaint(FALSE);
380 else { // just paint the one key pressed 380 else { // just paint the one key pressed
381 381
382 382
383 383
384 QPainter p(this); 384 QPainter p(this);
385 drawKeyboard(p, row, col); 385 drawKeyboard(p, row, col);
386 386
387 } 387 }
388 388
389 pressTid = startTimer(80); 389 pressTid = startTimer(80);
390 390
391} 391}
392 392
393 393
394/* Keyboard::mouseReleaseEvent {{{1 */ 394/* Keyboard::mouseReleaseEvent {{{1 */
395void Keyboard::mouseReleaseEvent(QMouseEvent*) 395void Keyboard::mouseReleaseEvent(QMouseEvent*)
396{ 396{
397 pressed = FALSE; 397 pressed = FALSE;
398 if ( pressTid == 0 ) 398 if ( pressTid == 0 )
399#if defined(Q_WS_QWS) || defined(_WS_QWS_) 399#if defined(Q_WS_QWS) || defined(_WS_QWS_)
400 if ( unicode != -1 ) { 400 if ( unicode != -1 ) {
401 emit key( unicode, qkeycode, modifiers, false, false ); 401 emit key( unicode, qkeycode, modifiers, false, false );
402 repeatTimer->stop(); 402 repeatTimer->stop();
403 } 403 }
404#endif 404#endif
405 if (shift && unicode != 0) { 405 if (shift && unicode != 0) {
406 406
407 407
408 *shift = 0; // unpress shift key 408 *shift = 0; // unpress shift key
409 shift = 0; // reset the shift pointer 409 shift = 0; // reset the shift pointer
410 repaint(FALSE); 410 repaint(FALSE);
411 411
412 } 412 }
413 else 413 else
414 414
415 clearHighlight(); 415 clearHighlight();
416} 416}
417 417
418/* Keyboard::timerEvent {{{1 */ 418/* Keyboard::timerEvent {{{1 */
419/* 419/*
420void Keyboard::timerEvent(QTimerEvent* e) 420void Keyboard::timerEvent(QTimerEvent* e)
421{ 421{
422 if ( e->timerId() == pressTid ) { 422 if ( e->timerId() == pressTid ) {
423 killTimer(pressTid); 423 killTimer(pressTid);
424 pressTid = 0; 424 pressTid = 0;
425 if ( !pressed ) 425 if ( !pressed )
426 cout << "calling clearHighlight from timerEvent\n"; 426 cout << "calling clearHighlight from timerEvent\n";
427 clearHighlight(); 427 clearHighlight();
428 } 428 }
429} 429}
430*/ 430*/
431 431
432void Keyboard::repeat() 432void Keyboard::repeat()
433{ 433{
434 434
435 repeatTimer->start( 200 ); 435 repeatTimer->start( 200 );
436 emit key( unicode, 0, modifiers, true, true ); 436 emit key( unicode, 0, modifiers, true, true );
437} 437}
438 438
439void Keyboard::clearHighlight() 439void Keyboard::clearHighlight()
440{ 440{
441 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) { 441 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
442 int tmpRow = pressedKeyRow; 442 int tmpRow = pressedKeyRow;
443 int tmpCol = pressedKeyCol; 443 int tmpCol = pressedKeyCol;
444 444
445 pressedKeyRow = -1; 445 pressedKeyRow = -1;
446 pressedKeyCol = -1; 446 pressedKeyCol = -1;
447 447
448 QPainter p(this); 448 QPainter p(this);
449 drawKeyboard(p, tmpRow, tmpCol); 449 drawKeyboard(p, tmpRow, tmpCol);
450 } 450 }
451} 451}
452 452
453 453
454/* Keyboard::sizeHint {{{1 */ 454/* Keyboard::sizeHint {{{1 */
455QSize Keyboard::sizeHint() const 455QSize Keyboard::sizeHint() const
456{ 456{
457 QFontMetrics fm=fontMetrics(); 457 QFontMetrics fm=fontMetrics();
458 int keyHeight = fm.lineSpacing(); 458 int keyHeight = fm.lineSpacing() + 2;
459 459
460 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); 460 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1);
461} 461}
462 462
463 463
464void Keyboard::resetState() 464void Keyboard::resetState()
465{ 465{
466 schar = mchar = echar = 0; 466 schar = mchar = echar = 0;
467 picks->resetState(); 467 picks->resetState();
468} 468}
469 469
470/* Keyboard::togglePickboard {{{1 */ 470/* Keyboard::togglePickboard {{{1 */
471void Keyboard::togglePickboard(bool on_off) 471void Keyboard::togglePickboard(bool on_off)
472{ 472{
473 usePicks = on_off; 473 usePicks = on_off;
474 if (usePicks) { 474 if (usePicks) {
475 picks->show(); 475 picks->show();
476 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send 476 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
477 //adjustSize(); 477 //adjustSize();
478 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 478 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
479 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 479 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
480 } else { 480 } else {
481 481
482 picks->hide(); 482 picks->hide();
483 picks->resetState(); 483 picks->resetState();
484 //move(x(), y() + picks->height()); 484 //move(x(), y() + picks->height());
485 //adjustSize(); 485 //adjustSize();
486 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 486 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
487 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 487 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
488 488
489 } 489 }
490 /* 490 /*
491 * this closes && opens the input method 491 * this closes && opens the input method
492 */ 492 */
493 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); 493 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
494 QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); 494 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
495} 495}
496 496
497/* Keyboard::setMapTo ... {{{1 */ 497/* Keyboard::setMapTo ... {{{1 */
498void Keyboard::setMapToDefault() { 498void Keyboard::setMapToDefault() {
499 499
500 500
501 /* load current locale language map */ 501 /* load current locale language map */
502 Config *config = new Config("locale"); 502 Config *config = new Config("locale");
503 config->setGroup( "Language" ); 503 config->setGroup( "Language" );
504 QString l = config->readEntry( "Language" , "en" ); 504 QString l = config->readEntry( "Language" , "en" );
505 delete config; 505 delete config;
506 506
507 QString key_map = QPEApplication::qpeDir() + "/share/multikey/" 507 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
508 + l + ".keymap"; 508 + l + ".keymap";
509 509
510 /* save change to multikey config file */ 510 /* save change to multikey config file */
511 config = new Config("multikey"); 511 config = new Config("multikey");
512 config->setGroup ("keymaps"); 512 config->setGroup ("keymaps");
513 config->writeEntry ("current", key_map); // default closed 513 config->writeEntry ("current", key_map); // default closed
514 delete config; 514 delete config;
515 515
516 delete keys; 516 delete keys;
517 keys = new Keys(key_map); 517 keys = new Keys(key_map);
518 518
519 // have to repaint the keyboard 519 // have to repaint the keyboard
520 repaint(FALSE); 520 repaint(FALSE);
521} 521}
522 522
523void Keyboard::setMapToFile(QString file) { 523void Keyboard::setMapToFile(QString file) {
524 524
525 /* save change to multikey config file */ 525 /* save change to multikey config file */
526 Config *config = new Config("multikey"); 526 Config *config = new Config("multikey");
527 config->setGroup ("keymaps"); 527 config->setGroup ("keymaps");
528 config->writeEntry ("current", file); // default closed 528 config->writeEntry ("current", file); // default closed
529 delete config; 529 delete config;
530 530
531 delete keys; 531 delete keys;
532 keys = new Keys(file); 532 keys = new Keys(file);
533 repaint(FALSE); 533 repaint(FALSE);
534 534
535} 535}
536 536
537/* korean input functions {{{1 537/* korean input functions {{{1
538 * 538 *
539 * TODO 539 * TODO
540 * one major problem with this implementation is that you can't move the 540 * one major problem with this implementation is that you can't move the
541 * cursor after inputing korean chars, otherwise it will eat up and replace 541 * cursor after inputing korean chars, otherwise it will eat up and replace
542 * the char before the cursor you move to. fix that 542 * the char before the cursor you move to. fix that
543 * 543 *
544 * make backspace delete one single char, not the whole thing if still 544 * make backspace delete one single char, not the whole thing if still
545 * editing. 545 * editing.
546 * 546 *
547 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 547 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
548 * 548 *
549 * how korean input works 549 * how korean input works
550 * 550 *
551 * all following chars means unicode char value and are in hex 551 * all following chars means unicode char value and are in hex
552 * 552 *
553 * ÃÊÀ½ = schar (start char) 553 * ÃÊÀ½ = schar (start char)
554 * ÁßÀ½ = mchar (middle char) 554 * ÁßÀ½ = mchar (middle char)
555 * ³¡À½ = echar (end char) 555 * ³¡À½ = echar (end char)
556 * 556 *
557 * there are 19 schars. unicode position is at 1100 - 1112 557 * there are 19 schars. unicode position is at 1100 - 1112
558 * there are 21 mchars. unicode position is at 1161 - 1175 558 * there are 21 mchars. unicode position is at 1161 - 1175
559 * there are 27 echars. unicode position is at 11a8 - 11c2 559 * there are 27 echars. unicode position is at 11a8 - 11c2
560 * 560 *
561 * the map with everything combined is at ac00 - d7a3 561 * the map with everything combined is at ac00 - d7a3
562 * 562 *
563 */ 563 */
564 564
565ushort Keyboard::parseKoreanInput (ushort c) { 565ushort Keyboard::parseKoreanInput (ushort c) {
566 566
567 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) 567 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c))
568 || 568 ||
569 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode 569 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode
570 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { 570 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) {
571 571
572 schar = 0, mchar = 0, echar = 0; 572 schar = 0, mchar = 0, echar = 0;
573 return c; 573 return c;
574 } 574 }
575 575
576 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input 576 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
577 577
578 if (schar == 0 || (schar != 0 && mchar == 0)) { 578 if (schar == 0 || (schar != 0 && mchar == 0)) {
579 schar = c; mchar = 0; echar = 0; 579 schar = c; mchar = 0; echar = 0;
580 return c; 580 return c;
581 } 581 }
582 else if (mchar != 0) { 582 else if (mchar != 0) {
583 583
584 if (echar == 0) { 584 if (echar == 0) {
585 585
586 if (!(echar = constoe(c))) { 586 if (!(echar = constoe(c))) {
587 587
588 schar = c; mchar = 0; echar = 0; 588 schar = c; mchar = 0; echar = 0;
589 return c; 589 return c;
590 } 590 }
591 591
592 } 592 }
593 else { // must figure out what the echar is 593 else { // must figure out what the echar is
594 594
595 if (echar == 0x11a8) { // ¤¡ 595 if (echar == 0x11a8) { // ¤¡
596 596
597 if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡ 597 if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡
598 else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ 598 else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ
599 else { 599 else {
600 schar = c; mchar = 0; echar = 0; 600 schar = c; mchar = 0; echar = 0;
601 return c; 601 return c;
602 } 602 }
603 603
604 } else if (echar == 0x11ab) { // ¤¤ 604 } else if (echar == 0x11ab) { // ¤¤
605 605
606 if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸ 606 if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸
607 else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾ 607 else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾
608 else { 608 else {
609 schar = c; mchar = 0; echar = 0; 609 schar = c; mchar = 0; echar = 0;
610 return c; 610 return c;
611 } 611 }
612 612
613 } else if (echar == 0x11af) { // ¤© 613 } else if (echar == 0x11af) { // ¤©
614 614
615 if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡ 615 if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡
616 else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤± 616 else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤±
617 else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤² 617 else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤²
618 else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ 618 else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ
619 else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼ 619 else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼
620 else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½ 620 else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½
621 else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾ 621 else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾
622 else { 622 else {
623 schar = c; mchar = 0; echar = 0; 623 schar = c; mchar = 0; echar = 0;
624 return c; 624 return c;
625 } 625 }
626 626
627 } else if (echar == 0x11b8) { // ¤² 627 } else if (echar == 0x11b8) { // ¤²
628 628
629 if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ 629 if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ
630 else { 630 else {
631 schar = c; mchar = 0; echar = 0; 631 schar = c; mchar = 0; echar = 0;
632 return c; 632 return c;
633 } 633 }
634 634
635 } else if (echar == 0x11ba) { // ¤µ 635 } else if (echar == 0x11ba) { // ¤µ
636 636
637 if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ 637 if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ
638 else { 638 else {
639 schar = c; mchar = 0; echar = 0; 639 schar = c; mchar = 0; echar = 0;
640 return c; 640 return c;
641 } 641 }
642 642
643 } else { // if any other char, cannot combine chars 643 } else { // if any other char, cannot combine chars
644 644
645 schar = c; mchar = 0; echar = 0; 645 schar = c; mchar = 0; echar = 0;
646 return c; 646 return c;
647 } 647 }
648 648
649 unicode = echar; 649 unicode = echar;
650 } 650 }