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

akonadi

resourcescheduler.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_H
00021 #define AKONADI_RESOURCESCHEDULER_H
00022 
00023 #include <akonadi/agentbase.h>
00024 #include <akonadi/collection.h>
00025 #include <akonadi/item.h>
00026 
00027 #include <QtCore/QObject>
00028 #include <QtCore/QStringList>
00029 #include <QtDBus/QDBusMessage>
00030 
00031 namespace Akonadi {
00032 
00033 //@cond PRIVATE
00034 
00042 class ResourceScheduler : public QObject
00043 {
00044   Q_OBJECT
00045 
00046   public:
00047     enum TaskType {
00048       Invalid,
00049       SyncAll,
00050       SyncCollectionTree,
00051       SyncCollection,
00052       FetchItem,
00053       ChangeReplay
00054     };
00055 
00056     class Task {
00057       public:
00058         Task() : type( Invalid ) {}
00059         TaskType type;
00060         Collection collection;
00061         Item item;
00062         QSet<QByteArray> itemParts;
00063         QDBusMessage dbusMsg;
00064 
00065         bool operator==( const Task &other ) const
00066         {
00067           return type == other.type
00068               && collection == other.collection
00069               && item == other.item
00070               && itemParts == other.itemParts;
00071         }
00072     };
00073 
00074     ResourceScheduler( QObject *parent = 0 );
00075 
00079     void scheduleFullSync();
00080 
00084     void scheduleCollectionTreeSync();
00085 
00090     void scheduleSync( const Collection &col );
00091 
00098     void scheduleItemFetch( const Item &item, const QSet<QByteArray> &parts, const QDBusMessage &msg );
00099 
00103     void taskDone();
00104 
00108     bool isEmpty();
00109 
00113     Task currentTask() const;
00114 
00118     void setOnline( bool state );
00119 
00120   public Q_SLOTS:
00124     void scheduleChangeReplay();
00125 
00126   Q_SIGNALS:
00127     void executeFullSync();
00128     void executeCollectionSync( const Akonadi::Collection &col );
00129     void executeCollectionTreeSync();
00130     void executeItemFetch( const Akonadi::Item &item, const QSet<QByteArray> &parts );
00131     void executeChangeReplay();
00132     void status( int status, const QString &message = QString() );
00133 
00134   private slots:
00135     void scheduleNext();
00136     void executeNext();
00137 
00138   private:
00139     QList<Task> mTaskList;
00140     Task mCurrentTask;
00141     bool mOnline;
00142 };
00143 
00144 //@endcond
00145 
00146 }
00147 
00148 #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
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.8
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