• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.1 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 
36 namespace Akonadi {
37 
38 class ResourceBasePrivate;
39 
145  // FIXME_API: API dox need to be updated for Observer approach (kevin)
146 class AKONADI_EXPORT ResourceBase : public AgentBase
147 {
148  Q_OBJECT
149 
150  public:
175  template <typename T>
176  static int init( int argc, char **argv )
177  {
178  const QString id = parseArguments( argc, argv );
179  KApplication app;
180  T* r = new T( id );
181 
182  // check if T also inherits AgentBase::Observer and
183  // if it does, automatically register it on itself
184  Observer *observer = dynamic_cast<Observer*>( r );
185  if ( observer != 0 )
186  r->registerObserver( observer );
187 
188  return init( r );
189  }
190 
194  void setName( const QString &name );
195 
199  QString name() const;
200 
213  void setAutomaticProgressReporting( bool enabled );
214 
215  Q_SIGNALS:
221  void nameChanged( const QString &name );
222 
226  void synchronized();
227 
234  void attributesSynchronized( qlonglong collectionId );
235 
241  void collectionTreeSynchronized();
242 
243  protected Q_SLOTS:
249  virtual void retrieveCollections() = 0;
250 
261  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
262  // in order to simulate polymorphism
263  void retrieveCollectionAttributes( const Akonadi::Collection &collection );
264 
278  virtual void retrieveItems( const Akonadi::Collection &collection ) = 0;
279 
289  virtual bool retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts ) = 0;
290 
296  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
297  // in order to simulate polymorphism
298  void abortActivity();
299 
304  // KDE5: Make it pure virtual, for now can be called only by invokeMethod()
305  // in order to simulate polymorphism
306  QString dumpResourceToString() const { return QString(); }
307 
308  protected:
314  ResourceBase( const QString & id );
315 
319  ~ResourceBase();
320 
326  void itemRetrieved( const Item &item );
327 
334  void collectionAttributesRetrieved( const Collection &collection );
335 
343  void changeCommitted( const Item &item );
344 
354  void changeCommitted( const Collection &collection );
355 
362  void collectionsRetrieved( const Collection::List &collections );
363 
371  void collectionsRetrievedIncremental( const Collection::List &changedCollections,
372  const Collection::List &removedCollections );
373 
381  void setCollectionStreamingEnabled( bool enable );
382 
391  void collectionsRetrievalDone();
392 
401  void itemsRetrieved( const Item::List &items );
402 
410  void setTotalItems( int amount );
411 
417  void setItemStreamingEnabled( bool enable );
418 
424  void setItemTransactionMode( ItemSync::TransactionMode mode );
425 
437  void setItemSynchronizationFetchScope( const ItemFetchScope &fetchScope );
438 
445  void itemsRetrievedIncremental( const Item::List &changedItems,
446  const Item::List &removedItems );
447 
457  void itemsRetrievalDone();
458 
468  void clearCache();
469 
478  void invalidateCache( const Collection &collection );
479 
485  Collection currentCollection() const;
486 
492  Item currentItem() const;
493 
497  void synchronize();
498 
503  void synchronizeCollection( qint64 id );
504 
510  void synchronizeCollection( qint64 id, bool recursive );
511 
519  void synchronizeCollectionAttributes( qint64 id );
520 
524  void synchronizeCollectionTree();
525 
529  void cancelTask();
530 
535  void cancelTask( const QString &error );
536 
549  void deferTask();
550 
554  void doSetOnline( bool online );
555 
566  void setHierarchicalRemoteIdentifiersEnabled( bool enable );
567 
568  friend class ResourceScheduler;
569  friend class ResourceState;
570 
578  enum SchedulePriority {
579  Prepend,
580  AfterChangeReplay,
581  Append
582  };
583 
599  void scheduleCustomTask( QObject* receiver, const char* method, const QVariant &argument, SchedulePriority priority = Append );
600 
607  void taskDone();
608 
613  QString dumpNotificationListToString() const;
614 
619  QString dumpSchedulerToString() const;
620 
621  private:
622  static QString parseArguments( int, char** );
623  static int init( ResourceBase *r );
624 
625  // dbus resource interface
626  friend class ::Akonadi__ResourceAdaptor;
627 
628  bool requestItemDelivery( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
629 
630  QString requestItemDeliveryV2( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
631 
632  private:
633  Q_DECLARE_PRIVATE( ResourceBase )
634 
635  Q_PRIVATE_SLOT( d_func(), void slotAbortRequested() )
636  Q_PRIVATE_SLOT( d_func(), void slotDeliveryDone( KJob* ) )
637  Q_PRIVATE_SLOT( d_func(), void slotCollectionSyncDone( KJob* ) )
638  Q_PRIVATE_SLOT( d_func(), void slotDeleteResourceCollection() )
639  Q_PRIVATE_SLOT( d_func(), void slotDeleteResourceCollectionDone( KJob* ) )
640  Q_PRIVATE_SLOT( d_func(), void slotCollectionDeletionDone( KJob* ) )
641  Q_PRIVATE_SLOT( d_func(), void slotInvalidateCache( const Akonadi::Collection& ) )
642  Q_PRIVATE_SLOT( d_func(), void slotLocalListDone( KJob* ) )
643  Q_PRIVATE_SLOT( d_func(), void slotSynchronizeCollection( const Akonadi::Collection& ) )
644  Q_PRIVATE_SLOT( d_func(), void slotCollectionListDone( KJob* ) )
645  Q_PRIVATE_SLOT( d_func(), void slotSynchronizeCollectionAttributes( const Akonadi::Collection& ) )
646  Q_PRIVATE_SLOT( d_func(), void slotCollectionListForAttributesDone( KJob* ) )
647  Q_PRIVATE_SLOT( d_func(), void slotCollectionAttributesSyncDone( KJob* ) )
648  Q_PRIVATE_SLOT( d_func(), void slotItemSyncDone( KJob* ) )
649  Q_PRIVATE_SLOT( d_func(), void slotPercent( KJob*, unsigned long ) )
650  Q_PRIVATE_SLOT( d_func(), void slotDelayedEmitProgress() )
651  Q_PRIVATE_SLOT( d_func(), void slotPrepareItemRetrieval( const Akonadi::Item& item ) )
652  Q_PRIVATE_SLOT( d_func(), void slotPrepareItemRetrievalResult( KJob* ) )
653  Q_PRIVATE_SLOT( d_func(), void changeCommittedResult( KJob* ) )
654  Q_PRIVATE_SLOT( d_func(), void slotSessionReconnected() )
655  Q_PRIVATE_SLOT( d_func(), void slotRecursiveMoveReplay( RecursiveMover* ) )
656  Q_PRIVATE_SLOT( d_func(), void slotRecursiveMoveReplayResult( KJob* ) )
657 };
658 
659 }
660 
661 #ifndef AKONADI_RESOURCE_MAIN
662 
665 #define AKONADI_RESOURCE_MAIN( resourceClass ) \
666  int main( int argc, char **argv ) \
667  { \
668  return Akonadi::ResourceBase::init<resourceClass>( argc, argv ); \
669  }
670 #endif
671 
672 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Wed Mar 27 2013 08:57:26 by doxygen 1.8.3 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.1 API Reference

Skip menu "kdepimlibs-4.10.1 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