summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
authormickeyl <mickeyl>2004-01-03 16:57:51 (UTC)
committer mickeyl <mickeyl>2004-01-03 16:57:51 (UTC)
commitbdabd0e055d494c7546de08348e32cf5622c9074 (patch) (unidiff)
tree97346f3ef40158d31c2e649390a941135890a39b /inputmethods/multikey/keyboard.cpp
parent4f7bf49ba4c0466aa9cea618c9317ac965a1118f (diff)
downloadopie-bdabd0e055d494c7546de08348e32cf5622c9074.zip
opie-bdabd0e055d494c7546de08348e32cf5622c9074.tar.gz
opie-bdabd0e055d494c7546de08348e32cf5622c9074.tar.bz2
add multikey patches courtesy Anton Kachalov <mouse@altlinux.ru>
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp42
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
@@ -32,5 +32,5 @@
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <ctype.h> 33#include <ctype.h>
34#include <qfile.h> 34#include <qdir.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qstringlist.h> 36#include <qstringlist.h>
@@ -95,4 +95,7 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
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}
98 101
@@ -100,5 +103,5 @@ Keyboard::~Keyboard() {
100 103
101 if ( configdlg ) { 104 if ( configdlg ) {
102 delete (ConfigDlg *) configdlg; 105 delete configdlg;
103 configdlg = 0; 106 configdlg = 0;
104 } 107 }
@@ -418,5 +421,5 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
418 if ( configdlg ) { 421 if ( configdlg ) {
419 422
420 delete (ConfigDlg *) configdlg; 423 delete configdlg;
421 configdlg = 0; 424 configdlg = 0;
422 } 425 }
@@ -435,4 +438,6 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
435 connect(configdlg, SIGNAL(configDlgClosed()), 438 connect(configdlg, SIGNAL(configDlgClosed()),
436 this, SLOT(cleanupConfigDlg())); 439 this, SLOT(cleanupConfigDlg()));
440 connect(configdlg, SIGNAL(reloadSw()),
441 this, SLOT(reloadSw()));
437 configdlg->showMaximized(); 442 configdlg->showMaximized();
438 configdlg->show(); 443 configdlg->show();
@@ -761,4 +766,15 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
761} 766}
762 767
768void 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
764/* Keyboard::mouseReleaseEvent {{{1 */ 780/* Keyboard::mouseReleaseEvent {{{1 */
@@ -912,9 +928,20 @@ void Keyboard::cleanupConfigDlg() {
912 928
913 if ( configdlg ) { 929 if ( configdlg ) {
914 delete (ConfigDlg *) configdlg; 930 delete configdlg;
915 configdlg = 0; 931 configdlg = 0;
916 } 932 }
917} 933}
918 934
935void 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 */
920void Keyboard::setMapToDefault() { 947void Keyboard::setMapToDefault() {
@@ -927,4 +954,9 @@ void Keyboard::setMapToDefault() {
927 delete config; 954 delete config;
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/"
930 + l + ".keymap"; 962 + l + ".keymap";
@@ -1507,5 +1539,5 @@ void Keys::setKeysFromFile(const char * filename) {
1507 } 1539 }
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))) {
1511 1543