-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 1 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 1e104a6..59a290b 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -192,68 +192,69 @@ void ConfigDlg::setMap(int index) { | |||
192 | } | 192 | } |
193 | else if ((uint)index <= default_maps.count()) { | 193 | else if ((uint)index <= default_maps.count()) { |
194 | 194 | ||
195 | remove_button->setDisabled(true); | 195 | remove_button->setDisabled(true); |
196 | emit setMapToFile(keymaps->text(index)); | 196 | emit setMapToFile(keymaps->text(index)); |
197 | 197 | ||
198 | } else { | 198 | } else { |
199 | 199 | ||
200 | remove_button->setEnabled(true); | 200 | remove_button->setEnabled(true); |
201 | emit setMapToFile(keymaps->text(index)); | 201 | emit setMapToFile(keymaps->text(index)); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | // ConfigDlg::addMap() {{{1 | 205 | // ConfigDlg::addMap() {{{1 |
206 | void ConfigDlg::addMap() { | 206 | void ConfigDlg::addMap() { |
207 | 207 | ||
208 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 208 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
209 | Config config ("multikey"); | 209 | Config config ("multikey"); |
210 | config.setGroup("keymaps"); | 210 | config.setGroup("keymaps"); |
211 | QStringList maps = config.readListEntry("maps", QChar('|')); | 211 | QStringList maps = config.readListEntry("maps", QChar('|')); |
212 | maps.append(map); | 212 | maps.append(map); |
213 | keymaps->insertItem(map); | 213 | keymaps->insertItem(map); |
214 | keymaps->setSelected(keymaps->count() - 1, true); | 214 | keymaps->setSelected(keymaps->count() - 1, true); |
215 | 215 | ||
216 | 216 | ||
217 | config.writeEntry("maps", maps, QChar('|')); | 217 | config.writeEntry("maps", maps, QChar('|')); |
218 | config.writeEntry("current", map); | 218 | config.writeEntry("current", map); |
219 | 219 | ||
220 | } | 220 | } |
221 | 221 | ||
222 | // ConfigDlg::removeMap() {{{1 | 222 | // ConfigDlg::removeMap() {{{1 |
223 | void ConfigDlg::removeMap() { | 223 | void ConfigDlg::removeMap() { |
224 | 224 | ||
225 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; | 225 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; |
226 | cout << "currentItem : " << keymaps->currentItem() << "\n"; | 226 | cout << "currentItem : " << keymaps->currentItem() << "\n"; |
227 | 227 | ||
228 | // move selection up one | 228 | // move selection up one |
229 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 229 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
230 | // delete the next selected item cus you just moved it up | 230 | // delete the next selected item cus you just moved it up |
231 | keymaps->removeItem(keymaps->currentItem() + 1); | 231 | keymaps->removeItem(keymaps->currentItem() + 1); |
232 | 232 | ||
233 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); | 233 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); |
234 | 234 | ||
235 | // write the changes | 235 | // write the changes |
236 | Config config ("multikey"); | 236 | Config config ("multikey"); |
237 | config.setGroup("keymaps"); | 237 | config.setGroup("keymaps"); |
238 | config.writeEntry("maps", custom_maps, QChar('|')); | 238 | config.writeEntry("maps", custom_maps, QChar('|')); |
239 | } | 239 | } |
240 | 240 | ||
241 | // ConfigDlg::color {{{1 | 241 | // ConfigDlg::color {{{1 |
242 | void ConfigDlg::keyColorButtonClicked() { | 242 | void ConfigDlg::keyColorButtonClicked() { |
243 | 243 | ||
244 | Config config ("multikey"); | 244 | Config config ("multikey"); |
245 | config.setGroup ("colors"); | 245 | config.setGroup ("colors"); |
246 | 246 | ||
247 | QStringList color = config.readListEntry("keycolor", QChar(',')); | 247 | QStringList color = config.readListEntry("keycolor", QChar(',')); |
248 | 248 | ||
249 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 249 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
250 | 250 | ||
251 | color[0].setNum(newcolor.red()); | 251 | color[0].setNum(newcolor.red()); |
252 | color[1].setNum(newcolor.green()); | 252 | color[1].setNum(newcolor.green()); |
253 | color[2].setNum(newcolor.blue()); | 253 | color[2].setNum(newcolor.blue()); |
254 | 254 | ||
255 | config.writeEntry("keycolor", color, QChar(',')); | 255 | config.writeEntry("keycolor", color, QChar(',')); |
256 | config.write(); | ||
256 | 257 | ||
257 | key_color_button->setBackgroundColor(newcolor); | 258 | key_color_button->setBackgroundColor(newcolor); |
258 | emit reloadKeyboard(); | 259 | emit reloadKeyboard(); |
259 | } | 260 | } |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 68918a6..8280297 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -487,129 +487,129 @@ void Keyboard::togglePickboard(bool on_off) | |||
487 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 487 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
488 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 488 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
489 | } else { | 489 | } else { |
490 | 490 | ||
491 | picks->hide(); | 491 | picks->hide(); |
492 | picks->resetState(); | 492 | picks->resetState(); |
493 | //move(x(), y() + picks->height()); | 493 | //move(x(), y() + picks->height()); |
494 | //adjustSize(); | 494 | //adjustSize(); |
495 | QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 495 | QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
496 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 496 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
497 | 497 | ||
498 | } | 498 | } |
499 | /* | 499 | /* |
500 | * this closes && opens the input method | 500 | * this closes && opens the input method |
501 | */ | 501 | */ |
502 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); | 502 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); |
503 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); | 503 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); |
504 | } | 504 | } |
505 | 505 | ||
506 | /* Keyboard::setMapTo ... {{{1 */ | 506 | /* Keyboard::setMapTo ... {{{1 */ |
507 | void Keyboard::setMapToDefault() { | 507 | void Keyboard::setMapToDefault() { |
508 | 508 | ||
509 | 509 | ||
510 | /* load current locale language map */ | 510 | /* load current locale language map */ |
511 | Config *config = new Config("locale"); | 511 | Config *config = new Config("locale"); |
512 | config->setGroup( "Language" ); | 512 | config->setGroup( "Language" ); |
513 | QString l = config->readEntry( "Language" , "en" ); | 513 | QString l = config->readEntry( "Language" , "en" ); |
514 | delete config; | 514 | delete config; |
515 | 515 | ||
516 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" | 516 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" |
517 | + l + ".keymap"; | 517 | + l + ".keymap"; |
518 | 518 | ||
519 | /* save change to multikey config file */ | 519 | /* save change to multikey config file */ |
520 | config = new Config("multikey"); | 520 | config = new Config("multikey"); |
521 | config->setGroup ("keymaps"); | 521 | config->setGroup ("keymaps"); |
522 | config->writeEntry ("current", key_map); // default closed | 522 | config->writeEntry ("current", key_map); // default closed |
523 | delete config; | 523 | delete config; |
524 | 524 | ||
525 | delete keys; | 525 | delete keys; |
526 | keys = new Keys(key_map); | 526 | keys = new Keys(key_map); |
527 | 527 | ||
528 | // have to repaint the keyboard | 528 | // have to repaint the keyboard |
529 | repaint(FALSE); | 529 | repaint(FALSE); |
530 | } | 530 | } |
531 | 531 | ||
532 | void Keyboard::setMapToFile(QString map) { | 532 | void Keyboard::setMapToFile(QString map) { |
533 | 533 | ||
534 | /* save change to multikey config file */ | 534 | /* save change to multikey config file */ |
535 | Config *config = new Config("multikey"); | 535 | Config *config = new Config("multikey"); |
536 | config->setGroup ("keymaps"); | 536 | config->setGroup ("keymaps"); |
537 | config->writeEntry ("current", map); // default closed | 537 | config->writeEntry ("current", map); // default closed |
538 | 538 | ||
539 | delete config; | 539 | delete config; |
540 | 540 | ||
541 | delete keys; | 541 | delete keys; |
542 | if (QFile(map).exists()) | 542 | if (QFile(map).exists()) |
543 | keys = new Keys(map); | 543 | keys = new Keys(map); |
544 | else | 544 | else |
545 | keys = new Keys(); | 545 | keys = new Keys(); |
546 | 546 | ||
547 | repaint(FALSE); | 547 | repaint(FALSE); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | /* Keybaord::setColor {{{1 */ | 551 | /* Keybaord::reloadKeyboard {{{1 */ |
552 | void Keyboard::reloadKeyboard() { | 552 | void Keyboard::reloadKeyboard() { |
553 | 553 | ||
554 | // reload colors and redraw | 554 | // reload colors and redraw |
555 | loadKeyboardColors(); | 555 | loadKeyboardColors(); |
556 | repaint(); | 556 | repaint(); |
557 | 557 | ||
558 | } | 558 | } |
559 | 559 | ||
560 | void Keyboard::loadKeyboardColors() { | 560 | void Keyboard::loadKeyboardColors() { |
561 | 561 | ||
562 | Config config ("multikey"); | 562 | Config config ("multikey"); |
563 | config.setGroup("colors"); | 563 | config.setGroup("colors"); |
564 | 564 | ||
565 | QStringList color; | 565 | QStringList color; |
566 | color = config.readListEntry("keycolor", QChar(',')); | 566 | color = config.readListEntry("keycolor", QChar(',')); |
567 | if (color.isEmpty()) { | 567 | if (color.isEmpty()) { |
568 | color = QStringList::split(",", "240,240,240"); | 568 | color = QStringList::split(",", "240,240,240"); |
569 | config.writeEntry("keycolor", color.join(",")); | 569 | config.writeEntry("keycolor", color.join(",")); |
570 | 570 | ||
571 | } | 571 | } |
572 | keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | 572 | keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); |
573 | 573 | ||
574 | color = config.readListEntry("keycolor_pressed", QChar(',')); | 574 | color = config.readListEntry("keycolor_pressed", QChar(',')); |
575 | if (color.isEmpty()) { | 575 | if (color.isEmpty()) { |
576 | color = QStringList::split(",", "171,183,198"); | 576 | color = QStringList::split(",", "171,183,198"); |
577 | config.writeEntry("keycolor_pressed", color.join(",")); | 577 | config.writeEntry("keycolor_pressed", color.join(",")); |
578 | 578 | ||
579 | } | 579 | } |
580 | keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | 580 | keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); |
581 | 581 | ||
582 | color = config.readListEntry("keycolor_lines", QChar(',')); | 582 | color = config.readListEntry("keycolor_lines", QChar(',')); |
583 | if (color.isEmpty()) { | 583 | if (color.isEmpty()) { |
584 | color = QStringList::split(",", "138,148,160"); | 584 | color = QStringList::split(",", "138,148,160"); |
585 | config.writeEntry("keycolor_lines", color.join(",")); | 585 | config.writeEntry("keycolor_lines", color.join(",")); |
586 | 586 | ||
587 | } | 587 | } |
588 | keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | 588 | keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); |
589 | 589 | ||
590 | color = config.readListEntry("textcolor", QChar(',')); | 590 | color = config.readListEntry("textcolor", QChar(',')); |
591 | if (color.isEmpty()) { | 591 | if (color.isEmpty()) { |
592 | color = QStringList::split(",", "43,54,68"); | 592 | color = QStringList::split(",", "43,54,68"); |
593 | config.writeEntry("textcolor", color.join(",")); | 593 | config.writeEntry("textcolor", color.join(",")); |
594 | 594 | ||
595 | } | 595 | } |
596 | textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | 596 | textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); |
597 | 597 | ||
598 | } | 598 | } |
599 | 599 | ||
600 | /* korean input functions {{{1 | 600 | /* korean input functions {{{1 |
601 | * | 601 | * |
602 | * TODO | 602 | * TODO |
603 | * one major problem with this implementation is that you can't move the | 603 | * one major problem with this implementation is that you can't move the |
604 | * cursor after inputing korean chars, otherwise it will eat up and replace | 604 | * cursor after inputing korean chars, otherwise it will eat up and replace |
605 | * the char before the cursor you move to. fix that | 605 | * the char before the cursor you move to. fix that |
606 | * | 606 | * |
607 | * make backspace delete one single char, not the whole thing if still | 607 | * make backspace delete one single char, not the whole thing if still |
608 | * editing. | 608 | * editing. |
609 | * | 609 | * |
610 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | 610 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
611 | * | 611 | * |
612 | * how korean input works | 612 | * how korean input works |
613 | * | 613 | * |
614 | * all following chars means unicode char value and are in hex | 614 | * all following chars means unicode char value and are in hex |
615 | * | 615 | * |