summaryrefslogtreecommitdiff
authoralwin <alwin>2004-02-26 16:46:05 (UTC)
committer alwin <alwin>2004-02-26 16:46:05 (UTC)
commit15f4596df91110689176fb3b76a4fcf6663c1c09 (patch) (side-by-side diff)
treefe9fcef4baf851b13427cc06b7b2b6b83b5adb5e
parent89cbb91c0217a1ba0480c23e8ef14221975f04e2 (diff)
downloadopie-15f4596df91110689176fb3b76a4fcf6663c1c09.zip
opie-15f4596df91110689176fb3b76a4fcf6663c1c09.tar.gz
opie-15f4596df91110689176fb3b76a4fcf6663c1c09.tar.bz2
forgot remove some ifdefs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/keyz-cfg/zkbnames.cpp3
-rw-r--r--noncore/apps/keyz-cfg/zkbnames.h4
-rw-r--r--noncore/apps/keyz-cfg/zkbxml.cpp14
3 files changed, 0 insertions, 21 deletions
diff --git a/noncore/apps/keyz-cfg/zkbnames.cpp b/noncore/apps/keyz-cfg/zkbnames.cpp
index fec3a2e..c20a114 100644
--- a/noncore/apps/keyz-cfg/zkbnames.cpp
+++ b/noncore/apps/keyz-cfg/zkbnames.cpp
@@ -1,50 +1,48 @@
-#ifdef USE_ZKB_NAMES
-
#include <qmap.h>
#include <qstring.h>
#include "zkbnames.h"
QString Null_String((const char*) 0);
// Implementation of KeyNames
static struct {
int key;
char *name;
} Key_Names[] = {
{ 32, "Space" },
{ 39, "Apostrophe" },
{ 44, "Comma" },
{ 46, "Period" },
{ 47, "Slash" },
{ 65, "A" },
{ 66, "B" },
{ 67, "C" },
{ 68, "D" },
{ 69, "E" },
{ 70, "F" },
{ 71, "G" },
{ 72, "H" },
{ 73, "I" },
{ 74, "J" },
{ 75, "K" },
{ 76, "L" },
{ 77, "M" },
{ 78, "N" },
{ 79, "O" },
{ 80, "P" },
{ 81, "Q" },
{ 82, "R" },
{ 83, "S" },
{ 84, "T" },
{ 85, "U" },
{ 86, "V" },
{ 87, "W" },
{ 88, "X" },
{ 89, "Y" },
{ 90, "Z" },
{ 4096, "Cancel" },
{ 4097, "Tab" },
{ 4099, "Backspace" },
{ 4100, "Enter" },
{ 4114, "Left" },
@@ -402,49 +400,48 @@ struct {
{ "yacute", 0x0fd },
{ "thorn", 0x0fe },
{ "ydiaeresis", 0x0ff },
{ "unknown", 0xffff },
{ 0, 0}
};
static QMap<QString, int> kcn_map;
static QMap<int, QString> kcn_rmap;
void init_kcn_maps() {
int i = 0;
while (Keycode_Names[i].name != 0) {
int keycode = Keycode_Names[i].keycode;
QString name(Keycode_Names[i].name);
kcn_map.insert(name, keycode);
kcn_rmap.insert(keycode, name);
i++;
}
}
int KeycodeNames::find(const QString& key) {
if (kcn_map.isEmpty()) {
init_kcn_maps();
}
QMap<QString, int>::Iterator it = kcn_map.find(key);
if (it == kcn_map.end()) {
return -1;
} else {
return it.data();
}
}
const QString& KeycodeNames::find(int k) {
if (kcn_map.isEmpty()) {
init_kcn_maps();
}
QMap<int, QString>::Iterator it = kcn_rmap.find(k);
if (it == kcn_rmap.end()) {
return Null_String;
} else {
return it.data();
}
}
-#endif
diff --git a/noncore/apps/keyz-cfg/zkbnames.h b/noncore/apps/keyz-cfg/zkbnames.h
index 58462ff..0d1e7f5 100644
--- a/noncore/apps/keyz-cfg/zkbnames.h
+++ b/noncore/apps/keyz-cfg/zkbnames.h
@@ -1,27 +1,23 @@
#ifndef ZKBNAMES_H
#define ZKBNAMES_H
-#ifdef USE_ZKB_NAMES
-
#include <qstring.h>
class KeyNames {
public:
static int find(const QString& key);
static const QString& find(int);
};
class KeycodeNames {
public:
static int find(const QString& key);
static const QString& find(int);
};
class ModifierNames {
public:
static int find(const QString& key);
static const QString& find(int);
};
-
-#endif
#endif
diff --git a/noncore/apps/keyz-cfg/zkbxml.cpp b/noncore/apps/keyz-cfg/zkbxml.cpp
index 76472cb..5b0084c 100644
--- a/noncore/apps/keyz-cfg/zkbxml.cpp
+++ b/noncore/apps/keyz-cfg/zkbxml.cpp
@@ -444,144 +444,130 @@ bool ZkbXmlHandler::start_next_state(const QXmlAttributes& attr) {
} else {
setError("Missing name attribute");
return false;
}
if (attr.length() > nattr) {
setError("Unsupported attributes");
return false;
}
return startNextStateElement(name);
}
bool ZkbXmlHandler::end_keymap() {
return endKeymapElement();
}
bool ZkbXmlHandler::end_include() {
return endIncludeElement();
}
bool ZkbXmlHandler::end_label() {
return endLabelElement();
}
bool ZkbXmlHandler::end_state() {
return endStateElement();
}
bool ZkbXmlHandler::end_map() {
return endMapElement();
}
bool ZkbXmlHandler::end_event() {
return endEventElement();
}
bool ZkbXmlHandler::end_next_state() {
return endNextStateElement();
}
void ZkbXmlHandler::setError(const QString& e) {
err = e;
}
int ZkbXmlHandler::str2key(const QString& s) {
int ret;
-#ifdef USE_ZKB_NAMES
ret = KeyNames::find(s);
if (ret == -1) {
setError("Invalid value: " + s);
}
-#else
- ret = str2uint(s);
-#endif
-
return ret;
}
int ZkbXmlHandler::str2modifier(const QString& val) {
int ret;
-#ifdef USE_ZKB_NAMES
int n, i;
ret = 0;
n = 0;
do {
i = val.find('|', n);
if (i < 0) {
i = val.length();
}
QString s = val.mid(n, i - n);
int v = ModifierNames::find(s.stripWhiteSpace());
if (v == -1) {
setError("Invalid value: " + val);
return -1;
}
ret |= v;
n = i + 1;
} while (n < val.length());
-#else
- ret = str2uint(val);
-#endif
return ret;
}
bool ZkbXmlHandler::str2bool(const QString& s) {
if (s == "true") {
return true;
} else {
return false;
}
}
int ZkbXmlHandler::str2unicode(const QString& s) {
return str2uint(s);
}
int ZkbXmlHandler::str2keycode(const QString& s) {
int ret;
-#ifdef USE_ZKB_NAMES
ret = KeycodeNames::find(s);
if (ret == -1) {
setError("Invalid value: " + s);
}
-#else
- ret = str2uint(s);
-#endif
-
return ret;
}
int ZkbXmlHandler::str2uint(const QString& s) {
int ret;
bool ok;
QString val = s;
int r;
if (val.left(2) == "0x") {
val = s.mid(2);
r = 16;
} else if (val.left(1) == "0") {
val = s.mid(1);
r = 8;
} else {
r = 10;
}
ret = val.toInt(&ok, r);
if (!ok) {
setError("Invalid value: " + s);
ret = -1;
}
return ret;
}