00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./kaddressbookiface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int KAddressBookIface_fhash = 11;
00016 static const char* const KAddressBookIface_ftable[10][3] = {
00017 { "void", "addEmail(QString)", "addEmail(QString addr)" },
00018 { "void", "importVCard(KURL)", "importVCard(KURL url)" },
00019 { "void", "importVCardFromData(QString)", "importVCardFromData(QString vCard)" },
00020 { "ASYNC", "showContactEditor(QString)", "showContactEditor(QString uid)" },
00021 { "void", "newContact()", "newContact()" },
00022 { "QString", "getNameByPhone(QString)", "getNameByPhone(QString phone)" },
00023 { "void", "save()", "save()" },
00024 { "void", "exit()", "exit()" },
00025 { "bool", "handleCommandLine()", "handleCommandLine()" },
00026 { 0, 0, 0 }
00027 };
00028 static const int KAddressBookIface_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 KAddressBookIface::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>( KAddressBookIface_fhash, true, false );
00045 for ( int i = 0; KAddressBookIface_ftable[i][1]; i++ )
00046 fdict->insert( KAddressBookIface_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 QDataStream arg( data, IO_ReadOnly );
00053 if (arg.atEnd()) return false;
00054 arg >> arg0;
00055 replyType = KAddressBookIface_ftable[0][0];
00056 addEmail(arg0 );
00057 } break;
00058 case 1: {
00059 KURL arg0;
00060 QDataStream arg( data, IO_ReadOnly );
00061 if (arg.atEnd()) return false;
00062 arg >> arg0;
00063 replyType = KAddressBookIface_ftable[1][0];
00064 importVCard(arg0 );
00065 } break;
00066 case 2: {
00067 QString arg0;
00068 QDataStream arg( data, IO_ReadOnly );
00069 if (arg.atEnd()) return false;
00070 arg >> arg0;
00071 replyType = KAddressBookIface_ftable[2][0];
00072 importVCardFromData(arg0 );
00073 } break;
00074 case 3: {
00075 QString arg0;
00076 QDataStream arg( data, IO_ReadOnly );
00077 if (arg.atEnd()) return false;
00078 arg >> arg0;
00079 replyType = KAddressBookIface_ftable[3][0];
00080 showContactEditor(arg0 );
00081 } break;
00082 case 4: {
00083 replyType = KAddressBookIface_ftable[4][0];
00084 newContact( );
00085 } break;
00086 case 5: {
00087 QString arg0;
00088 QDataStream arg( data, IO_ReadOnly );
00089 if (arg.atEnd()) return false;
00090 arg >> arg0;
00091 replyType = KAddressBookIface_ftable[5][0];
00092 QDataStream _replyStream( replyData, IO_WriteOnly );
00093 _replyStream << getNameByPhone(arg0 );
00094 } break;
00095 case 6: {
00096 replyType = KAddressBookIface_ftable[6][0];
00097 save( );
00098 } break;
00099 case 7: {
00100 replyType = KAddressBookIface_ftable[7][0];
00101 exit( );
00102 } break;
00103 case 8: {
00104 replyType = KAddressBookIface_ftable[8][0];
00105 QDataStream _replyStream( replyData, IO_WriteOnly );
00106 _replyStream << handleCommandLine( );
00107 } break;
00108 default:
00109 return DCOPObject::process( fun, data, replyType, replyData );
00110 }
00111 return true;
00112 }
00113
00114 QCStringList KAddressBookIface::interfaces()
00115 {
00116 QCStringList ifaces = DCOPObject::interfaces();
00117 ifaces += "KAddressBookIface";
00118 return ifaces;
00119 }
00120
00121 QCStringList KAddressBookIface::functions()
00122 {
00123 QCStringList funcs = DCOPObject::functions();
00124 for ( int i = 0; KAddressBookIface_ftable[i][2]; i++ ) {
00125 if (KAddressBookIface_ftable_hiddens[i])
00126 continue;
00127 QCString func = KAddressBookIface_ftable[i][0];
00128 func += ' ';
00129 func += KAddressBookIface_ftable[i][2];
00130 funcs << func;
00131 }
00132 return funcs;
00133 }
00134
00135