Diffstat (limited to 'noncore/apps/keyz-cfg/zkbcfg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/keyz-cfg/zkbcfg.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/noncore/apps/keyz-cfg/zkbcfg.cpp b/noncore/apps/keyz-cfg/zkbcfg.cpp index 0992b9a..f1d53ba 100644 --- a/noncore/apps/keyz-cfg/zkbcfg.cpp +++ b/noncore/apps/keyz-cfg/zkbcfg.cpp | |||
@@ -1,46 +1,49 @@ | |||
1 | #include <qfileinfo.h> | ||
2 | |||
3 | #include "zkbcfg.h" | 1 | #include "zkbcfg.h" |
4 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
8 | #include <qfileinfo.h> | ||
5 | 9 | ||
6 | // Implementation of XkbConfig class | 10 | // Implementation of XkbConfig class |
7 | ZkbConfig::ZkbConfig(const QString& dir):path(dir) { | 11 | ZkbConfig::ZkbConfig(const QString& dir):path(dir) { |
8 | } | 12 | } |
9 | 13 | ||
10 | ZkbConfig::~ZkbConfig() { | 14 | ZkbConfig::~ZkbConfig() { |
11 | } | 15 | } |
12 | 16 | ||
13 | bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { | 17 | bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { |
14 | bool ret; | 18 | bool ret; |
15 | QFile f(path+"/"+file); | 19 | QFile f(path+"/"+file); |
16 | QFileInfo fi(f); | 20 | QFileInfo fi(f); |
17 | 21 | ||
18 | qDebug("start loading file=%s\n", (const char*) file.utf8()); | 22 | odebug << "start loading file=" << (const char*) file.utf8() << "\n" << oendl; |
19 | if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { | 23 | if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { |
20 | return false; | 24 | return false; |
21 | } | 25 | } |
22 | 26 | ||
23 | includedFiles.insert(fi.absFilePath(), 1); | 27 | includedFiles.insert(fi.absFilePath(), 1); |
24 | QXmlInputSource is(f); | 28 | QXmlInputSource is(f); |
25 | QXmlSimpleReader reader; | 29 | QXmlSimpleReader reader; |
26 | ZkbHandler h(*this, keymap, prefix); | 30 | ZkbHandler h(*this, keymap, prefix); |
27 | 31 | ||
28 | reader.setContentHandler(&h); | 32 | reader.setContentHandler(&h); |
29 | reader.setErrorHandler(this); | 33 | reader.setErrorHandler(this); |
30 | ret = reader.parse(is); | 34 | ret = reader.parse(is); |
31 | includedFiles.remove(fi.absFilePath()); | 35 | includedFiles.remove(fi.absFilePath()); |
32 | 36 | ||
33 | qDebug("end loading file=%s : status=%s\n", (const char*) file.utf8(), | 37 | odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl; |
34 | (const char*) err.utf8()); | ||
35 | return ret; | 38 | return ret; |
36 | } | 39 | } |
37 | 40 | ||
38 | bool ZkbConfig::warning(const QXmlParseException& e) { | 41 | bool ZkbConfig::warning(const QXmlParseException& e) { |
39 | QString tmp; | 42 | QString tmp; |
40 | 43 | ||
41 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), | 44 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), |
42 | (const char*) e.message().utf8()); | 45 | (const char*) e.message().utf8()); |
43 | 46 | ||
44 | err += tmp; | 47 | err += tmp; |
45 | 48 | ||
46 | return true; | 49 | return true; |
@@ -113,25 +116,25 @@ bool ZkbHandler::startLabelElement(const QString& label, | |||
113 | return false; | 116 | return false; |
114 | } | 117 | } |
115 | 118 | ||
116 | return true; | 119 | return true; |
117 | } | 120 | } |
118 | 121 | ||
119 | bool ZkbHandler::startStateElement(const QString& name, | 122 | bool ZkbHandler::startStateElement(const QString& name, |
120 | const QString& parentName, bool dflt) { | 123 | const QString& parentName, bool dflt) { |
121 | 124 | ||
122 | currentStateName = prefix + name; | 125 | currentStateName = prefix + name; |
123 | currentState = keymap.getStateByName(currentStateName); | 126 | currentState = keymap.getStateByName(currentStateName); |
124 | 127 | ||
125 | //qDebug("state name=%s\n", (const char*) currentStateName.utf8()); | 128 | //odebug << "state name=" << (const char*) currentStateName.utf8() << "\n" << oendl; |
126 | 129 | ||
127 | State* parent = 0; | 130 | State* parent = 0; |
128 | if (!parentName.isEmpty()) { | 131 | if (!parentName.isEmpty()) { |
129 | QString pn = prefix + parentName; | 132 | QString pn = prefix + parentName; |
130 | parent = keymap.getStateByName(pn); | 133 | parent = keymap.getStateByName(pn); |
131 | if (parent == 0) { | 134 | if (parent == 0) { |
132 | err = currentStateName + | 135 | err = currentStateName + |
133 | ": undefined parent state: " + pn; | 136 | ": undefined parent state: " + pn; |
134 | return false; | 137 | return false; |
135 | } | 138 | } |
136 | } | 139 | } |
137 | 140 | ||