summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/applet/zkbwidget.cpp18
-rw-r--r--noncore/applets/zkbapplet/applet/zkbwidget.h2
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp2
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/main.cpp4
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp67
5 files changed, 47 insertions, 46 deletions
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
index 13729ea..55c08b3 100644
--- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
@@ -31,6 +31,4 @@ ZkbWidget::~ZkbWidget()
{
- if (keymap != 0) {
- delete keymap;
- keymap = 0;
- }
+ delete keymap;
+ keymap = 0;
}
@@ -43,9 +41,7 @@ int ZkbWidget::position()
bool ZkbWidget::loadKeymap() {
- ZkbConfig c(QPEApplication::qpeDir()+"share/zkb");
+ ZkbConfig c(Global::applicationFileName("zkb", QString::null) );
QFontMetrics fm(font());
- if (keymap != 0) {
- delete keymap;
- keymap = 0;
- }
+ delete keymap;
+ keymap = 0;
@@ -100,6 +96,2 @@ bool ZkbWidget::loadKeymap() {
-QSize ZkbWidget::sizeHint() const {
- return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize());
-}
-
void ZkbWidget::stateChanged(const QString& s) {
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.h b/noncore/applets/zkbapplet/applet/zkbwidget.h
index 9bce85a..13906c0 100644
--- a/noncore/applets/zkbapplet/applet/zkbwidget.h
+++ b/noncore/applets/zkbapplet/applet/zkbwidget.h
@@ -19,4 +19,2 @@ public:
- QSize sizeHint() const;
-
protected:
diff --git a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
index 4190a9e..6f24ea0 100644
--- a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
@@ -126,3 +126,3 @@ void CfgDlg::accept() {
CfgParser p;
- p.save(QPEApplication::qpeDir()+"share/zkb/zkb.xml", *cfile);
+ p.save(Global::applicationFileName("zkb", "zkb.xml" ), *cfile);
QCopEnvelope("QPE/zkb", "reload()");
diff --git a/noncore/applets/zkbapplet/keyzcfg/main.cpp b/noncore/applets/zkbapplet/keyzcfg/main.cpp
index afd0f6a..d7926f0 100644
--- a/noncore/applets/zkbapplet/keyzcfg/main.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/main.cpp
@@ -2,2 +2,4 @@
#include <qpe/qpeapplication.h>
+#include <qpe/global.h>
+
#include <qlayout.h>
@@ -11,3 +13,3 @@ int main( int argc, char **argv ) {
CfgParser cp;
- cp.load(QPEApplication::qpeDir()+"share/zkb/zkb.xml", cfile);
+ cp.load(Global::applicationFileName("zkb", "zkb.xml"), cfile);
diff --git a/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
index 24bd897..6f3b9bf 100644
--- a/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
@@ -4,2 +4,3 @@
#include <opie2/odebug.h>
+#include <opie2/oapplication.h>
using namespace Opie::Core;
@@ -17,23 +18,31 @@ ZkbConfig::~ZkbConfig() {
bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) {
- bool ret;
- QFile f(path+"/"+file);
- QFileInfo fi(f);
+ bool ret;
+ QFile *f = new QFile(path+"/"+file);
+ QFileInfo fi(*f);
- odebug << "start loading file=" << file.utf8() << "\n" << oendl;
- if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) {
- return false;
- }
+ /* Try */
+ if ( !fi.exists() && !path.contains( QPEApplication::qpeDir()) ) {
+ delete f;
+ f = new QFile( QPEApplication::qpeDir() + "share/zkb/" + file );
+ fi = QFileInfo( *f );
+ }
- includedFiles.insert(fi.absFilePath(), 1);
- QXmlInputSource is(f);
- QXmlSimpleReader reader;
- ZkbHandler h(*this, keymap, prefix);
+ odebug << "start loading file=" << file << "\n" << oendl;
+ if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) {
+ return false;
+ }
- reader.setContentHandler(&h);
- reader.setErrorHandler(this);
- ret = reader.parse(is);
- includedFiles.remove(fi.absFilePath());
+ includedFiles.insert(fi.absFilePath(), 1);
+ QXmlInputSource is(*f);
+ QXmlSimpleReader reader;
+ ZkbHandler h(*this, keymap, prefix);
- odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl;
- return ret;
+ reader.setContentHandler(&h);
+ reader.setErrorHandler(this);
+ ret = reader.parse(is);
+ includedFiles.remove(fi.absFilePath());
+
+ odebug << "end loading file=" << file << ": status=" << err << oendl;
+ delete f;
+ return ret;
}
@@ -43,3 +52,3 @@ bool ZkbConfig::warning(const QXmlParseException& e) {
- tmp.sprintf("%d: warning: %s\n", e.lineNumber(),
+ tmp.sprintf("%d: warning: %s\n", e.lineNumber(),
(const char*) e.message().utf8());
@@ -54,3 +63,3 @@ bool ZkbConfig::error(const QXmlParseException& e) {
- tmp.sprintf("%d: error: %s\n", e.lineNumber(),
+ tmp.sprintf("%d: error: %s\n", e.lineNumber(),
(const char*) e.message().utf8());
@@ -65,3 +74,3 @@ bool ZkbConfig::fatalError(const QXmlParseException& e) {
- tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(),
+ tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(),
(const char*) e.message().utf8());
@@ -78,3 +87,3 @@ QString ZkbConfig::errorString() {
// Implementation of ZkbHandler
-ZkbHandler::ZkbHandler(ZkbConfig& z, Keymap& k, const QString& p):zkc(z), keymap(k),
+ZkbHandler::ZkbHandler(ZkbConfig& z, Keymap& k, const QString& p):zkc(z), keymap(k),
prefix(p), ardelay(-1), arperiod(-1), currentState(0), currentAction(0) {
@@ -92,3 +101,3 @@ bool ZkbHandler::startKeymapElement(int ard, int arp, const QString&) {
-bool ZkbHandler::startIncludeElement(const QString& file,
+bool ZkbHandler::startIncludeElement(const QString& file,
const QString& pref) {
@@ -100,3 +109,3 @@ bool ZkbHandler::startIncludeElement(const QString& file,
}
-
+
@@ -110,3 +119,3 @@ bool ZkbHandler::startIncludeElement(const QString& file,
-bool ZkbHandler::startLabelElement(const QString& label,
+bool ZkbHandler::startLabelElement(const QString& label,
const QString& state) {
@@ -121,3 +130,3 @@ bool ZkbHandler::startLabelElement(const QString& label,
-bool ZkbHandler::startStateElement(const QString& name,
+bool ZkbHandler::startStateElement(const QString& name,
const QString& parentName, bool dflt) {
@@ -127,3 +136,3 @@ bool ZkbHandler::startStateElement(const QString& name,
-// odebug << "state name=" << currentStateName.utf8() << "\n" << oendl;
+// odebug << "state name=" << currentStateName.utf8() << "\n" << oendl;
@@ -134,3 +143,3 @@ bool ZkbHandler::startStateElement(const QString& name,
if (parent == 0) {
- err = currentStateName +
+ err = currentStateName +
": undefined parent state: " + pn;
@@ -169,3 +178,3 @@ bool ZkbHandler::startMapElement(int keycode, bool pressed) {
-bool ZkbHandler::startEventElement(int keycode, int unicode, int modifiers,
+bool ZkbHandler::startEventElement(int keycode, int unicode, int modifiers,
bool pressed, bool autorepeat) {
@@ -202,3 +211,3 @@ bool ZkbHandler::endKeymapElement() {
}
-
+
return true;