Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 2ce6dd3..aec0ad3 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -33,3 +33,3 @@ | |||
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <qfile.h> | 34 | #include <qdir.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
@@ -96,2 +96,5 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | |||
96 | 96 | ||
97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); | ||
98 | connect(kbdChannel, SIGNAL(received(const QCString &, const QByteArray &)), | ||
99 | this, SLOT(receive(const QCString &, const QByteArray &))); | ||
97 | } | 100 | } |
@@ -101,3 +104,3 @@ Keyboard::~Keyboard() { | |||
101 | if ( configdlg ) { | 104 | if ( configdlg ) { |
102 | delete (ConfigDlg *) configdlg; | 105 | delete configdlg; |
103 | configdlg = 0; | 106 | configdlg = 0; |
@@ -419,3 +422,3 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
419 | 422 | ||
420 | delete (ConfigDlg *) configdlg; | 423 | delete configdlg; |
421 | configdlg = 0; | 424 | configdlg = 0; |
@@ -436,2 +439,4 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
436 | this, SLOT(cleanupConfigDlg())); | 439 | this, SLOT(cleanupConfigDlg())); |
440 | connect(configdlg, SIGNAL(reloadSw()), | ||
441 | this, SLOT(reloadSw())); | ||
437 | configdlg->showMaximized(); | 442 | configdlg->showMaximized(); |
@@ -762,2 +767,13 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
762 | 767 | ||
768 | void Keyboard::receive(const QCString &msg, const QByteArray &data) | ||
769 | { | ||
770 | if (msg == "setmultikey(QString)") { | ||
771 | QDataStream stream(data, IO_ReadOnly); | ||
772 | QString map; | ||
773 | stream >> map; | ||
774 | setMapToFile(map); | ||
775 | } else if (msg == "getmultikey()") { | ||
776 | reloadSw(); | ||
777 | } | ||
778 | } | ||
763 | 779 | ||
@@ -913,3 +929,3 @@ void Keyboard::cleanupConfigDlg() { | |||
913 | if ( configdlg ) { | 929 | if ( configdlg ) { |
914 | delete (ConfigDlg *) configdlg; | 930 | delete configdlg; |
915 | configdlg = 0; | 931 | configdlg = 0; |
@@ -918,2 +934,13 @@ void Keyboard::cleanupConfigDlg() { | |||
918 | 934 | ||
935 | void Keyboard::reloadSw() { | ||
936 | QCopEnvelope e("MultiKey/Switcher", "setsw(QString,QString)"); | ||
937 | |||
938 | Config* config = new Config("multikey"); | ||
939 | config->setGroup("keymaps"); | ||
940 | QString current_map = config->readEntry("current", "en.keymap"); | ||
941 | delete config; | ||
942 | |||
943 | e << ConfigDlg::loadSw().join("|") << current_map; | ||
944 | } | ||
945 | |||
919 | /* Keyboard::setMapTo ... {{{1 */ | 946 | /* Keyboard::setMapTo ... {{{1 */ |
@@ -928,2 +955,7 @@ void Keyboard::setMapToDefault() { | |||
928 | 955 | ||
956 | /* if Language represents as en_US, ru_RU, etc... */ | ||
957 | int d = l.find('_'); | ||
958 | if (d != -1) { | ||
959 | l.remove(d, l.length()-d); | ||
960 | } | ||
929 | QString key_map = QPEApplication::qpeDir() + "share/multikey/" | 961 | QString key_map = QPEApplication::qpeDir() + "share/multikey/" |
@@ -1508,3 +1540,3 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1508 | 1540 | ||
1509 | // other variables like lang & title | 1541 | // other variables like lang & title & sw |
1510 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { | 1542 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { |