-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index 8cb9083..f3d8375 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp | |||
@@ -5,44 +5,44 @@ | |||
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #include "multikey.h" | 15 | #include "multikey.h" |
16 | 16 | ||
17 | /* OPIE */ | 17 | /* OPIE */ |
18 | #include <opie2/otaskbarapplet.h> | 18 | #include <opie2/otaskbarapplet.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | using namespace Opie::Ui; | ||
21 | 22 | ||
22 | /* QT */ | 23 | /* QT */ |
23 | #include <qdir.h> | 24 | #include <qdir.h> |
24 | 25 | ||
25 | using namespace Opie::Ui; | 26 | //FIXME: Better read appropriate initial setting from LOCALE, not hardcode it "EN" |
26 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") | 27 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") |
27 | { | 28 | { |
28 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); | 29 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); |
29 | connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 30 | connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
30 | this, SLOT(message(const QCString&,const QByteArray&))); | 31 | this, SLOT(message(const QCString&,const QByteArray&))); |
31 | 32 | ||
32 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | ||
33 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); | 33 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); |
34 | lang = 0; | 34 | lang = 0; |
35 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); | 35 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); |
36 | setText("EN"); | 36 | setText("EN"); |
37 | popupMenu.insertItem("EN", 0); | 37 | popupMenu.insertItem("EN", 0); |
38 | show(); | 38 | show(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void Multikey::mousePressEvent(QMouseEvent *ev) | 41 | void Multikey::mousePressEvent(QMouseEvent *ev) |
42 | { | 42 | { |
43 | if (!sw_maps.count()) | 43 | if (!sw_maps.count()) |
44 | return; | 44 | return; |
45 | 45 | ||
46 | if (ev->button() == RightButton) { | 46 | if (ev->button() == RightButton) { |
47 | 47 | ||
48 | QPoint p = mapToGlobal(QPoint(0, 0)); | 48 | QPoint p = mapToGlobal(QPoint(0, 0)); |
@@ -55,33 +55,33 @@ void Multikey::mousePressEvent(QMouseEvent *ev) | |||
55 | lang = opt; | 55 | lang = opt; |
56 | 56 | ||
57 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 57 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
58 | e << sw_maps[lang]; | 58 | e << sw_maps[lang]; |
59 | setText(labels[lang]); | 59 | setText(labels[lang]); |
60 | } | 60 | } |
61 | QWidget::mousePressEvent(ev); | 61 | QWidget::mousePressEvent(ev); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Multikey::mouseReleaseEvent(QMouseEvent *ev) | 64 | void Multikey::mouseReleaseEvent(QMouseEvent *ev) |
65 | { | 65 | { |
66 | if (!sw_maps.count()) | 66 | if (!sw_maps.count()) |
67 | return; | 67 | return; |
68 | 68 | ||
69 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; | 69 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; |
70 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 70 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
71 | //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl; | 71 | //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl; |
72 | e << sw_maps[lang]; | 72 | e << sw_maps[lang]; |
73 | setText(labels[lang]); | 73 | setText(labels[lang]); |
74 | } | 74 | } |
75 | 75 | ||
76 | void Multikey::message(const QCString &message, const QByteArray &data) | 76 | void Multikey::message(const QCString &message, const QByteArray &data) |
77 | { | 77 | { |
78 | if ( message == "setsw(QString,QString)" ) { | 78 | if ( message == "setsw(QString,QString)" ) { |
79 | 79 | ||
80 | QDataStream stream(data, IO_ReadOnly); | 80 | QDataStream stream(data, IO_ReadOnly); |
81 | QString maps, current_map; | 81 | QString maps, current_map; |
82 | stream >> maps >> current_map; | 82 | stream >> maps >> current_map; |
83 | QStringList sw = QStringList::split(QChar('|'), maps); | 83 | QStringList sw = QStringList::split(QChar('|'), maps); |
84 | sw.append(current_map); | 84 | sw.append(current_map); |
85 | 85 | ||
86 | QDir map_dir(QPEApplication::qpeDir() + "share/multikey/", "*.keymap"); | 86 | QDir map_dir(QPEApplication::qpeDir() + "share/multikey/", "*.keymap"); |
87 | lang = 0; | 87 | lang = 0; |