-rw-r--r-- | noncore/apps/keyz-cfg/cfgfile.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/keyz-cfg.pro | 2 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/zkb.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/zkbcfg.cpp | 15 |
5 files changed, 22 insertions, 13 deletions
diff --git a/noncore/apps/keyz-cfg/cfgfile.cpp b/noncore/apps/keyz-cfg/cfgfile.cpp index b0dc968..81d1ee1 100644 --- a/noncore/apps/keyz-cfg/cfgfile.cpp +++ b/noncore/apps/keyz-cfg/cfgfile.cpp | |||
@@ -1,15 +1,21 @@ | |||
1 | #include <qmessagebox.h> | ||
2 | #include "cfgfile.h" | 1 | #include "cfgfile.h" |
3 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
8 | #include <qmessagebox.h> | ||
9 | |||
4 | // CfgEntry implementation | 10 | // CfgEntry implementation |
5 | CfgEntry::CfgEntry() { | 11 | CfgEntry::CfgEntry() { |
6 | } | 12 | } |
7 | 13 | ||
8 | CfgEntry::CfgEntry(const QString& f, const QString& l): | 14 | CfgEntry::CfgEntry(const QString& f, const QString& l): |
9 | file(f), label(l) { | 15 | file(f), label(l) { |
10 | } | 16 | } |
11 | 17 | ||
12 | const QString& CfgEntry::getFile() const { | 18 | const QString& CfgEntry::getFile() const { |
13 | return file; | 19 | return file; |
14 | } | 20 | } |
15 | 21 | ||
@@ -86,36 +92,36 @@ bool CfgParser::load(QString file, CfgFile& cfg) { | |||
86 | QXmlSimpleReader reader; | 92 | QXmlSimpleReader reader; |
87 | CfgHandler p(*this); | 93 | CfgHandler p(*this); |
88 | 94 | ||
89 | reader.setErrorHandler(this); | 95 | reader.setErrorHandler(this); |
90 | reader.setContentHandler(&p); | 96 | reader.setContentHandler(&p); |
91 | 97 | ||
92 | err = ""; | 98 | err = ""; |
93 | ardelay = -1; | 99 | ardelay = -1; |
94 | arperiod = -1; | 100 | arperiod = -1; |
95 | reader.parse(is); | 101 | reader.parse(is); |
96 | 102 | ||
97 | if (!err.isEmpty()) { | 103 | if (!err.isEmpty()) { |
98 | qDebug(err); | 104 | odebug << err << oendl; |
99 | return false; | 105 | return false; |
100 | } | 106 | } |
101 | 107 | ||
102 | QMap<QString, QString>::Iterator fit, lit; | 108 | QMap<QString, QString>::Iterator fit, lit; |
103 | for(uint i = 0; i < includeList.count(); i++) { | 109 | for(uint i = 0; i < includeList.count(); i++) { |
104 | QString file = *includeList.at(i); | 110 | QString file = *includeList.at(i); |
105 | fit = includes.find(file); | 111 | fit = includes.find(file); |
106 | QString prefix = fit.data(); | 112 | QString prefix = fit.data(); |
107 | QString label = ""; | 113 | QString label = ""; |
108 | 114 | ||
109 | qDebug("include: file=" + fit.key() + ", prefix=" + fit.data()); | 115 | odebug << "include: file=" + fit.key() + ", prefix=" + fit.data() << oendl; |
110 | lit = labels.find(prefix+":*"); | 116 | lit = labels.find(prefix+":*"); |
111 | if (lit != labels.end()) { | 117 | if (lit != labels.end()) { |
112 | label = lit.data(); | 118 | label = lit.data(); |
113 | } | 119 | } |
114 | 120 | ||
115 | cfg.replaceEntry(file, label); | 121 | cfg.replaceEntry(file, label); |
116 | } | 122 | } |
117 | 123 | ||
118 | if (ardelay != -1) { | 124 | if (ardelay != -1) { |
119 | cfg.setAutorepeatDelay(ardelay); | 125 | cfg.setAutorepeatDelay(ardelay); |
120 | } | 126 | } |
121 | 127 | ||
diff --git a/noncore/apps/keyz-cfg/config.in b/noncore/apps/keyz-cfg/config.in index 29a10f5..8e1be2d 100644 --- a/noncore/apps/keyz-cfg/config.in +++ b/noncore/apps/keyz-cfg/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config KEYZCFG | 1 | config KEYZCFG |
2 | boolean "keyz-cfg (configuration tool for keyz applet)" | 2 | boolean "keyz-cfg (configuration tool for keyz applet)" |
3 | default "n" | 3 | default "n" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
diff --git a/noncore/apps/keyz-cfg/keyz-cfg.pro b/noncore/apps/keyz-cfg/keyz-cfg.pro index 44bbb5f..7ac604b 100644 --- a/noncore/apps/keyz-cfg/keyz-cfg.pro +++ b/noncore/apps/keyz-cfg/keyz-cfg.pro | |||
@@ -9,16 +9,16 @@ HEADERS = zkb.h \ | |||
9 | cfgfile.h | 9 | cfgfile.h |
10 | 10 | ||
11 | SOURCES = main.cpp \ | 11 | SOURCES = main.cpp \ |
12 | cfgdlg.cpp \ | 12 | cfgdlg.cpp \ |
13 | cfgfile.cpp \ | 13 | cfgfile.cpp \ |
14 | zkb.cpp \ | 14 | zkb.cpp \ |
15 | zkbcfg.cpp \ | 15 | zkbcfg.cpp \ |
16 | zkbnames.cpp \ | 16 | zkbnames.cpp \ |
17 | zkbxml.cpp | 17 | zkbxml.cpp |
18 | 18 | ||
19 | INCLUDEPATH += $(OPIEDIR)/include | 19 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH += $(OPIEDIR)/include | 20 | DEPENDPATH += $(OPIEDIR)/include |
21 | LIBS += -lqpe | 21 | LIBS += -lqpe -lopiecore2 |
22 | TARGET = keyz-cfg | 22 | TARGET = keyz-cfg |
23 | 23 | ||
24 | include ( $(OPIEDIR)/include.pro ) | 24 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index f315d4b..8382615 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp | |||
@@ -355,25 +355,25 @@ State* Keymap::getStateByLabel(const QString& label) { | |||
355 | QString name = lit.data(); | 355 | QString name = lit.data(); |
356 | 356 | ||
357 | int n = name.find(":*"); | 357 | int n = name.find(":*"); |
358 | if (n>=0 && n==(int)(name.length()-2)) { | 358 | if (n>=0 && n==(int)(name.length()-2)) { |
359 | name=name.left(name.length() - 1); | 359 | name=name.left(name.length() - 1); |
360 | 360 | ||
361 | n = currentStateName.findRev(":"); | 361 | n = currentStateName.findRev(":"); |
362 | if (n >= 0) { | 362 | if (n >= 0) { |
363 | name += currentStateName.mid(n+1); | 363 | name += currentStateName.mid(n+1); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | //qDebug("look for: %s\n", (const char*) name.utf8()); | 367 | //odebug << "look for: " << (const char*) name.utf8() << "\n" << oendl; |
368 | QMap<QString, State*>::Iterator sit = states.find(name); | 368 | QMap<QString, State*>::Iterator sit = states.find(name); |
369 | if (sit != states.end()) { | 369 | if (sit != states.end()) { |
370 | state = sit.data(); | 370 | state = sit.data(); |
371 | } | 371 | } |
372 | 372 | ||
373 | return state; | 373 | return state; |
374 | } | 374 | } |
375 | 375 | ||
376 | bool Keymap::addState(const QString& name, State* state) { | 376 | bool Keymap::addState(const QString& name, State* state) { |
377 | if (states.find(name) != states.end()) { | 377 | if (states.find(name) != states.end()) { |
378 | return false; | 378 | return false; |
379 | } | 379 | } |
@@ -407,25 +407,25 @@ bool Keymap::setCurrentState(State* state) { | |||
407 | qDebug("state changed: %s\n", (const char*) | 407 | qDebug("state changed: %s\n", (const char*) |
408 | currentStateName.utf8()); | 408 | currentStateName.utf8()); |
409 | 409 | ||
410 | if (!lsmapInSync) { | 410 | if (!lsmapInSync) { |
411 | generateLabelStateMaps(); | 411 | generateLabelStateMaps(); |
412 | } | 412 | } |
413 | 413 | ||
414 | QMap<State*, QString>::Iterator tit; | 414 | QMap<State*, QString>::Iterator tit; |
415 | tit = stateLabelMap.find(state); | 415 | tit = stateLabelMap.find(state); |
416 | if (tit != stateLabelMap.end()) { | 416 | if (tit != stateLabelMap.end()) { |
417 | currentLabel = tit.data(); | 417 | currentLabel = tit.data(); |
418 | } else { | 418 | } else { |
419 | // qDebug("no label for: " + currentStateName + "\n"); | 419 | // odebug << "no label for: " + currentStateName + "\n" << oendl; |
420 | currentLabel = ""; | 420 | currentLabel = ""; |
421 | } | 421 | } |
422 | 422 | ||
423 | return true; | 423 | return true; |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | return false; | 427 | return false; |
428 | } | 428 | } |
429 | 429 | ||
430 | bool Keymap::removeState(const QString& name, bool force) { | 430 | bool Keymap::removeState(const QString& name, bool force) { |
431 | QMap<QString, State*>::Iterator it = states.find(name); | 431 | QMap<QString, State*>::Iterator it = states.find(name); |
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 | ||