00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./karmdcopiface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int KarmDCOPIface_fhash = 17;
00016 static const char* const KarmDCOPIface_ftable[17][3] = {
00017 { "QString", "version()", "version()" },
00018 { "QString", "taskIdFromName(QString)", "taskIdFromName(QString taskName)" },
00019 { "int", "addTask(QString)", "addTask(QString taskName)" },
00020 { "QString", "setPerCentComplete(QString,int)", "setPerCentComplete(QString taskName,int perCent)" },
00021 { "int", "bookTime(QString,QString,long int)", "bookTime(QString taskId,QString iso8601StartDateTime,long int durationInMinutes)" },
00022 { "QString", "getError(int)", "getError(int karmErrorNumber)" },
00023 { "int", "totalMinutesForTaskId(QString)", "totalMinutesForTaskId(QString taskId)" },
00024 { "QString", "starttimerfor(QString)", "starttimerfor(QString taskname)" },
00025 { "QString", "stoptimerfor(QString)", "stoptimerfor(QString taskname)" },
00026 { "QString", "deletetodo()", "deletetodo()" },
00027 { "QString", "setpromptdelete(bool)", "setpromptdelete(bool prompt)" },
00028 { "bool", "getpromptdelete()", "getpromptdelete()" },
00029 { "QString", "exportcsvfile(QString,QString,QString,int,bool,bool,QString,QString)", "exportcsvfile(QString filename,QString from,QString to,int type,bool decimalMinutes,bool allTasks,QString delimiter,QString quote)" },
00030 { "QString", "importplannerfile(QString)", "importplannerfile(QString filename)" },
00031 { "bool", "save()", "save()" },
00032 { "void", "quit()", "quit()" },
00033 { 0, 0, 0 }
00034 };
00035 static const int KarmDCOPIface_ftable_hiddens[16] = {
00036 0,
00037 0,
00038 0,
00039 0,
00040 0,
00041 0,
00042 0,
00043 0,
00044 0,
00045 0,
00046 0,
00047 0,
00048 0,
00049 0,
00050 0,
00051 0,
00052 };
00053
00054 bool KarmDCOPIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00055 {
00056 static QAsciiDict<int>* fdict = 0;
00057 if ( !fdict ) {
00058 fdict = new QAsciiDict<int>( KarmDCOPIface_fhash, true, false );
00059 for ( int i = 0; KarmDCOPIface_ftable[i][1]; i++ )
00060 fdict->insert( KarmDCOPIface_ftable[i][1], new int( i ) );
00061 }
00062 int* fp = fdict->find( fun );
00063 switch ( fp?*fp:-1) {
00064 case 0: {
00065 replyType = KarmDCOPIface_ftable[0][0];
00066 QDataStream _replyStream( replyData, IO_WriteOnly );
00067 _replyStream << version( );
00068 } break;
00069 case 1: {
00070 QString arg0;
00071 QDataStream arg( data, IO_ReadOnly );
00072 if (arg.atEnd()) return false;
00073 arg >> arg0;
00074 replyType = KarmDCOPIface_ftable[1][0];
00075 QDataStream _replyStream( replyData, IO_WriteOnly );
00076 _replyStream << taskIdFromName(arg0 );
00077 } break;
00078 case 2: {
00079 QString arg0;
00080 QDataStream arg( data, IO_ReadOnly );
00081 if (arg.atEnd()) return false;
00082 arg >> arg0;
00083 replyType = KarmDCOPIface_ftable[2][0];
00084 QDataStream _replyStream( replyData, IO_WriteOnly );
00085 _replyStream << addTask(arg0 );
00086 } break;
00087 case 3: {
00088 QString arg0;
00089 int arg1;
00090 QDataStream arg( data, IO_ReadOnly );
00091 if (arg.atEnd()) return false;
00092 arg >> arg0;
00093 if (arg.atEnd()) return false;
00094 arg >> arg1;
00095 replyType = KarmDCOPIface_ftable[3][0];
00096 QDataStream _replyStream( replyData, IO_WriteOnly );
00097 _replyStream << setPerCentComplete(arg0, arg1 );
00098 } break;
00099 case 4: {
00100 QString arg0;
00101 QString arg1;
00102 long int arg2;
00103 QDataStream arg( data, IO_ReadOnly );
00104 if (arg.atEnd()) return false;
00105 arg >> arg0;
00106 if (arg.atEnd()) return false;
00107 arg >> arg1;
00108 if (arg.atEnd()) return false;
00109 arg >> arg2;
00110 replyType = KarmDCOPIface_ftable[4][0];
00111 QDataStream _replyStream( replyData, IO_WriteOnly );
00112 _replyStream << bookTime(arg0, arg1, arg2 );
00113 } break;
00114 case 5: {
00115 int arg0;
00116 QDataStream arg( data, IO_ReadOnly );
00117 if (arg.atEnd()) return false;
00118 arg >> arg0;
00119 replyType = KarmDCOPIface_ftable[5][0];
00120 QDataStream _replyStream( replyData, IO_WriteOnly );
00121 _replyStream << getError(arg0 );
00122 } break;
00123 case 6: {
00124 QString arg0;
00125 QDataStream arg( data, IO_ReadOnly );
00126 if (arg.atEnd()) return false;
00127 arg >> arg0;
00128 replyType = KarmDCOPIface_ftable[6][0];
00129 QDataStream _replyStream( replyData, IO_WriteOnly );
00130 _replyStream << totalMinutesForTaskId(arg0 );
00131 } break;
00132 case 7: {
00133 QString arg0;
00134 QDataStream arg( data, IO_ReadOnly );
00135 if (arg.atEnd()) return false;
00136 arg >> arg0;
00137 replyType = KarmDCOPIface_ftable[7][0];
00138 QDataStream _replyStream( replyData, IO_WriteOnly );
00139 _replyStream << starttimerfor(arg0 );
00140 } break;
00141 case 8: {
00142 QString arg0;
00143 QDataStream arg( data, IO_ReadOnly );
00144 if (arg.atEnd()) return false;
00145 arg >> arg0;
00146 replyType = KarmDCOPIface_ftable[8][0];
00147 QDataStream _replyStream( replyData, IO_WriteOnly );
00148 _replyStream << stoptimerfor(arg0 );
00149 } break;
00150 case 9: {
00151 replyType = KarmDCOPIface_ftable[9][0];
00152 QDataStream _replyStream( replyData, IO_WriteOnly );
00153 _replyStream << deletetodo( );
00154 } break;
00155 case 10: {
00156 bool arg0;
00157 QDataStream arg( data, IO_ReadOnly );
00158 if (arg.atEnd()) return false;
00159 arg >> arg0;
00160 replyType = KarmDCOPIface_ftable[10][0];
00161 QDataStream _replyStream( replyData, IO_WriteOnly );
00162 _replyStream << setpromptdelete(arg0 );
00163 } break;
00164 case 11: {
00165 replyType = KarmDCOPIface_ftable[11][0];
00166 QDataStream _replyStream( replyData, IO_WriteOnly );
00167 _replyStream << getpromptdelete( );
00168 } break;
00169 case 12: {
00170 QString arg0;
00171 QString arg1;
00172 QString arg2;
00173 int arg3;
00174 bool arg4;
00175 bool arg5;
00176 QString arg6;
00177 QString arg7;
00178 QDataStream arg( data, IO_ReadOnly );
00179 if (arg.atEnd()) return false;
00180 arg >> arg0;
00181 if (arg.atEnd()) return false;
00182 arg >> arg1;
00183 if (arg.atEnd()) return false;
00184 arg >> arg2;
00185 if (arg.atEnd()) return false;
00186 arg >> arg3;
00187 if (arg.atEnd()) return false;
00188 arg >> arg4;
00189 if (arg.atEnd()) return false;
00190 arg >> arg5;
00191 if (arg.atEnd()) return false;
00192 arg >> arg6;
00193 if (arg.atEnd()) return false;
00194 arg >> arg7;
00195 replyType = KarmDCOPIface_ftable[12][0];
00196 QDataStream _replyStream( replyData, IO_WriteOnly );
00197 _replyStream << exportcsvfile(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 );
00198 } break;
00199 case 13: {
00200 QString arg0;
00201 QDataStream arg( data, IO_ReadOnly );
00202 if (arg.atEnd()) return false;
00203 arg >> arg0;
00204 replyType = KarmDCOPIface_ftable[13][0];
00205 QDataStream _replyStream( replyData, IO_WriteOnly );
00206 _replyStream << importplannerfile(arg0 );
00207 } break;
00208 case 14: {
00209 replyType = KarmDCOPIface_ftable[14][0];
00210 QDataStream _replyStream( replyData, IO_WriteOnly );
00211 _replyStream << save( );
00212 } break;
00213 case 15: {
00214 replyType = KarmDCOPIface_ftable[15][0];
00215 quit( );
00216 } break;
00217 default:
00218 return DCOPObject::process( fun, data, replyType, replyData );
00219 }
00220 return true;
00221 }
00222
00223 QCStringList KarmDCOPIface::interfaces()
00224 {
00225 QCStringList ifaces = DCOPObject::interfaces();
00226 ifaces += "KarmDCOPIface";
00227 return ifaces;
00228 }
00229
00230 QCStringList KarmDCOPIface::functions()
00231 {
00232 QCStringList funcs = DCOPObject::functions();
00233 for ( int i = 0; KarmDCOPIface_ftable[i][2]; i++ ) {
00234 if (KarmDCOPIface_ftable_hiddens[i])
00235 continue;
00236 QCString func = KarmDCOPIface_ftable[i][0];
00237 func += ' ';
00238 func += KarmDCOPIface_ftable[i][2];
00239 funcs << func;
00240 }
00241 return funcs;
00242 }
00243
00244