From 2b64a84d39eeed5681d0ee5068c7d11a01527750 Mon Sep 17 00:00:00 2001 From: alwin Date: Mon, 28 Feb 2005 09:40:30 +0000 Subject: 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. --- (limited to 'noncore/applets/keyhelper/keyhelperapplet/config/ModifiersHandler.cpp') diff --git a/noncore/applets/keyhelper/keyhelperapplet/config/ModifiersHandler.cpp b/noncore/applets/keyhelper/keyhelperapplet/config/ModifiersHandler.cpp new file mode 100644 index 0000000..b2cde92 --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/config/ModifiersHandler.cpp @@ -0,0 +1,99 @@ +#include "ModifiersHandler.h" + +void ModifiersHandler::dispose(QXmlReader* parser, QXmlContentHandler* parent) +{ + m_parser = parser; + m_parent = parent; + m_parser->setContentHandler(this); +} + +bool ModifiersHandler::startElement(const QString& /* namespaceURI */, + const QString& localName, + const QString& /* qName */, + const QXmlAttributes& attr) +{ + if(localName == "define"){ + /* 変数初期化 */ + m_type = QString::null; + m_code = 0; + m_mask = 0; + m_release.clear(); + m_toggle = false; + m_mapping = false; + for(int i=0; igetMask(attr.localName(i)); + } + } + } else if(localName == "release"){ + /* release keys */ + int code = 0; + for(int i=0; i 0){ + m_release.append(code); + } + } + return(true); +} + +bool ModifiersHandler::endElement(const QString& /* namespaceURI */, + const QString& localName, + const QString& /* qName */) +{ + if(localName == "define"){ + if(m_type != QString::null && m_code > 0){ + /* assign modifier */ + m_pModifiers->assign(m_type, m_code, m_mask, m_toggle); + for(QValueList::Iterator it=m_release.begin(); + it!=m_release.end(); ++it){ + /* assign modifier release keys */ + m_pModifiers->assignRelease(*it); + } + int code = KeyNames::getCode(m_type); + if(code <= 0){ + qDebug("setCode[%s][%x]", m_type.latin1(), m_code); + KeyNames::setCode(m_type, m_code); + } + if(m_mapping){ + /* auto mapping */ + m_pMappings->assign(m_code, m_mask, code, 0); + } + } + } else if(localName == "modifiers"){ + /* return parent */ + m_parser->setContentHandler(m_parent); + } + return(true); +} -- cgit v0.9.0.2