00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./dcopiface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int DCOPiface_fhash = 11;
00016 static const char* const DCOPiface_ftable[9][3] = {
00017 { "void", "reloadConfig()", "reloadConfig()" },
00018 { "void", "LaunchCreator()", "LaunchCreator()" },
00019 { "void", "Config()", "Config()" },
00020 { "void", "startNewKaramba()", "startNewKaramba()" },
00021 { "void", "editConfig()", "editConfig()" },
00022 { "void", "toggleHide()", "toggleHide()" },
00023 { "void", "slotMove(int,int)", "slotMove(int nx,int ny)" },
00024 { "void", "setActiveWin()", "setActiveWin()" },
00025 { 0, 0, 0 }
00026 };
00027 static const int DCOPiface_ftable_hiddens[8] = {
00028 0,
00029 0,
00030 0,
00031 0,
00032 0,
00033 0,
00034 0,
00035 0,
00036 };
00037
00038 bool DCOPiface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00039 {
00040 static QAsciiDict<int>* fdict = 0;
00041 if ( !fdict ) {
00042 fdict = new QAsciiDict<int>( DCOPiface_fhash, true, false );
00043 for ( int i = 0; DCOPiface_ftable[i][1]; i++ )
00044 fdict->insert( DCOPiface_ftable[i][1], new int( i ) );
00045 }
00046 int* fp = fdict->find( fun );
00047 switch ( fp?*fp:-1) {
00048 case 0: {
00049 replyType = DCOPiface_ftable[0][0];
00050 reloadConfig( );
00051 } break;
00052 case 1: {
00053 replyType = DCOPiface_ftable[1][0];
00054 LaunchCreator( );
00055 } break;
00056 case 2: {
00057 replyType = DCOPiface_ftable[2][0];
00058 Config( );
00059 } break;
00060 case 3: {
00061 replyType = DCOPiface_ftable[3][0];
00062 startNewKaramba( );
00063 } break;
00064 case 4: {
00065 replyType = DCOPiface_ftable[4][0];
00066 editConfig( );
00067 } break;
00068 case 5: {
00069 replyType = DCOPiface_ftable[5][0];
00070 toggleHide( );
00071 } break;
00072 case 6: {
00073 int arg0;
00074 int arg1;
00075 QDataStream arg( data, IO_ReadOnly );
00076 arg >> arg0;
00077 arg >> arg1;
00078 replyType = DCOPiface_ftable[6][0];
00079 slotMove(arg0, arg1 );
00080 } break;
00081 case 7: {
00082 replyType = DCOPiface_ftable[7][0];
00083 setActiveWin( );
00084 } break;
00085 default:
00086 return DCOPObject::process( fun, data, replyType, replyData );
00087 }
00088 return true;
00089 }
00090
00091 QCStringList DCOPiface::interfaces()
00092 {
00093 QCStringList ifaces = DCOPObject::interfaces();
00094 ifaces += "DCOPiface";
00095 return ifaces;
00096 }
00097
00098 QCStringList DCOPiface::functions()
00099 {
00100 QCStringList funcs = DCOPObject::functions();
00101 for ( int i = 0; DCOPiface_ftable[i][2]; i++ ) {
00102 if (DCOPiface_ftable_hiddens[i])
00103 continue;
00104 QCString func = DCOPiface_ftable[i][0];
00105 func += ' ';
00106 func += DCOPiface_ftable[i][2];
00107 funcs << func;
00108 }
00109 return funcs;
00110 }
00111
00112