author | mickeyl <mickeyl> | 2004-01-04 14:22:59 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-04 14:22:59 (UTC) |
commit | 5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057 (patch) (unidiff) | |
tree | c2e1b4a090ca53efd3b3e0c20d12a633e01470d4 /core/applets | |
parent | 84f039ef3799c5310a4f94057b9d76d4ee55f499 (diff) | |
download | opie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.zip opie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.tar.gz opie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.tar.bz2 |
more patches to multikey+applet courtesy Anton Kachalov <mouse@altlinux.ru>
-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 22 | ||||
-rw-r--r-- | core/applets/multikeyapplet/multikey.h | 2 |
2 files changed, 21 insertions, 3 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index 0a056b0..f1227ef 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp | |||
@@ -26,3 +26,3 @@ | |||
26 | 26 | ||
27 | Multikey::Multikey( QWidget *parent ) : QLabel( parent ), current("EN") | 27 | Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") |
28 | { | 28 | { |
@@ -36,2 +36,3 @@ Multikey::Multikey( QWidget *parent ) : QLabel( parent ), current("EN") | |||
36 | setText("EN"); | 36 | setText("EN"); |
37 | popupMenu.insertItem("EN", -1); | ||
37 | show(); | 38 | show(); |
@@ -39,6 +40,19 @@ Multikey::Multikey( QWidget *parent ) : QLabel( parent ), current("EN") | |||
39 | 40 | ||
40 | void Multikey::mousePressEvent( QMouseEvent * ) | 41 | void Multikey::mousePressEvent(QMouseEvent *ev) |
41 | { | 42 | { |
43 | if (ev->button() == RightButton) { | ||
44 | |||
45 | QPoint p = mapToGlobal(QPoint(0, 0)); | ||
46 | QSize s = popupMenu.sizeHint(); | ||
47 | int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), | ||
48 | p.y() - s.height()), 0); | ||
49 | |||
50 | if (opt == -1) | ||
51 | return; | ||
52 | lang = opt; | ||
53 | } else { | ||
54 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; | ||
55 | } | ||
56 | |||
42 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 57 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
43 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; | ||
44 | //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); | 58 | //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); |
@@ -62,2 +76,3 @@ void Multikey::message(const QCString &message, const QByteArray &data) | |||
62 | sw_maps.clear(); | 76 | sw_maps.clear(); |
77 | popupMenu.clear(); | ||
63 | 78 | ||
@@ -92,2 +107,3 @@ void Multikey::message(const QCString &message, const QByteArray &data) | |||
92 | labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | 107 | labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); |
108 | popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); | ||
93 | } else { | 109 | } else { |
diff --git a/core/applets/multikeyapplet/multikey.h b/core/applets/multikeyapplet/multikey.h index 2cb7b29..b525074 100644 --- a/core/applets/multikeyapplet/multikey.h +++ b/core/applets/multikeyapplet/multikey.h | |||
@@ -18,2 +18,3 @@ | |||
18 | #include <qstringlist.h> | 18 | #include <qstringlist.h> |
19 | #include <qpopupmenu.h> | ||
19 | #include <qcopchannel_qws.h> | 20 | #include <qcopchannel_qws.h> |
@@ -33,2 +34,3 @@ protected: | |||
33 | QStringList labels; | 34 | QStringList labels; |
35 | QPopupMenu popupMenu; | ||
34 | QString current; | 36 | QString current; |