author | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
commit | 2b64a84d39eeed5681d0ee5068c7d11a01527750 (patch) (unidiff) | |
tree | c8693340dbc5ef5e2f9afa90b690829ddff2c4bd /noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp | |
parent | 61fa699140c5efbb6ba0bf2a62f7e8fbf62976be (diff) | |
download | opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.zip opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.gz opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.bz2 |
other keymapping tool - not working this moment, I have to check it out
- the reason is that the config file is somewhat easier to understand than
from zkbapplet and has a nice config tool.
Please don't put it into any repositories this moment.
Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp b/noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp new file mode 100644 index 0000000..84bb375 --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/config/ExtensionsHandler.cpp | |||
@@ -0,0 +1,80 @@ | |||
1 | #include "ExtensionsHandler.h" | ||
2 | |||
3 | void ExtensionsHandler::dispose(QXmlReader* parser, QXmlContentHandler* parent) | ||
4 | { | ||
5 | m_parser = parser; | ||
6 | m_parent = parent; | ||
7 | m_parser->setContentHandler(this); | ||
8 | } | ||
9 | |||
10 | bool ExtensionsHandler::startElement(const QString& /* namespaceURI */, | ||
11 | const QString& localName, | ||
12 | const QString& /* qName */, | ||
13 | const QXmlAttributes& attr) | ||
14 | { | ||
15 | if(localName == "define"){ | ||
16 | /* ÊÑ¿ô½é´ü²½ */ | ||
17 | m_kind = QString::null; | ||
18 | m_code = -1; | ||
19 | //m_mask = 0; | ||
20 | m_modlist.clear(); | ||
21 | for(int i=0; i<attr.length(); i++){ | ||
22 | if(attr.localName(i).lower() == "key"){ | ||
23 | /* keyname */ | ||
24 | if(attr.value(i) == "All"){ | ||
25 | m_code = 0; | ||
26 | } else { | ||
27 | m_code = KeyNames::getCode(attr.value(i)); | ||
28 | } | ||
29 | } else if(attr.localName(i).lower() == "code"){ | ||
30 | /* keycode */ | ||
31 | m_code = KHUtil::hex2int(attr.value(i).lower()); | ||
32 | } else if(attr.localName(i).lower() == "kind"){ | ||
33 | /* extension kind */ | ||
34 | m_kind = attr.value(i); | ||
35 | } | ||
36 | } | ||
37 | } else if(localName == "modifier"){ | ||
38 | /* modifier keys */ | ||
39 | for(int i=0; i<attr.length(); i++){ | ||
40 | if(attr.value(i).lower() == "on"){ | ||
41 | m_modlist.append(attr.localName(i)); | ||
42 | //m_mask |= m_pModifiers->getMask(attr.localName(i)); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | return(true); | ||
47 | } | ||
48 | |||
49 | bool ExtensionsHandler::endElement(const QString& /* namespaceURI */, | ||
50 | const QString& localName, | ||
51 | const QString& /* qName */) | ||
52 | { | ||
53 | if(localName == "define"){ | ||
54 | #if 0 | ||
55 | if(m_kind != QString::null | ||
56 | && (m_code > 0 || m_modlist.isEmpty() == false)){ | ||
57 | #else | ||
58 | if(m_kind != QString::null && m_code >= 0){ | ||
59 | #endif | ||
60 | /* assign extension */ | ||
61 | int keymask = 0; | ||
62 | QValueList<int> modcodes; | ||
63 | for(QStringList::Iterator it=m_modlist.begin(); | ||
64 | it!=m_modlist.end(); ++it){ | ||
65 | keymask |= m_pModifiers->getMask(*it); | ||
66 | qDebug("mask[%s][%x][%s]", m_kind.latin1(), keymask, (*it).latin1()); | ||
67 | int code = KeyNames::getCode(*it); | ||
68 | if(code > 0){ | ||
69 | modcodes.append(code); | ||
70 | } | ||
71 | } | ||
72 | m_pExtensions->assign(m_kind, m_code, keymask, modcodes); | ||
73 | } | ||
74 | } else if(localName == "extensions"){ | ||
75 | m_pExtensions->init(); | ||
76 | /* return parent */ | ||
77 | m_parser->setContentHandler(m_parent); | ||
78 | } | ||
79 | return(true); | ||
80 | } | ||