Diffstat (limited to 'core/applets/multikeyapplet/multikey.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index fc5f093..195ada5 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp | |||
@@ -1,47 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru | 2 | ** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
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 | 21 | ||
21 | /* QT */ | 22 | /* QT */ |
22 | #include <qdir.h> | 23 | #include <qdir.h> |
23 | 24 | ||
25 | using namespace Opie::Ui; | ||
24 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") | 26 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") |
25 | { | 27 | { |
26 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); | 28 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); |
27 | connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 29 | connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
28 | this, SLOT(message(const QCString&,const QByteArray&))); | 30 | this, SLOT(message(const QCString&,const QByteArray&))); |
29 | 31 | ||
30 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | 32 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); |
31 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); | 33 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); |
32 | lang = 0; | 34 | lang = 0; |
33 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); | 35 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); |
34 | setText("EN"); | 36 | setText("EN"); |
35 | popupMenu.insertItem("EN", 0); | 37 | popupMenu.insertItem("EN", 0); |
36 | show(); | 38 | show(); |
37 | } | 39 | } |
38 | 40 | ||
39 | void Multikey::mousePressEvent(QMouseEvent *ev) | 41 | void Multikey::mousePressEvent(QMouseEvent *ev) |
40 | { | 42 | { |
41 | if (!sw_maps.count()) | 43 | if (!sw_maps.count()) |
42 | return; | 44 | return; |
43 | 45 | ||
44 | if (ev->button() == RightButton) { | 46 | if (ev->button() == RightButton) { |
45 | 47 | ||
46 | QPoint p = mapToGlobal(QPoint(0, 0)); | 48 | QPoint p = mapToGlobal(QPoint(0, 0)); |
47 | QSize s = popupMenu.sizeHint(); | 49 | QSize s = popupMenu.sizeHint(); |
@@ -116,28 +118,25 @@ void Multikey::message(const QCString &message, const QByteArray &data) | |||
116 | } | 118 | } |
117 | sw_maps.append(keymap_map); | 119 | sw_maps.append(keymap_map); |
118 | labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | 120 | labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); |
119 | popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); | 121 | popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); |
120 | } else { | 122 | } else { |
121 | current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); | 123 | current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); |
122 | } | 124 | } |
123 | break; | 125 | break; |
124 | } | 126 | } |
125 | map.readLine(line, 1024); | 127 | map.readLine(line, 1024); |
126 | } | 128 | } |
127 | map.close(); | 129 | map.close(); |
128 | } | 130 | } |
129 | } | 131 | } |
130 | 132 | ||
131 | setText(current); | 133 | setText(current); |
132 | } | 134 | } |
133 | } | 135 | } |
134 | 136 | ||
135 | int Multikey::position() | 137 | int Multikey::position() |
136 | { | 138 | { |
137 | return 10; | 139 | return 10; |
138 | } | 140 | } |
139 | 141 | ||
140 | Q_EXPORT_INTERFACE() | 142 | EXPORT_OPIE_APPLET_v1( Multikey ) |
141 | { | ||
142 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<Multikey> ); | ||
143 | } | ||