home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmailicalIface.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-02-13  |  7.2 KB  |  176 lines

  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 Qt library by Trolltech AS, Norway (or with modified versions
  24.     of Qt that use the same license as Qt), 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.     Qt.  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 <qstringlist.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 QValueList
  54.     SubResource( const QString& loc, const QString& lab, bool rw, bool ar )
  55.       : location( loc ), label( lab ), writable( rw ), alarmRelevant( ar ) {}
  56.     QString location; // unique
  57.     QString label;    // shown to the user
  58.     bool writable;
  59.     bool alarmRelevant;
  60.   };
  61.  
  62.   /// The format of the mails containing other contents than actual mail
  63.   /// (like contacts, calendar etc.)
  64.   /// This is currently either ical/vcard, or XML.
  65.   /// For actual mail folders this simply to know which resource handles it
  66.   /// This enum matches the one defined in kmail.kcfg
  67.   enum StorageFormat { StorageIcalVcard, StorageXML };
  68.  
  69.   /// This bitfield indicates which changes have been made in a folder, at syncing time.
  70.   enum FolderChanges { NoChange = 0, Contents = 1, ACL = 2 };
  71.  
  72.   virtual bool isWritableFolder( const QString& type,
  73.                                  const QString& resource ) = 0;
  74.  
  75.   virtual KMailICalIface::StorageFormat storageFormat( const QString& resource ) = 0;
  76.  
  77.   virtual KURL getAttachment( const QString& resource,
  78.                               Q_UINT32 sernum,
  79.                               const QString& filename ) = 0;
  80.   virtual QString attachmentMimetype( const QString &resource,
  81.                                       Q_UINT32 sernum,
  82.                                       const QString &filename ) = 0;
  83.  
  84.   virtual QStringList listAttachments( const QString &resource, Q_UINT32 sernum ) = 0;
  85.  
  86.   /// Update a kolab storage entry. Returns the new mail serial number,
  87.   /// or 0 if something went wrong. Can be used for adding as well.
  88.   virtual Q_UINT32 update( const QString& resource,
  89.                            Q_UINT32 sernum,
  90.                            const QString& subject,
  91.                            const QString& plainTextBody,
  92.                            const QMap<QCString, QString>& customHeaders,
  93.                            const QStringList& attachmentURLs,
  94.                            const QStringList& attachmentMimetypes,
  95.                            const QStringList& attachmentNames,
  96.                            const QStringList& deletedAttachments ) = 0;
  97.  
  98.   virtual bool deleteIncidenceKolab( const QString& resource,
  99.                                      Q_UINT32 sernum ) = 0;
  100.  
  101.   /// Return the number of mails that need to be looked at by incidencesKolab.
  102.   /// This allows to call incidencesKolab in chunks.
  103.   virtual int incidencesKolabCount( const QString& mimetype /*ignored*/,
  104.                                     const QString& resource ) = 0;
  105.  
  106.   virtual QMap<Q_UINT32, QString> incidencesKolab( const QString& mimetype,
  107.                                                    const QString& resource,
  108.                                                    int startIndex,
  109.                                                    int nbMessages ) = 0;
  110.   /**
  111.    * Return list of subresources. @p contentsType is
  112.    * Mail, Calendar, Contact, Note, Task or Journal
  113.    */
  114.   virtual QValueList<KMailICalIface::SubResource> subresourcesKolab( const QString& contentsType ) = 0;
  115.  
  116.    /**
  117.    * Trigger the creation of a new resource folder with name @param resource
  118.    * under parent @param.
  119.    * @return success or failure
  120.    */
  121.   virtual bool addSubresource( const QString& resource,
  122.                                const QString& parent,
  123.                                const QString& contentsType ) = 0;
  124.   /**
  125.    * Trigger the deletion of a new resource folder with id @param resource.
  126.    * @return success or failure
  127.    */
  128.   virtual bool removeSubresource( const QString& resource ) = 0;
  129.  
  130.   /**
  131.    * Causes all resource folders of the given type to be synced with the server.
  132.    */
  133.   virtual bool triggerSync( const QString & ) = 0;
  134.  
  135. k_dcop_signals:
  136.   void incidenceAdded( const QString& type, const QString& folder,
  137.                        Q_UINT32 sernum, int format, const QString& entry );
  138.   void asyncLoadResult( const QMap<Q_UINT32, QString>, const QString& type,
  139.                         const QString& folder );
  140.   void incidenceDeleted( const QString& type, const QString& folder,
  141.                          const QString& uid );
  142.   void signalRefresh( const QString& type, const QString& folder );
  143.   void subresourceAdded( const QString& type, const QString& resource,
  144.                          const QString& label, bool writable, bool alarmRelevant );
  145.   void subresourceDeleted( const QString& type, const QString& resource );
  146. };
  147.  
  148. inline QDataStream& operator<<( QDataStream& str, const KMailICalIface::SubResource& subResource )
  149. {
  150.   str << subResource.location << subResource.label << subResource.writable << subResource.alarmRelevant;
  151.   return str;
  152. }
  153. inline QDataStream& operator>>( QDataStream& str, KMailICalIface::SubResource& subResource )
  154. {
  155.   str >> subResource.location >> subResource.label >> subResource.writable >> subResource.alarmRelevant;
  156.   return str;
  157. }
  158.  
  159. inline QDataStream& operator<<( QDataStream& str, const KMailICalIface::StorageFormat& format  )
  160. {
  161.   Q_UINT32 foo = format;
  162.   str << foo;
  163.   return str;
  164. }
  165.  
  166. inline QDataStream& operator>>( QDataStream& str, KMailICalIface::StorageFormat& format  )
  167. {
  168.   Q_UINT32 foo;
  169.   str >> foo;
  170.   format = ( KMailICalIface::StorageFormat )foo;
  171.   return str;
  172. }
  173.  
  174.  
  175. #endif
  176.