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[9][3] = {
00017 { "void", "addEmail(QString)", "addEmail(QString addr)" },
00018 { "void", "importVCard(QString)", "importVCard(QString vCardURL)" },
00019 { "ASYNC", "showContactEditor(QString)", "showContactEditor(QString uid)" },
00020 { "void", "newContact()", "newContact()" },
00021 { "QString", "getNameByPhone(QString)", "getNameByPhone(QString phone)" },
00022 { "void", "save()", "save()" },
00023 { "void", "exit()", "exit()" },
00024 { "bool", "handleCommandLine()", "handleCommandLine()" },
00025 { 0, 0, 0 }
00026 };
00027 static const int KAddressBookIface_ftable_hiddens[8] = {
00028 0,
00029 0,
00030 0,
00031 0,
00032 0,
00033 0,
00034 0,
00035 0,
00036 };
00037
00038 bool KAddressBookIface::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>( KAddressBookIface_fhash, true, false );
00043 for ( int i = 0; KAddressBookIface_ftable[i][1]; i++ )
00044 fdict->insert( KAddressBookIface_ftable[i][1], new int( i ) );
00045 }
00046 int* fp = fdict->find( fun );
00047 switch ( fp?*fp:-1) {
00048 case 0: {
00049 QString arg0;
00050 QDataStream arg( data, IO_ReadOnly );
00051 arg >> arg0;
00052 replyType = KAddressBookIface_ftable[0][0];
00053 addEmail(arg0 );
00054 } break;
00055 case 1: {
00056 QString arg0;
00057 QDataStream arg( data, IO_ReadOnly );
00058 arg >> arg0;
00059 replyType = KAddressBookIface_ftable[1][0];
00060 importVCard(arg0 );
00061 } break;
00062 case 2: {
00063 QString arg0;
00064 QDataStream arg( data, IO_ReadOnly );
00065 arg >> arg0;
00066 replyType = KAddressBookIface_ftable[2][0];
00067 showContactEditor(arg0 );
00068 } break;
00069 case 3: {
00070 replyType = KAddressBookIface_ftable[3][0];
00071 newContact( );
00072 } break;
00073 case 4: {
00074 QString arg0;
00075 QDataStream arg( data, IO_ReadOnly );
00076 arg >> arg0;
00077 replyType = KAddressBookIface_ftable[4][0];
00078 QDataStream _replyStream( replyData, IO_WriteOnly );
00079 _replyStream << getNameByPhone(arg0 );
00080 } break;
00081 case 5: {
00082 replyType = KAddressBookIface_ftable[5][0];
00083 save( );
00084 } break;
00085 case 6: {
00086 replyType = KAddressBookIface_ftable[6][0];
00087 exit( );
00088 } break;
00089 case 7: {
00090 replyType = KAddressBookIface_ftable[7][0];
00091 QDataStream _replyStream( replyData, IO_WriteOnly );
00092 _replyStream << handleCommandLine( );
00093 } break;
00094 default:
00095 return DCOPObject::process( fun, data, replyType, replyData );
00096 }
00097 return true;
00098 }
00099
00100 QCStringList KAddressBookIface::interfaces()
00101 {
00102 QCStringList ifaces = DCOPObject::interfaces();
00103 ifaces += "KAddressBookIface";
00104 return ifaces;
00105 }
00106
00107 QCStringList KAddressBookIface::functions()
00108 {
00109 QCStringList funcs = DCOPObject::functions();
00110 for ( int i = 0; KAddressBookIface_ftable[i][2]; i++ ) {
00111 if (KAddressBookIface_ftable_hiddens[i])
00112 continue;
00113 QCString func = KAddressBookIface_ftable[i][0];
00114 func += ' ';
00115 func += KAddressBookIface_ftable[i][2];
00116 funcs << func;
00117 }
00118 return funcs;
00119 }
00120
00121