• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi

resourcescheduler_p.h

00001 /*
00002     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #ifndef AKONADI_RESOURCESCHEDULER_P_H
00021 #define AKONADI_RESOURCESCHEDULER_P_H
00022 
00023 #include <akonadi/agentbase.h>
00024 #include <akonadi/collection.h>
00025 #include <akonadi/item.h>
00026 #include <akonadi/resourcebase.h>
00027 
00028 #include <QtCore/QObject>
00029 #include <QtCore/QStringList>
00030 #include <QtDBus/QDBusMessage>
00031 
00032 namespace Akonadi {
00033 
00034 //@cond PRIVATE
00035 
00043 class ResourceScheduler : public QObject
00044 {
00045   Q_OBJECT
00046 
00047   public:
00048     enum TaskType {
00049       Invalid,
00050       SyncAll,
00051       SyncCollectionTree,
00052       SyncCollection,
00053       FetchItem,
00054       ChangeReplay,
00055       DeleteResourceCollection,
00056       SyncAllDone,
00057       Custom
00058     };
00059 
00060     class Task {
00061       static qint64 latestSerial;
00062 
00063       public:
00064         Task() : serial( ++latestSerial ), type( Invalid ), receiver( 0 ) {}
00065         qint64 serial;
00066         TaskType type;
00067         Collection collection;
00068         Item item;
00069         QSet<QByteArray> itemParts;
00070         QDBusMessage dbusMsg;
00071         QObject *receiver;
00072         QByteArray methodName;
00073         QVariant argument;
00074 
00075         bool operator==( const Task &other ) const
00076         {
00077           return type == other.type
00078               && (collection == other.collection || (!collection.isValid() && !other.collection.isValid()))
00079               && (item == other.item || (!item.isValid() && !other.item.isValid()))
00080               && itemParts == other.itemParts
00081               && receiver == other.receiver
00082               && methodName == other.methodName
00083               && argument == other.argument;
00084         }
00085     };
00086 
00087     ResourceScheduler( QObject *parent = 0 );
00088 
00092     void scheduleFullSync();
00093 
00097     void scheduleCollectionTreeSync();
00098 
00103     void scheduleSync( const Collection &col );
00104 
00111     void scheduleItemFetch( const Item &item, const QSet<QByteArray> &parts, const QDBusMessage &msg );
00112 
00117     void scheduleResourceCollectionDeletion();
00118 
00122     void scheduleFullSyncCompletion();
00123 
00128     void scheduleCustomTask( QObject *receiver, const char *methodName, const QVariant &argument, ResourceBase::SchedulePriority priority = ResourceBase::Append );
00129 
00133     bool isEmpty();
00134 
00138     Task currentTask() const;
00139 
00143     void setOnline( bool state );
00144 
00145   public Q_SLOTS:
00149     void scheduleChangeReplay();
00150 
00154     void taskDone();
00155 
00159     void deferTask();
00160 
00164     void collectionRemoved( const Akonadi::Collection &collection );
00165 
00166   Q_SIGNALS:
00167     void executeFullSync();
00168     void executeCollectionSync( const Akonadi::Collection &col );
00169     void executeCollectionTreeSync();
00170     void executeItemFetch( const Akonadi::Item &item, const QSet<QByteArray> &parts );
00171     void executeResourceCollectionDeletion();
00172     void executeChangeReplay();
00173     void fullSyncComplete();
00174     void status( int status, const QString &message = QString() );
00175 
00176   private slots:
00177     void scheduleNext();
00178     void executeNext();
00179 
00180   private:
00181     void signalTaskToTracker( const Task &task, const QByteArray &taskType );
00182 
00183     QList<Task> mTaskList;
00184     Task mCurrentTask;
00185     bool mOnline;
00186 };
00187 
00188 //@endcond
00189 
00190 }
00191 
00192 #endif

akonadi

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal