summaryrefslogtreecommitdiff
path: root/noncore/applets/zkbapplet/applet/zkbwidget.cpp
authorzecke <zecke>2004-10-16 00:01:01 (UTC)
committer zecke <zecke>2004-10-16 00:01:01 (UTC)
commitdf14f647ff1a60ca82e0fa9bd91458be146153b8 (patch) (side-by-side diff)
tree4859961352851a4392e1442f2080c15bff8ad7bc /noncore/applets/zkbapplet/applet/zkbwidget.cpp
parent419f9710c488f56a7a117eb1529970d3371e0094 (diff)
downloadopie-df14f647ff1a60ca82e0fa9bd91458be146153b8.zip
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.gz
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.bz2
Replace QPEApplication::qpeDir() + "/ with
QPEApplication::qpeDir() + " as it is guranteed that qpeDir() will have '/' as the last charachter
Diffstat (limited to 'noncore/applets/zkbapplet/applet/zkbwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/applet/zkbwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
index 8499500..13729ea 100644
--- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
@@ -1,92 +1,92 @@
#include <opie2/otaskbarapplet.h>
#include <opie2/okeyfilter.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <stdio.h>
#include <unistd.h>
#include "zkbwidget.h"
#include "zkbcfg.h"
using namespace Opie::Ui;
ZkbWidget::ZkbWidget(QWidget* parent)
:QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) {
labels = new QPopupMenu();
connect(labels, SIGNAL(activated(int)), this,
SLOT(labelChanged(int)));
loadKeymap();
channel = new QCopChannel("QPE/zkb", this);
connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(signalReceived(const QCString&,const QByteArray&)));
setFixedWidth ( AppLnk::smallIconSize() );
setFixedHeight ( AppLnk::smallIconSize() );
}
ZkbWidget::~ZkbWidget()
{
if (keymap != 0) {
delete keymap;
keymap = 0;
}
}
int ZkbWidget::position()
{
return 8;
}
bool ZkbWidget::loadKeymap() {
- ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
+ ZkbConfig c(QPEApplication::qpeDir()+"share/zkb");
QFontMetrics fm(font());
if (keymap != 0) {
delete keymap;
keymap = 0;
}
Keymap* km = new Keymap();
if (!c.load("zkb.xml", *km, "")) {
delete km;
setPixmap(disabled);
return false;
}
connect(km, SIGNAL(stateChanged(const QString&)),
this, SLOT(stateChanged(const QString&)));
Opie::Core::OKeyFilter::inst()->addHandler(km);
Keymap* oldkm = keymap;
keymap = km;
if (oldkm != 0) {
delete oldkm;
}
QString ltext = keymap->getCurrentLabel();
if (ltext.length()==0) ltext = "??";
setText(ltext);
labels->clear();
QStringList l = keymap->listLabels();
labels->insertItem(disabled, 0, 0);
int n = 1;
w = 0;
for(QStringList::Iterator it = l.begin(); it != l.end();
++it, n++) {
// printf("label: %s\n", (const char*) (*it).utf8());
labels->insertItem(*it, n, n);
int lw = fm.width(*it);
if (lw > w) {
w = lw;
}
}