• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
resourcebase.h
1 /*
2  This file is part of akonadiresources.
3 
4  Copyright (c) 2006 Till Adam <adam@kde.org>
5  Copyright (c) 2007 Volker Krause <vkrause@kde.org>
6 
7  This library is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Library General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version.
11 
12  This library is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to the
19  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
23 #ifndef AKONADI_RESOURCEBASE_H
24 #define AKONADI_RESOURCEBASE_H
25 
26 #include "akonadi_export.h"
27 
28 #include <akonadi/agentbase.h>
29 #include <akonadi/collection.h>
30 #include <akonadi/item.h>
31 #include <akonadi/itemsync.h>
32 
33 class KJob;
34 class Akonadi__ResourceAdaptor;
35 class ResourceState;
36 
37 namespace Akonadi {
38 
39 class ResourceBasePrivate;
40 
146  // FIXME_API: API dox need to be updated for Observer approach (kevin)
147 class AKONADI_EXPORT ResourceBase : public AgentBase
148 {
149  Q_OBJECT
150 
151  public:
176  template <typename T>
177  static int init( int argc, char **argv )
178  {
179  const QString id = parseArguments( argc, argv );
180  KApplication app;
181  T* r = new T( id );
182 
183  // check if T also inherits AgentBase::Observer and
184  // if it does, automatically register it on itself
185  Observer *observer = dynamic_cast<Observer*>( r );
186  if ( observer != 0 )
187  r->registerObserver( observer );
188 
189  return init( r );
190  }
191 
195  void setName( const QString &name );
196 
200  QString name() const;
201 
214  void setAutomaticProgressReporting( bool enabled );
215 
216  Q_SIGNALS:
222  void nameChanged( const QString &name );
223 
227  void synchronized();
228 
235  void attributesSynchronized( qlonglong collectionId );
236 
242  void collectionTreeSynchronized();
243 
244  protected Q_SLOTS:
250  virtual void retrieveCollections() = 0;
251 
262  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
263  // in order to simulate polymorphism
264  void retrieveCollectionAttributes( const Akonadi::Collection &collection );
265 
279  virtual void retrieveItems( const Akonadi::Collection &collection ) = 0;
280 
290  virtual bool retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts ) = 0;
291 
297  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
298  // in order to simulate polymorphism
299  void abortActivity();
300 
305  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
306  // in order to simulate polymorphism
307  QString dumpResourceToString() const { return QString(); }
308 
309  protected:
315  ResourceBase( const QString & id );
316 
320  ~ResourceBase();
321 
327  void itemRetrieved( const Item &item );
328 
335  void collectionAttributesRetrieved( const Collection &collection );
336 
344  void changeCommitted( const Item &item );
345 
355  void changeCommitted( const Collection &collection );
356 
363  void collectionsRetrieved( const Collection::List &collections );
364 
372  void collectionsRetrievedIncremental( const Collection::List &changedCollections,
373  const Collection::List &removedCollections );
374 
382  void setCollectionStreamingEnabled( bool enable );
383 
392  void collectionsRetrievalDone();
393 
402  void itemsRetrieved( const Item::List &items );
403 
411  void setTotalItems( int amount );
412 
418  void setItemStreamingEnabled( bool enable );
419 
425  void setItemTransactionMode( ItemSync::TransactionMode mode );
426 
438  void setItemSynchronizationFetchScope( const ItemFetchScope &fetchScope );
439 
446  void itemsRetrievedIncremental( const Item::List &changedItems,
447  const Item::List &removedItems );
448 
458  void itemsRetrievalDone();
459 
469  void clearCache();
470 
479  void invalidateCache( const Collection &collection );
480 
486  Collection currentCollection() const;
487 
493  Item currentItem() const;
494 
498  void synchronize();
499 
504  void synchronizeCollection( qint64 id );
505 
511  void synchronizeCollection( qint64 id, bool recursive );
512 
520  void synchronizeCollectionAttributes( qint64 id );
521 
525  void synchronizeCollectionTree();
526 
530  void cancelTask();
531 
536  void cancelTask( const QString &error );
537 
550  void deferTask();
551 
555  void doSetOnline( bool online );
556 
567  void setHierarchicalRemoteIdentifiersEnabled( bool enable );
568 
569  friend class ResourceScheduler;
570  friend class ::ResourceState;
571 
579  enum SchedulePriority {
580  Prepend,
581  AfterChangeReplay,
582  Append
583  };
584 
600  void scheduleCustomTask( QObject* receiver, const char* method, const QVariant &argument, SchedulePriority priority = Append );
601 
608  void taskDone();
609 
614  QString dumpNotificationListToString() const;
615 
620  QString dumpSchedulerToString() const;
621 
622  private:
623  static QString parseArguments( int, char** );
624  static int init( ResourceBase *r );
625 
626  // dbus resource interface
627  friend class ::Akonadi__ResourceAdaptor;
628 
629  bool requestItemDelivery( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
630 
631  QString requestItemDeliveryV2( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
632 
633  private:
634  Q_DECLARE_PRIVATE( ResourceBase )
635 
636  Q_PRIVATE_SLOT( d_func(), void slotAbortRequested() )
637  Q_PRIVATE_SLOT( d_func(), void slotDeliveryDone( KJob* ) )
638  Q_PRIVATE_SLOT( d_func(), void slotCollectionSyncDone( KJob* ) )
639  Q_PRIVATE_SLOT( d_func(), void slotDeleteResourceCollection() )
640  Q_PRIVATE_SLOT( d_func(), void slotDeleteResourceCollectionDone( KJob* ) )
641  Q_PRIVATE_SLOT( d_func(), void slotCollectionDeletionDone( KJob* ) )
642  Q_PRIVATE_SLOT( d_func(), void slotInvalidateCache( const Akonadi::Collection& ) )
643  Q_PRIVATE_SLOT( d_func(), void slotLocalListDone( KJob* ) )
644  Q_PRIVATE_SLOT( d_func(), void slotSynchronizeCollection( const Akonadi::Collection& ) )
645  Q_PRIVATE_SLOT( d_func(), void slotCollectionListDone( KJob* ) )
646  Q_PRIVATE_SLOT( d_func(), void slotSynchronizeCollectionAttributes( const Akonadi::Collection& ) )
647  Q_PRIVATE_SLOT( d_func(), void slotCollectionListForAttributesDone( KJob* ) )
648  Q_PRIVATE_SLOT( d_func(), void slotCollectionAttributesSyncDone( KJob* ) )
649  Q_PRIVATE_SLOT( d_func(), void slotItemSyncDone( KJob* ) )
650  Q_PRIVATE_SLOT( d_func(), void slotPercent( KJob*, unsigned long ) )
651  Q_PRIVATE_SLOT( d_func(), void slotDelayedEmitProgress() )
652  Q_PRIVATE_SLOT( d_func(), void slotPrepareItemRetrieval( const Akonadi::Item& item ) )
653  Q_PRIVATE_SLOT( d_func(), void slotPrepareItemRetrievalResult( KJob* ) )
654  Q_PRIVATE_SLOT( d_func(), void changeCommittedResult( KJob* ) )
655  Q_PRIVATE_SLOT( d_func(), void slotSessionReconnected() )
656  Q_PRIVATE_SLOT( d_func(), void slotRecursiveMoveReplay( RecursiveMover* ) )
657  Q_PRIVATE_SLOT( d_func(), void slotRecursiveMoveReplayResult( KJob* ) )
658 };
659 
660 }
661 
662 #ifndef AKONADI_RESOURCE_MAIN
663 
666 #define AKONADI_RESOURCE_MAIN( resourceClass ) \
667  int main( int argc, char **argv ) \
668  { \
669  return Akonadi::ResourceBase::init<resourceClass>( argc, argv ); \
670  }
671 #endif
672 
673 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:40 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal