00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./folderIface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014 namespace KMail {
00015
00016 static const int FolderIface_fhash = 11;
00017 static const char* const FolderIface_ftable[10][3] = {
00018 { "QString", "path()", "path()" },
00019 { "QString", "displayName()", "displayName()" },
00020 { "QString", "displayPath()", "displayPath()" },
00021 { "bool", "usesCustomIcons()", "usesCustomIcons()" },
00022 { "QString", "normalIconPath()", "normalIconPath()" },
00023 { "QString", "unreadIconPath()", "unreadIconPath()" },
00024 { "int", "messages()", "messages()" },
00025 { "int", "unreadMessages()", "unreadMessages()" },
00026 { "int", "unreadRecursiveMessages()", "unreadRecursiveMessages()" },
00027 { 0, 0, 0 }
00028 };
00029 static const int FolderIface_ftable_hiddens[9] = {
00030 0,
00031 0,
00032 0,
00033 0,
00034 0,
00035 0,
00036 0,
00037 0,
00038 0,
00039 };
00040
00041 bool FolderIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00042 {
00043 static QAsciiDict<int>* fdict = 0;
00044 if ( !fdict ) {
00045 fdict = new QAsciiDict<int>( FolderIface_fhash, true, false );
00046 for ( int i = 0; FolderIface_ftable[i][1]; i++ )
00047 fdict->insert( FolderIface_ftable[i][1], new int( i ) );
00048 }
00049 int* fp = fdict->find( fun );
00050 switch ( fp?*fp:-1) {
00051 case 0: {
00052 replyType = FolderIface_ftable[0][0];
00053 QDataStream _replyStream( replyData, IO_WriteOnly );
00054 _replyStream << path( );
00055 } break;
00056 case 1: {
00057 replyType = FolderIface_ftable[1][0];
00058 QDataStream _replyStream( replyData, IO_WriteOnly );
00059 _replyStream << displayName( );
00060 } break;
00061 case 2: {
00062 replyType = FolderIface_ftable[2][0];
00063 QDataStream _replyStream( replyData, IO_WriteOnly );
00064 _replyStream << displayPath( );
00065 } break;
00066 case 3: {
00067 replyType = FolderIface_ftable[3][0];
00068 QDataStream _replyStream( replyData, IO_WriteOnly );
00069 _replyStream << usesCustomIcons( );
00070 } break;
00071 case 4: {
00072 replyType = FolderIface_ftable[4][0];
00073 QDataStream _replyStream( replyData, IO_WriteOnly );
00074 _replyStream << normalIconPath( );
00075 } break;
00076 case 5: {
00077 replyType = FolderIface_ftable[5][0];
00078 QDataStream _replyStream( replyData, IO_WriteOnly );
00079 _replyStream << unreadIconPath( );
00080 } break;
00081 case 6: {
00082 replyType = FolderIface_ftable[6][0];
00083 QDataStream _replyStream( replyData, IO_WriteOnly );
00084 _replyStream << messages( );
00085 } break;
00086 case 7: {
00087 replyType = FolderIface_ftable[7][0];
00088 QDataStream _replyStream( replyData, IO_WriteOnly );
00089 _replyStream << unreadMessages( );
00090 } break;
00091 case 8: {
00092 replyType = FolderIface_ftable[8][0];
00093 QDataStream _replyStream( replyData, IO_WriteOnly );
00094 _replyStream << unreadRecursiveMessages( );
00095 } break;
00096 default:
00097 return DCOPObject::process( fun, data, replyType, replyData );
00098 }
00099 return true;
00100 }
00101
00102 QCStringList FolderIface::interfaces()
00103 {
00104 QCStringList ifaces = DCOPObject::interfaces();
00105 ifaces += "KMail::FolderIface";
00106 return ifaces;
00107 }
00108
00109 QCStringList FolderIface::functions()
00110 {
00111 QCStringList funcs = DCOPObject::functions();
00112 for ( int i = 0; FolderIface_ftable[i][2]; i++ ) {
00113 if (FolderIface_ftable_hiddens[i])
00114 continue;
00115 QCString func = FolderIface_ftable[i][0];
00116 func += ' ';
00117 func += FolderIface_ftable[i][2];
00118 funcs << func;
00119 }
00120 return funcs;
00121 }
00122
00123 }
00124