Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QCopLnk.cpp

Go to the documentation of this file.
00001 #include "QCopLnk.h"
00002 #include "StringParser.h"
00003 
00004 void QCopLnk::execute()
00005 {
00006         parseText();
00007         //QStringList argList = KHUtil::parseArgs(m_params[1]);
00008         QStringList argList = StringParser::split(' ', m_params[1]);
00009         if(argList.count() < 2){
00010                 return;
00011         }
00012         QStringList paramList =
00013                 QStringList::split(QRegExp("[(),]"), argList[1]);
00014         if(argList.count() < paramList.count()+1){
00015                 return;
00016         }
00017         paramList.remove(paramList.begin());
00018         if(paramList.count() == 0){
00019                 /* send qcop message */
00020                 QCopEnvelope env(argList[0].latin1(), argList[1].latin1());
00021         } else {
00022                 QCopEnvelope* e = NULL;
00023                 QStringList::Iterator it=paramList.end();
00024                 for(unsigned int index = 2; index<argList.count(); index++){
00025                         if(it == paramList.end()){
00026                                 if(argList.count() - index < paramList.count()){
00027                                         break;
00028                                 }
00029                                 /* initialize */
00030                                 it = paramList.begin();
00031                                 e = new QCopEnvelope(
00032                                         argList[0].latin1(), argList[1].latin1());
00033                         }
00034                         QString arg = argList[index];
00035                         if(*it == "QString"){
00036                                 *e << arg;
00037                         } else if(*it == "int"){
00038                                 *e << arg.toInt();
00039                         } else if(*it == "bool"){
00040                                 QString s = arg.lower();
00041                                 int on;
00042                                 if(s == "true"){
00043                                         on = TRUE;
00044                                 } else if(s == "false"){
00045                                         on = FALSE;
00046                                 } else {
00047                                         on = s.toInt();
00048                                 }
00049                                 *e << on;
00050                         }
00051                         ++it;
00052                         if(it == paramList.end()){
00053                                 /* send qcop message */
00054                                 delete e;
00055                                 if(argList.count() - index >= paramList.count()){
00056                                         e = new QCopEnvelope(
00057                                                 argList[0].latin1(), argList[1].latin1());
00058                                         it = paramList.begin();
00059                                 }
00060                         }
00061                 }
00062         }
00063 }

Generated on Sat Nov 5 16:16:42 2005 for OPIE by  doxygen 1.4.2