summaryrefslogtreecommitdiff
path: root/noncore/applets/zkbapplet/zkbwidget.cpp
Unidiff
Diffstat (limited to 'noncore/applets/zkbapplet/zkbwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 0083e9b..3acff1e 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -1,27 +1,28 @@
1#include <opie2/otaskbarapplet.h> 1#include <opie2/otaskbarapplet.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3#include <qpe/applnk.h> 3#include <qpe/applnk.h>
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h> 7#include <unistd.h>
8#include "zkbwidget.h" 8#include "zkbwidget.h"
9#include "zkbcfg.h" 9#include "zkbcfg.h"
10 10
11using namespace Opie::Ui;
11ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), 12ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
12 disabled(Resource::loadPixmap("zkb-disabled")) { 13 disabled(Resource::loadPixmap("zkb-disabled")) {
13 14
14 labels = new QPopupMenu(); 15 labels = new QPopupMenu();
15 connect(labels, SIGNAL(activated(int)), this, 16 connect(labels, SIGNAL(activated(int)), this,
16 SLOT(labelChanged(int))); 17 SLOT(labelChanged(int)));
17 18
18 loadKeymap(); 19 loadKeymap();
19 20
20 channel = new QCopChannel("QPE/zkb", this); 21 channel = new QCopChannel("QPE/zkb", this);
21 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), 22 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
22 this, SLOT(signalReceived(const QCString&,const QByteArray&))); 23 this, SLOT(signalReceived(const QCString&,const QByteArray&)));
23 setFixedWidth ( AppLnk::smallIconSize() ); 24 setFixedWidth ( AppLnk::smallIconSize() );
24 setFixedHeight ( AppLnk::smallIconSize() ); 25 setFixedHeight ( AppLnk::smallIconSize() );
25} 26}
26 27
27ZkbWidget::~ZkbWidget() { 28ZkbWidget::~ZkbWidget() {
@@ -59,25 +60,25 @@ bool ZkbWidget::loadKeymap() {
59 60
60 if (oldkm != 0) { 61 if (oldkm != 0) {
61 delete oldkm; 62 delete oldkm;
62 } 63 }
63 64
64 setText(keymap->getCurrentLabel()); 65 setText(keymap->getCurrentLabel());
65 66
66 labels->clear(); 67 labels->clear();
67 QStringList l = keymap->listLabels(); 68 QStringList l = keymap->listLabels();
68 labels->insertItem(disabled, 0, 0); 69 labels->insertItem(disabled, 0, 0);
69 int n = 1; 70 int n = 1;
70 w = 0; 71 w = 0;
71 for(QStringList::Iterator it = l.begin(); it != l.end(); 72 for(QStringList::Iterator it = l.begin(); it != l.end();
72 ++it, n++) { 73 ++it, n++) {
73 74
74 // printf("label: %s\n", (const char*) (*it).utf8()); 75 // printf("label: %s\n", (const char*) (*it).utf8());
75 76
76 labels->insertItem(*it, n, n); 77 labels->insertItem(*it, n, n);
77 int lw = fm.width(*it); 78 int lw = fm.width(*it);
78 if (lw > w) { 79 if (lw > w) {
79 w = lw; 80 w = lw;
80 } 81 }
81 } 82 }
82 83
83 if (w == 0) { 84 if (w == 0) {
@@ -146,17 +147,15 @@ void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) {
146 } 147 }
147 } else if (msg == "debug(QString)") { 148 } else if (msg == "debug(QString)") {
148 QString flag; 149 QString flag;
149 stream >> flag; 150 stream >> flag;
150 } 151 }
151} 152}
152 153
153void ZkbWidget::reload() { 154void ZkbWidget::reload() {
154 loadKeymap(); 155 loadKeymap();
155 QCopEnvelope("QPE/System", "notBusy()"); 156 QCopEnvelope("QPE/System", "notBusy()");
156} 157}
157 158
158Q_EXPORT_INTERFACE() 159EXPORT_OPIE_APPLET_v1( ZkbWidget )
159{ 160
160 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> );
161}
162 161