kmail

kmailicalIface.h
1 /*
2  This file is part of KMail.
3  Copyright (c) 2003 Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
4  Copyright (c) 2003 - 2004 Bo Thorsen <bo@sonofthor.dk>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the TQt library by Trolltech AS, Norway (or with modified versions
24  of TQt that use the same license as TQt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  TQt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 #ifndef KMAILICALIFACE_H
33 #define KMAILICALIFACE_H
34 
35 #include <dcopobject.h>
36 #include <tqstringlist.h>
37 #include <kurl.h>
38 
39 // yes, this is this very header - but it tells dcopidl to include it
40 // in _stub.cpp and _skel.cpp files, to get the definition of the structs.
41 // ### dcopidlng bug: "" is copied verbatim...
42 // The kmail/ is so that it can be found by the resources easily
43 #include <kmail/kmailicalIface.h>
44 
45 class KMailICalIface : virtual public DCOPObject
46 {
47  K_DCOP
48 
49 public:
50 k_dcop:
51  struct SubResource {
52  //dcopidl barfs on those constructors, but dcopidlng works
53  SubResource() {} // for TQValueList
54  SubResource( const TQString& loc, const TQString& lab, bool rw, bool ar )
55  : location( loc ), label( lab ), writable( rw ), alarmRelevant( ar ) {}
56  TQString location; // unique
57  TQString label; // shown to the user
58  bool writable;
59  bool alarmRelevant;
60  };
61 
67  enum StorageFormat { StorageIcalVcard, StorageXML };
68 
70  enum FolderChanges { NoChange = 0, Contents = 1, ACL = 2 };
71 
72  virtual bool isWritableFolder( const TQString& type,
73  const TQString& resource ) = 0;
74 
75  virtual KMailICalIface::StorageFormat storageFormat( const TQString& resource ) = 0;
76 
77  virtual KURL getAttachment( const TQString& resource,
78  TQ_UINT32 sernum,
79  const TQString& filename ) = 0;
80  virtual TQString attachmentMimetype( const TQString &resource,
81  TQ_UINT32 sernum,
82  const TQString &filename ) = 0;
83 
84  virtual TQStringList listAttachments( const TQString &resource, TQ_UINT32 sernum ) = 0;
85 
88  virtual TQ_UINT32 update( const TQString& resource,
89  TQ_UINT32 sernum,
90  const TQString& subject,
91  const TQString& plainTextBody,
92  const TQMap<TQCString, TQString>& customHeaders,
93  const TQStringList& attachmentURLs,
94  const TQStringList& attachmentMimetypes,
95  const TQStringList& attachmentNames,
96  const TQStringList& deletedAttachments ) = 0;
97 
98  virtual bool deleteIncidenceKolab( const TQString& resource,
99  TQ_UINT32 sernum ) = 0;
100 
103  virtual int incidencesKolabCount( const TQString& mimetype /*ignored*/,
104  const TQString& resource ) = 0;
105 
106  virtual TQMap<TQ_UINT32, TQString> incidencesKolab( const TQString& mimetype,
107  const TQString& resource,
108  int startIndex,
109  int nbMessages ) = 0;
114  virtual TQValueList<KMailICalIface::SubResource> subresourcesKolab( const TQString& contentsType ) = 0;
115 
121  virtual bool addSubresource( const TQString& resource,
122  const TQString& parent,
123  const TQString& contentsType ) = 0;
128  virtual bool removeSubresource( const TQString& resource ) = 0;
129 
133  virtual int dimapAccounts() = 0;
134 
138  virtual bool triggerSync( const TQString & ) = 0;
139  virtual void changeResourceUIName( const TQString &folderPath, const TQString &newName ) = 0;
140 
141 k_dcop_signals:
142  void incidenceAdded( const TQString& type, const TQString& folder,
143  TQ_UINT32 sernum, int format, const TQString& entry );
144  void asyncLoadResult( const TQMap<TQ_UINT32, TQString>, const TQString& type,
145  const TQString& folder );
146  void incidenceDeleted( const TQString& type, const TQString& folder,
147  const TQString& uid );
148  void signalRefresh( const TQString& type, const TQString& folder );
149  void subresourceAdded( const TQString& type, const TQString& resource,
150  const TQString& label, bool writable, bool alarmRelevant );
151  void subresourceDeleted( const TQString& type, const TQString& resource );
152 };
153 
154 inline TQDataStream& operator<<( TQDataStream& str, const KMailICalIface::SubResource& subResource )
155 {
156  str << subResource.location << subResource.label << subResource.writable << subResource.alarmRelevant;
157  return str;
158 }
159 inline TQDataStream& operator>>( TQDataStream& str, KMailICalIface::SubResource& subResource )
160 {
161  str >> subResource.location >> subResource.label >> subResource.writable >> subResource.alarmRelevant;
162  return str;
163 }
164 
165 inline TQDataStream& operator<<( TQDataStream& str, const KMailICalIface::StorageFormat& format )
166 {
167  TQ_UINT32 foo = format;
168  str << foo;
169  return str;
170 }
171 
172 inline TQDataStream& operator>>( TQDataStream& str, KMailICalIface::StorageFormat& format )
173 {
174  TQ_UINT32 foo;
175  str >> foo;
176  format = ( KMailICalIface::StorageFormat )foo;
177  return str;
178 }
179 
180 
181 #endif