summaryrefslogtreecommitdiff
path: root/noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp
authoralwin <alwin>2005-02-28 09:40:30 (UTC)
committer alwin <alwin>2005-02-28 09:40:30 (UTC)
commit2b64a84d39eeed5681d0ee5068c7d11a01527750 (patch) (side-by-side diff)
treec8693340dbc5ef5e2f9afa90b690829ddff2c4bd /noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp
parent61fa699140c5efbb6ba0bf2a62f7e8fbf62976be (diff)
downloadopie-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/anylnk/QCopLnk.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp b/noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp
new file mode 100644
index 0000000..991bf87
--- a/dev/null
+++ b/noncore/applets/keyhelper/keyhelperapplet/anylnk/QCopLnk.cpp
@@ -0,0 +1,63 @@
+#include "QCopLnk.h"
+#include "StringParser.h"
+
+void QCopLnk::execute()
+{
+ parseText();
+ //QStringList argList = KHUtil::parseArgs(m_params[1]);
+ QStringList argList = StringParser::split(' ', m_params[1]);
+ if(argList.count() < 2){
+ return;
+ }
+ QStringList paramList =
+ QStringList::split(QRegExp("[(),]"), argList[1]);
+ if(argList.count() < paramList.count()+1){
+ return;
+ }
+ paramList.remove(paramList.begin());
+ if(paramList.count() == 0){
+ /* send qcop message */
+ QCopEnvelope env(argList[0].latin1(), argList[1].latin1());
+ } else {
+ QCopEnvelope* e = NULL;
+ QStringList::Iterator it=paramList.end();
+ for(unsigned int index = 2; index<argList.count(); index++){
+ if(it == paramList.end()){
+ if(argList.count() - index < paramList.count()){
+ break;
+ }
+ /* initialize */
+ it = paramList.begin();
+ e = new QCopEnvelope(
+ argList[0].latin1(), argList[1].latin1());
+ }
+ QString arg = argList[index];
+ if(*it == "QString"){
+ *e << arg;
+ } else if(*it == "int"){
+ *e << arg.toInt();
+ } else if(*it == "bool"){
+ QString s = arg.lower();
+ int on;
+ if(s == "true"){
+ on = TRUE;
+ } else if(s == "false"){
+ on = FALSE;
+ } else {
+ on = s.toInt();
+ }
+ *e << on;
+ }
+ ++it;
+ if(it == paramList.end()){
+ /* send qcop message */
+ delete e;
+ if(argList.count() - index >= paramList.count()){
+ e = new QCopEnvelope(
+ argList[0].latin1(), argList[1].latin1());
+ it = paramList.begin();
+ }
+ }
+ }
+ }
+}