akonadi
monitor.h
00001 /* 00002 Copyright (c) 2006 - 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_MONITOR_H 00021 #define AKONADI_MONITOR_H 00022 00023 #include <akonadi/collection.h> 00024 #include <akonadi/item.h> 00025 00026 #include <QtCore/QObject> 00027 00028 namespace Akonadi { 00029 00030 class CollectionFetchScope; 00031 class CollectionStatistics; 00032 class Item; 00033 class ItemFetchScope; 00034 class MonitorPrivate; 00035 class Session; 00036 00069 class AKONADI_EXPORT Monitor : public QObject 00070 { 00071 Q_OBJECT 00072 00073 public: 00079 explicit Monitor( QObject *parent = 0 ); 00080 00084 virtual ~Monitor(); 00085 00101 void setCollectionMonitored( const Collection &collection, bool monitored = true ); 00102 00112 void setItemMonitored( const Item &item, bool monitored = true ); 00113 00125 void setResourceMonitored( const QByteArray &resource, bool monitored = true ); 00126 00140 void setMimeTypeMonitored( const QString &mimetype, bool monitored = true ); 00141 00148 void setAllMonitored( bool monitored = true ); 00149 00156 void ignoreSession( Session *session ); 00157 00163 void fetchCollection( bool enable ); 00164 00171 void fetchCollectionStatistics( bool enable ); 00172 00183 void setItemFetchScope( const ItemFetchScope &fetchScope ); 00184 00197 ItemFetchScope &itemFetchScope(); 00198 00210 void setCollectionFetchScope( const CollectionFetchScope &fetchScope ); 00211 00225 CollectionFetchScope &collectionFetchScope(); 00226 00232 Collection::List collectionsMonitored() const; 00233 00241 KDE_DEPRECATED QList<Item::Id> itemsMonitored() const; 00242 00250 QVector<Item::Id> itemsMonitoredEx() const; 00251 00257 QStringList mimeTypesMonitored() const; 00258 00264 QList<QByteArray> resourcesMonitored() const; 00265 00271 bool isAllMonitored() const; 00272 00279 void setSession( Akonadi::Session *session ); 00280 00286 Session* session() const; 00287 00288 Q_SIGNALS: 00295 void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers ); 00296 00304 void itemMoved( const Akonadi::Item &item, const Akonadi::Collection &collectionSource, 00305 const Akonadi::Collection &collectionDestination ); 00306 00313 void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00314 00323 void itemRemoved( const Akonadi::Item &item ); 00324 00332 void itemLinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00333 00341 void itemUnlinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00342 00349 void collectionAdded( const Akonadi::Collection &collection, const Akonadi::Collection &parent ); 00350 00356 void collectionChanged( const Akonadi::Collection &collection ); 00357 00366 void collectionChanged( const Akonadi::Collection &collection, const QSet<QByteArray> &attributeNames ); 00367 00377 void collectionMoved( const Akonadi::Collection &collection, const Akonadi::Collection &source, const Akonadi::Collection &destination ); 00378 00384 void collectionRemoved( const Akonadi::Collection &collection ); 00385 00396 void collectionSubscribed( const Akonadi::Collection& collection, const Akonadi::Collection &parent ); 00397 00405 void collectionUnsubscribed( const Akonadi::Collection& collection ); 00406 00415 void collectionStatisticsChanged( Akonadi::Collection::Id id, 00416 const Akonadi::CollectionStatistics &statistics ); 00417 00425 void collectionMonitored( const Akonadi::Collection &collection, bool monitored ); 00426 00434 void itemMonitored( const Akonadi::Item &item, bool monitored ); 00435 00443 void resourceMonitored( const QByteArray &identifier, bool monitored ); 00444 00452 void mimeTypeMonitored( const QString &mimeType, bool monitored ); 00453 00460 void allMonitored( bool monitored ); 00461 00462 protected: 00463 //@cond PRIVATE 00464 friend class EntityTreeModel; 00465 friend class EntityTreeModelPrivate; 00466 MonitorPrivate *d_ptr; 00467 explicit Monitor( MonitorPrivate *d, QObject *parent = 0 ); 00468 //@endcond 00469 00470 private: 00471 Q_DECLARE_PRIVATE( Monitor ) 00472 00473 //@cond PRIVATE 00474 Q_PRIVATE_SLOT( d_ptr, void slotSessionDestroyed( QObject* ) ) 00475 Q_PRIVATE_SLOT( d_ptr, void slotStatisticsChangedFinished( KJob* ) ) 00476 Q_PRIVATE_SLOT( d_ptr, void slotFlushRecentlyChangedCollections() ) 00477 Q_PRIVATE_SLOT( d_ptr, void slotNotify( const Akonadi::NotificationMessage::List& ) ) 00478 Q_PRIVATE_SLOT( d_ptr, void dataAvailable() ) 00479 Q_PRIVATE_SLOT( d_ptr, void serverStateChanged( Akonadi::ServerManager::State ) ) 00480 00481 friend class ResourceBasePrivate; 00482 //@endcond 00483 }; 00484 00485 } 00486 00487 #endif