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 = 13;
00016 static const char* const KAddressBookIface_ftable[13][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 { "void", "newDistributionList()", "newDistributionList()" },
00023 { "QString", "getNameByPhone(QString)", "getNameByPhone(QString phone)" },
00024 { "void", "save()", "save()" },
00025 { "void", "exit()", "exit()" },
00026 { "bool", "handleCommandLine()", "handleCommandLine()" },
00027 { "void", "loadProfile(QString)", "loadProfile(QString path)" },
00028 { "void", "saveToProfile(QString)", "saveToProfile(QString path)" },
00029 { 0, 0, 0 }
00030 };
00031 static const int KAddressBookIface_ftable_hiddens[12] = {
00032 0,
00033 0,
00034 0,
00035 0,
00036 0,
00037 0,
00038 0,
00039 0,
00040 0,
00041 0,
00042 0,
00043 0,
00044 };
00045
00046 bool KAddressBookIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00047 {
00048 static QAsciiDict<int>* fdict = 0;
00049 if ( !fdict ) {
00050 fdict = new QAsciiDict<int>( KAddressBookIface_fhash, true, false );
00051 for ( int i = 0; KAddressBookIface_ftable[i][1]; i++ )
00052 fdict->insert( KAddressBookIface_ftable[i][1], new int( i ) );
00053 }
00054 int* fp = fdict->find( fun );
00055 switch ( fp?*fp:-1) {
00056 case 0: {
00057 QString arg0;
00058 QDataStream arg( data, IO_ReadOnly );
00059 if (arg.atEnd()) return false;
00060 arg >> arg0;
00061 replyType = KAddressBookIface_ftable[0][0];
00062 addEmail(arg0 );
00063 } break;
00064 case 1: {
00065 KURL arg0;
00066 QDataStream arg( data, IO_ReadOnly );
00067 if (arg.atEnd()) return false;
00068 arg >> arg0;
00069 replyType = KAddressBookIface_ftable[1][0];
00070 importVCard(arg0 );
00071 } break;
00072 case 2: {
00073 QString arg0;
00074 QDataStream arg( data, IO_ReadOnly );
00075 if (arg.atEnd()) return false;
00076 arg >> arg0;
00077 replyType = KAddressBookIface_ftable[2][0];
00078 importVCardFromData(arg0 );
00079 } break;
00080 case 3: {
00081 QString arg0;
00082 QDataStream arg( data, IO_ReadOnly );
00083 if (arg.atEnd()) return false;
00084 arg >> arg0;
00085 replyType = KAddressBookIface_ftable[3][0];
00086 showContactEditor(arg0 );
00087 } break;
00088 case 4: {
00089 replyType = KAddressBookIface_ftable[4][0];
00090 newContact( );
00091 } break;
00092 case 5: {
00093 replyType = KAddressBookIface_ftable[5][0];
00094 newDistributionList( );
00095 } break;
00096 case 6: {
00097 QString arg0;
00098 QDataStream arg( data, IO_ReadOnly );
00099 if (arg.atEnd()) return false;
00100 arg >> arg0;
00101 replyType = KAddressBookIface_ftable[6][0];
00102 QDataStream _replyStream( replyData, IO_WriteOnly );
00103 _replyStream << getNameByPhone(arg0 );
00104 } break;
00105 case 7: {
00106 replyType = KAddressBookIface_ftable[7][0];
00107 save( );
00108 } break;
00109 case 8: {
00110 replyType = KAddressBookIface_ftable[8][0];
00111 exit( );
00112 } break;
00113 case 9: {
00114 replyType = KAddressBookIface_ftable[9][0];
00115 QDataStream _replyStream( replyData, IO_WriteOnly );
00116 _replyStream << handleCommandLine( );
00117 } break;
00118 case 10: {
00119 QString arg0;
00120 QDataStream arg( data, IO_ReadOnly );
00121 if (arg.atEnd()) return false;
00122 arg >> arg0;
00123 replyType = KAddressBookIface_ftable[10][0];
00124 loadProfile(arg0 );
00125 } break;
00126 case 11: {
00127 QString arg0;
00128 QDataStream arg( data, IO_ReadOnly );
00129 if (arg.atEnd()) return false;
00130 arg >> arg0;
00131 replyType = KAddressBookIface_ftable[11][0];
00132 saveToProfile(arg0 );
00133 } break;
00134 default:
00135 return DCOPObject::process( fun, data, replyType, replyData );
00136 }
00137 return true;
00138 }
00139
00140 QCStringList KAddressBookIface::interfaces()
00141 {
00142 QCStringList ifaces = DCOPObject::interfaces();
00143 ifaces += "KAddressBookIface";
00144 return ifaces;
00145 }
00146
00147 QCStringList KAddressBookIface::functions()
00148 {
00149 QCStringList funcs = DCOPObject::functions();
00150 for ( int i = 0; KAddressBookIface_ftable[i][2]; i++ ) {
00151 if (KAddressBookIface_ftable_hiddens[i])
00152 continue;
00153 QCString func = KAddressBookIface_ftable[i][0];
00154 func += ' ';
00155 func += KAddressBookIface_ftable[i][2];
00156 funcs << func;
00157 }
00158 return funcs;
00159 }
00160
00161