00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "../../../knotes/KNotesIface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int KNotesIface_fhash = 11;
00016 static const char* const KNotesIface_ftable[10][3] = {
00017 { "QString", "newNote(QString,QString)", "newNote(QString name,QString text)" },
00018 { "QString", "newNoteFromClipboard(QString)", "newNoteFromClipboard(QString name)" },
00019 { "ASYNC", "killNote(QString)", "killNote(QString noteId)" },
00020 { "ASYNC", "killNote(QString,bool)", "killNote(QString noteId,bool force)" },
00021 { "QMap<QString,QString>", "notes()", "notes()" },
00022 { "ASYNC", "setName(QString,QString)", "setName(QString noteId,QString newName)" },
00023 { "ASYNC", "setText(QString,QString)", "setText(QString noteId,QString newText)" },
00024 { "QString", "name(QString)", "name(QString noteId)" },
00025 { "QString", "text(QString)", "text(QString noteId)" },
00026 { 0, 0, 0 }
00027 };
00028 static const int KNotesIface_ftable_hiddens[9] = {
00029 0,
00030 0,
00031 0,
00032 0,
00033 0,
00034 0,
00035 0,
00036 0,
00037 0,
00038 };
00039
00040 bool KNotesIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00041 {
00042 static QAsciiDict<int>* fdict = 0;
00043 if ( !fdict ) {
00044 fdict = new QAsciiDict<int>( KNotesIface_fhash, true, false );
00045 for ( int i = 0; KNotesIface_ftable[i][1]; i++ )
00046 fdict->insert( KNotesIface_ftable[i][1], new int( i ) );
00047 }
00048 int* fp = fdict->find( fun );
00049 switch ( fp?*fp:-1) {
00050 case 0: {
00051 QString arg0;
00052 QString arg1;
00053 QDataStream arg( data, IO_ReadOnly );
00054 if (arg.atEnd()) return false;
00055 arg >> arg0;
00056 if (arg.atEnd()) return false;
00057 arg >> arg1;
00058 replyType = KNotesIface_ftable[0][0];
00059 QDataStream _replyStream( replyData, IO_WriteOnly );
00060 _replyStream << newNote(arg0, arg1 );
00061 } break;
00062 case 1: {
00063 QString arg0;
00064 QDataStream arg( data, IO_ReadOnly );
00065 if (arg.atEnd()) return false;
00066 arg >> arg0;
00067 replyType = KNotesIface_ftable[1][0];
00068 QDataStream _replyStream( replyData, IO_WriteOnly );
00069 _replyStream << newNoteFromClipboard(arg0 );
00070 } break;
00071 case 2: {
00072 QString arg0;
00073 QDataStream arg( data, IO_ReadOnly );
00074 if (arg.atEnd()) return false;
00075 arg >> arg0;
00076 replyType = KNotesIface_ftable[2][0];
00077 killNote(arg0 );
00078 } break;
00079 case 3: {
00080 QString arg0;
00081 bool arg1;
00082 QDataStream arg( data, IO_ReadOnly );
00083 if (arg.atEnd()) return false;
00084 arg >> arg0;
00085 if (arg.atEnd()) return false;
00086 arg >> arg1;
00087 replyType = KNotesIface_ftable[3][0];
00088 killNote(arg0, arg1 );
00089 } break;
00090 case 4: {
00091 replyType = KNotesIface_ftable[4][0];
00092 QDataStream _replyStream( replyData, IO_WriteOnly );
00093 _replyStream << notes( );
00094 } break;
00095 case 5: {
00096 QString arg0;
00097 QString arg1;
00098 QDataStream arg( data, IO_ReadOnly );
00099 if (arg.atEnd()) return false;
00100 arg >> arg0;
00101 if (arg.atEnd()) return false;
00102 arg >> arg1;
00103 replyType = KNotesIface_ftable[5][0];
00104 setName(arg0, arg1 );
00105 } break;
00106 case 6: {
00107 QString arg0;
00108 QString arg1;
00109 QDataStream arg( data, IO_ReadOnly );
00110 if (arg.atEnd()) return false;
00111 arg >> arg0;
00112 if (arg.atEnd()) return false;
00113 arg >> arg1;
00114 replyType = KNotesIface_ftable[6][0];
00115 setText(arg0, arg1 );
00116 } break;
00117 case 7: {
00118 QString arg0;
00119 QDataStream arg( data, IO_ReadOnly );
00120 if (arg.atEnd()) return false;
00121 arg >> arg0;
00122 replyType = KNotesIface_ftable[7][0];
00123 QDataStream _replyStream( replyData, IO_WriteOnly );
00124 _replyStream << name(arg0 );
00125 } break;
00126 case 8: {
00127 QString arg0;
00128 QDataStream arg( data, IO_ReadOnly );
00129 if (arg.atEnd()) return false;
00130 arg >> arg0;
00131 replyType = KNotesIface_ftable[8][0];
00132 QDataStream _replyStream( replyData, IO_WriteOnly );
00133 _replyStream << text(arg0 );
00134 } break;
00135 default:
00136 return DCOPObject::process( fun, data, replyType, replyData );
00137 }
00138 return true;
00139 }
00140
00141 QCStringList KNotesIface::interfaces()
00142 {
00143 QCStringList ifaces = DCOPObject::interfaces();
00144 ifaces += "KNotesIface";
00145 return ifaces;
00146 }
00147
00148 QCStringList KNotesIface::functions()
00149 {
00150 QCStringList funcs = DCOPObject::functions();
00151 for ( int i = 0; KNotesIface_ftable[i][2]; i++ ) {
00152 if (KNotesIface_ftable_hiddens[i])
00153 continue;
00154 QCString func = KNotesIface_ftable[i][0];
00155 func += ' ';
00156 func += KNotesIface_ftable[i][2];
00157 funcs << func;
00158 }
00159 return funcs;
00160 }
00161
00162