-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index b17498d..fc5f093 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp | |||
@@ -1,76 +1,76 @@ | |||
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 | 20 | ||
21 | /* QT */ | 21 | /* QT */ |
22 | #include <qdir.h> | 22 | #include <qdir.h> |
23 | 23 | ||
24 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") | 24 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") |
25 | { | 25 | { |
26 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); | 26 | QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); |
27 | connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 27 | connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
28 | this, SLOT(message(const QCString &, const QByteArray &))); | 28 | this, SLOT(message(const QCString&,const QByteArray&))); |
29 | 29 | ||
30 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | 30 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); |
31 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); | 31 | QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); |
32 | lang = 0; | 32 | lang = 0; |
33 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); | 33 | QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); |
34 | setText("EN"); | 34 | setText("EN"); |
35 | popupMenu.insertItem("EN", 0); | 35 | popupMenu.insertItem("EN", 0); |
36 | show(); | 36 | show(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void Multikey::mousePressEvent(QMouseEvent *ev) | 39 | void Multikey::mousePressEvent(QMouseEvent *ev) |
40 | { | 40 | { |
41 | if (!sw_maps.count()) | 41 | if (!sw_maps.count()) |
42 | return; | 42 | return; |
43 | 43 | ||
44 | if (ev->button() == RightButton) { | 44 | if (ev->button() == RightButton) { |
45 | 45 | ||
46 | QPoint p = mapToGlobal(QPoint(0, 0)); | 46 | QPoint p = mapToGlobal(QPoint(0, 0)); |
47 | QSize s = popupMenu.sizeHint(); | 47 | QSize s = popupMenu.sizeHint(); |
48 | int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), | 48 | int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), |
49 | p.y() - s.height()), 0); | 49 | p.y() - s.height()), 0); |
50 | 50 | ||
51 | if (opt == -1) | 51 | if (opt == -1) |
52 | return; | 52 | return; |
53 | lang = opt; | 53 | lang = opt; |
54 | 54 | ||
55 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 55 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
56 | e << sw_maps[lang]; | 56 | e << sw_maps[lang]; |
57 | setText(labels[lang]); | 57 | setText(labels[lang]); |
58 | } | 58 | } |
59 | QWidget::mousePressEvent(ev); | 59 | QWidget::mousePressEvent(ev); |
60 | } | 60 | } |
61 | 61 | ||
62 | void Multikey::mouseReleaseEvent(QMouseEvent *ev) | 62 | void Multikey::mouseReleaseEvent(QMouseEvent *ev) |
63 | { | 63 | { |
64 | if (!sw_maps.count()) | 64 | if (!sw_maps.count()) |
65 | return; | 65 | return; |
66 | 66 | ||
67 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; | 67 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; |
68 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 68 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
69 | //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); | 69 | //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); |
70 | e << sw_maps[lang]; | 70 | e << sw_maps[lang]; |
71 | setText(labels[lang]); | 71 | setText(labels[lang]); |
72 | } | 72 | } |
73 | 73 | ||
74 | void Multikey::message(const QCString &message, const QByteArray &data) | 74 | void Multikey::message(const QCString &message, const QByteArray &data) |
75 | { | 75 | { |
76 | if ( message == "setsw(QString,QString)" ) { | 76 | if ( message == "setsw(QString,QString)" ) { |