kmailicalIface.h
00001 /* 00002 This file is part of KMail. 00003 Copyright (c) 2003 Steffen Hansen <steffen@klaralvdalens-datakonsult.se> 00004 Copyright (c) 2003 - 2004 Bo Thorsen <bo@sonofthor.dk> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 00021 In addition, as a special exception, the copyright holders give 00022 permission to link the code of this program with any edition of 00023 the TQt library by Trolltech AS, Norway (or with modified versions 00024 of TQt that use the same license as TQt), and distribute linked 00025 combinations including the two. You must obey the GNU General 00026 Public License in all respects for all of the code used other than 00027 TQt. If you modify this file, you may extend this exception to 00028 your version of the file, but you are not obligated to do so. If 00029 you do not wish to do so, delete this exception statement from 00030 your version. 00031 */ 00032 #ifndef KMAILICALIFACE_H 00033 #define KMAILICALIFACE_H 00034 00035 #include <dcopobject.h> 00036 #include <tqstringlist.h> 00037 #include <kurl.h> 00038 00039 // yes, this is this very header - but it tells dcopidl to include it 00040 // in _stub.cpp and _skel.cpp files, to get the definition of the structs. 00041 // ### dcopidlng bug: "" is copied verbatim... 00042 // The kmail/ is so that it can be found by the resources easily 00043 #include <kmail/kmailicalIface.h> 00044 00045 class KMailICalIface : virtual public DCOPObject 00046 { 00047 K_DCOP 00048 00049 public: 00050 k_dcop: 00051 struct SubResource { 00052 //dcopidl barfs on those constructors, but dcopidlng works 00053 SubResource() {} // for TQValueList 00054 SubResource( const TQString& loc, const TQString& lab, bool rw, bool ar ) 00055 : location( loc ), label( lab ), writable( rw ), alarmRelevant( ar ) {} 00056 TQString location; // unique 00057 TQString label; // shown to the user 00058 bool writable; 00059 bool alarmRelevant; 00060 }; 00061 00067 enum StorageFormat { StorageIcalVcard, StorageXML }; 00068 00070 enum FolderChanges { NoChange = 0, Contents = 1, ACL = 2 }; 00071 00072 virtual bool isWritableFolder( const TQString& type, 00073 const TQString& resource ) = 0; 00074 00075 virtual KMailICalIface::StorageFormat storageFormat( const TQString& resource ) = 0; 00076 00077 virtual KURL getAttachment( const TQString& resource, 00078 TQ_UINT32 sernum, 00079 const TQString& filename ) = 0; 00080 virtual TQString attachmentMimetype( const TQString &resource, 00081 TQ_UINT32 sernum, 00082 const TQString &filename ) = 0; 00083 00084 virtual TQStringList listAttachments( const TQString &resource, TQ_UINT32 sernum ) = 0; 00085 00088 virtual TQ_UINT32 update( const TQString& resource, 00089 TQ_UINT32 sernum, 00090 const TQString& subject, 00091 const TQString& plainTextBody, 00092 const TQMap<TQCString, TQString>& customHeaders, 00093 const TQStringList& attachmentURLs, 00094 const TQStringList& attachmentMimetypes, 00095 const TQStringList& attachmentNames, 00096 const TQStringList& deletedAttachments ) = 0; 00097 00098 virtual bool deleteIncidenceKolab( const TQString& resource, 00099 TQ_UINT32 sernum ) = 0; 00100 00103 virtual int incidencesKolabCount( const TQString& mimetype /*ignored*/, 00104 const TQString& resource ) = 0; 00105 00106 virtual TQMap<TQ_UINT32, TQString> incidencesKolab( const TQString& mimetype, 00107 const TQString& resource, 00108 int startIndex, 00109 int nbMessages ) = 0; 00114 virtual TQValueList<KMailICalIface::SubResource> subresourcesKolab( const TQString& contentsType ) = 0; 00115 00121 virtual bool addSubresource( const TQString& resource, 00122 const TQString& parent, 00123 const TQString& contentsType ) = 0; 00128 virtual bool removeSubresource( const TQString& resource ) = 0; 00129 00133 virtual int dimapAccounts() = 0; 00134 00138 virtual bool triggerSync( const TQString & ) = 0; 00139 virtual void changeResourceUIName( const TQString &folderPath, const TQString &newName ) = 0; 00140 00141 k_dcop_signals: 00142 void incidenceAdded( const TQString& type, const TQString& folder, 00143 TQ_UINT32 sernum, int format, const TQString& entry ); 00144 void asyncLoadResult( const TQMap<TQ_UINT32, TQString>, const TQString& type, 00145 const TQString& folder ); 00146 void incidenceDeleted( const TQString& type, const TQString& folder, 00147 const TQString& uid ); 00148 void signalRefresh( const TQString& type, const TQString& folder ); 00149 void subresourceAdded( const TQString& type, const TQString& resource, 00150 const TQString& label, bool writable, bool alarmRelevant ); 00151 void subresourceDeleted( const TQString& type, const TQString& resource ); 00152 }; 00153 00154 inline TQDataStream& operator<<( TQDataStream& str, const KMailICalIface::SubResource& subResource ) 00155 { 00156 str << subResource.location << subResource.label << subResource.writable << subResource.alarmRelevant; 00157 return str; 00158 } 00159 inline TQDataStream& operator>>( TQDataStream& str, KMailICalIface::SubResource& subResource ) 00160 { 00161 str >> subResource.location >> subResource.label >> subResource.writable >> subResource.alarmRelevant; 00162 return str; 00163 } 00164 00165 inline TQDataStream& operator<<( TQDataStream& str, const KMailICalIface::StorageFormat& format ) 00166 { 00167 TQ_UINT32 foo = format; 00168 str << foo; 00169 return str; 00170 } 00171 00172 inline TQDataStream& operator>>( TQDataStream& str, KMailICalIface::StorageFormat& format ) 00173 { 00174 TQ_UINT32 foo; 00175 str >> foo; 00176 format = ( KMailICalIface::StorageFormat )foo; 00177 return str; 00178 } 00179 00180 00181 #endif