-rw-r--r-- | noncore/applets/zkbapplet/applet/zkbwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/applet/zkbwidget.h | 2 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/main.cpp | 4 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp | 67 |
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() | |||
31 | { | 31 | { |
32 | if (keymap != 0) { | 32 | delete keymap; |
33 | delete keymap; | 33 | keymap = 0; |
34 | keymap = 0; | ||
35 | } | ||
36 | } | 34 | } |
@@ -43,9 +41,7 @@ int ZkbWidget::position() | |||
43 | bool ZkbWidget::loadKeymap() { | 41 | bool ZkbWidget::loadKeymap() { |
44 | ZkbConfig c(QPEApplication::qpeDir()+"share/zkb"); | 42 | ZkbConfig c(Global::applicationFileName("zkb", QString::null) ); |
45 | QFontMetrics fm(font()); | 43 | QFontMetrics fm(font()); |
46 | 44 | ||
47 | if (keymap != 0) { | 45 | delete keymap; |
48 | delete keymap; | 46 | keymap = 0; |
49 | keymap = 0; | ||
50 | } | ||
51 | 47 | ||
@@ -100,6 +96,2 @@ bool ZkbWidget::loadKeymap() { | |||
100 | 96 | ||
101 | QSize ZkbWidget::sizeHint() const { | ||
102 | return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize()); | ||
103 | } | ||
104 | |||
105 | void ZkbWidget::stateChanged(const QString& s) { | 97 | 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: | |||
19 | 19 | ||
20 | QSize sizeHint() const; | ||
21 | |||
22 | protected: | 20 | 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() { | |||
126 | CfgParser p; | 126 | CfgParser p; |
127 | p.save(QPEApplication::qpeDir()+"share/zkb/zkb.xml", *cfile); | 127 | p.save(Global::applicationFileName("zkb", "zkb.xml" ), *cfile); |
128 | QCopEnvelope("QPE/zkb", "reload()"); | 128 | 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 @@ | |||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qpe/global.h> | ||
4 | |||
3 | #include <qlayout.h> | 5 | #include <qlayout.h> |
@@ -11,3 +13,3 @@ int main( int argc, char **argv ) { | |||
11 | CfgParser cp; | 13 | CfgParser cp; |
12 | cp.load(QPEApplication::qpeDir()+"share/zkb/zkb.xml", cfile); | 14 | cp.load(Global::applicationFileName("zkb", "zkb.xml"), cfile); |
13 | 15 | ||
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 @@ | |||
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | #include <opie2/oapplication.h> | ||
5 | using namespace Opie::Core; | 6 | using namespace Opie::Core; |
@@ -17,23 +18,31 @@ ZkbConfig::~ZkbConfig() { | |||
17 | bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { | 18 | bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { |
18 | bool ret; | 19 | bool ret; |
19 | QFile f(path+"/"+file); | 20 | QFile *f = new QFile(path+"/"+file); |
20 | QFileInfo fi(f); | 21 | QFileInfo fi(*f); |
21 | 22 | ||
22 | odebug << "start loading file=" << file.utf8() << "\n" << oendl; | 23 | /* Try */ |
23 | if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { | 24 | if ( !fi.exists() && !path.contains( QPEApplication::qpeDir()) ) { |
24 | return false; | 25 | delete f; |
25 | } | 26 | f = new QFile( QPEApplication::qpeDir() + "share/zkb/" + file ); |
27 | fi = QFileInfo( *f ); | ||
28 | } | ||
26 | 29 | ||
27 | includedFiles.insert(fi.absFilePath(), 1); | 30 | odebug << "start loading file=" << file << "\n" << oendl; |
28 | QXmlInputSource is(f); | 31 | if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { |
29 | QXmlSimpleReader reader; | 32 | return false; |
30 | ZkbHandler h(*this, keymap, prefix); | 33 | } |
31 | 34 | ||
32 | reader.setContentHandler(&h); | 35 | includedFiles.insert(fi.absFilePath(), 1); |
33 | reader.setErrorHandler(this); | 36 | QXmlInputSource is(*f); |
34 | ret = reader.parse(is); | 37 | QXmlSimpleReader reader; |
35 | includedFiles.remove(fi.absFilePath()); | 38 | ZkbHandler h(*this, keymap, prefix); |
36 | 39 | ||
37 | odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl; | 40 | reader.setContentHandler(&h); |
38 | return ret; | 41 | reader.setErrorHandler(this); |
42 | ret = reader.parse(is); | ||
43 | includedFiles.remove(fi.absFilePath()); | ||
44 | |||
45 | odebug << "end loading file=" << file << ": status=" << err << oendl; | ||
46 | delete f; | ||
47 | return ret; | ||
39 | } | 48 | } |
@@ -43,3 +52,3 @@ bool ZkbConfig::warning(const QXmlParseException& e) { | |||
43 | 52 | ||
44 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), | 53 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), |
45 | (const char*) e.message().utf8()); | 54 | (const char*) e.message().utf8()); |
@@ -54,3 +63,3 @@ bool ZkbConfig::error(const QXmlParseException& e) { | |||
54 | 63 | ||
55 | tmp.sprintf("%d: error: %s\n", e.lineNumber(), | 64 | tmp.sprintf("%d: error: %s\n", e.lineNumber(), |
56 | (const char*) e.message().utf8()); | 65 | (const char*) e.message().utf8()); |
@@ -65,3 +74,3 @@ bool ZkbConfig::fatalError(const QXmlParseException& e) { | |||
65 | 74 | ||
66 | tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(), | 75 | tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(), |
67 | (const char*) e.message().utf8()); | 76 | (const char*) e.message().utf8()); |
@@ -78,3 +87,3 @@ QString ZkbConfig::errorString() { | |||
78 | // Implementation of ZkbHandler | 87 | // Implementation of ZkbHandler |
79 | ZkbHandler::ZkbHandler(ZkbConfig& z, Keymap& k, const QString& p):zkc(z), keymap(k), | 88 | ZkbHandler::ZkbHandler(ZkbConfig& z, Keymap& k, const QString& p):zkc(z), keymap(k), |
80 | prefix(p), ardelay(-1), arperiod(-1), currentState(0), currentAction(0) { | 89 | prefix(p), ardelay(-1), arperiod(-1), currentState(0), currentAction(0) { |
@@ -92,3 +101,3 @@ bool ZkbHandler::startKeymapElement(int ard, int arp, const QString&) { | |||
92 | 101 | ||
93 | bool ZkbHandler::startIncludeElement(const QString& file, | 102 | bool ZkbHandler::startIncludeElement(const QString& file, |
94 | const QString& pref) { | 103 | const QString& pref) { |
@@ -100,3 +109,3 @@ bool ZkbHandler::startIncludeElement(const QString& file, | |||
100 | } | 109 | } |
101 | 110 | ||
102 | 111 | ||
@@ -110,3 +119,3 @@ bool ZkbHandler::startIncludeElement(const QString& file, | |||
110 | 119 | ||
111 | bool ZkbHandler::startLabelElement(const QString& label, | 120 | bool ZkbHandler::startLabelElement(const QString& label, |
112 | const QString& state) { | 121 | const QString& state) { |
@@ -121,3 +130,3 @@ bool ZkbHandler::startLabelElement(const QString& label, | |||
121 | 130 | ||
122 | bool ZkbHandler::startStateElement(const QString& name, | 131 | bool ZkbHandler::startStateElement(const QString& name, |
123 | const QString& parentName, bool dflt) { | 132 | const QString& parentName, bool dflt) { |
@@ -127,3 +136,3 @@ bool ZkbHandler::startStateElement(const QString& name, | |||
127 | 136 | ||
128 | //odebug << "state name=" << currentStateName.utf8() << "\n" << oendl; | 137 | //odebug << "state name=" << currentStateName.utf8() << "\n" << oendl; |
129 | 138 | ||
@@ -134,3 +143,3 @@ bool ZkbHandler::startStateElement(const QString& name, | |||
134 | if (parent == 0) { | 143 | if (parent == 0) { |
135 | err = currentStateName + | 144 | err = currentStateName + |
136 | ": undefined parent state: " + pn; | 145 | ": undefined parent state: " + pn; |
@@ -169,3 +178,3 @@ bool ZkbHandler::startMapElement(int keycode, bool pressed) { | |||
169 | 178 | ||
170 | bool ZkbHandler::startEventElement(int keycode, int unicode, int modifiers, | 179 | bool ZkbHandler::startEventElement(int keycode, int unicode, int modifiers, |
171 | bool pressed, bool autorepeat) { | 180 | bool pressed, bool autorepeat) { |
@@ -202,3 +211,3 @@ bool ZkbHandler::endKeymapElement() { | |||
202 | } | 211 | } |
203 | 212 | ||
204 | return true; | 213 | return true; |