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

akonadi

monitor.cpp

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 #include "monitor.h"
00021 #include "monitor_p.h"
00022 
00023 #include "itemfetchjob.h"
00024 #include "notificationmessage_p.h"
00025 #include "session.h"
00026 
00027 #include <kdebug.h>
00028 
00029 #include <QtDBus/QDBusInterface>
00030 #include <QtDBus/QDBusConnection>
00031 
00032 #include <QtCore/QDebug>
00033 #include <QtCore/QTimer>
00034 #include "collectionfetchscope.h"
00035 
00036 using namespace Akonadi;
00037 
00038 #define d d_ptr
00039 
00040 Monitor::Monitor( QObject *parent ) :
00041     QObject( parent ),
00042     d_ptr( new MonitorPrivate( this ) )
00043 {
00044   d_ptr->init();
00045   d_ptr->connectToNotificationManager();
00046 }
00047 
00048 //@cond PRIVATE
00049 Monitor::Monitor(MonitorPrivate * d, QObject *parent) :
00050     QObject( parent ),
00051     d_ptr( d )
00052 {
00053 }
00054 //@endcond
00055 
00056 Monitor::~Monitor()
00057 {
00058   delete d;
00059 }
00060 
00061 void Monitor::setCollectionMonitored( const Collection &collection, bool monitored )
00062 {
00063   if ( monitored )
00064     d->collections << collection;
00065   else
00066     d->collections.removeAll( collection );
00067 
00068   emit collectionMonitored( collection, monitored );
00069 }
00070 
00071 void Monitor::setItemMonitored( const Item & item, bool monitored )
00072 {
00073   if ( monitored )
00074     d->items.insert( item.id() );
00075   else
00076     d->items.remove( item.id() );
00077 
00078   emit itemMonitored( item,  monitored );
00079 }
00080 
00081 void Monitor::setResourceMonitored( const QByteArray & resource, bool monitored )
00082 {
00083   if ( monitored )
00084     d->resources.insert( resource );
00085   else
00086     d->resources.remove( resource );
00087 
00088   emit resourceMonitored( resource, monitored );
00089 }
00090 
00091 void Monitor::setMimeTypeMonitored( const QString & mimetype, bool monitored )
00092 {
00093   if ( monitored )
00094     d->mimetypes.insert( mimetype );
00095   else
00096     d->mimetypes.remove( mimetype );
00097 
00098   emit mimeTypeMonitored( mimetype, monitored );
00099 }
00100 
00101 void Akonadi::Monitor::setAllMonitored( bool monitored )
00102 {
00103   d->monitorAll = monitored;
00104 
00105   emit allMonitored( monitored );
00106 }
00107 
00108 void Monitor::ignoreSession(Session * session)
00109 {
00110   d->sessions << session->sessionId();
00111   connect( session, SIGNAL(destroyed(QObject*)), this, SLOT(slotSessionDestroyed(QObject*)) );
00112 }
00113 
00114 void Monitor::fetchCollection(bool enable)
00115 {
00116   d->fetchCollection = enable;
00117 }
00118 
00119 void Monitor::fetchCollectionStatistics(bool enable)
00120 {
00121   d->fetchCollectionStatistics = enable;
00122 }
00123 
00124 void Monitor::setItemFetchScope( const ItemFetchScope &fetchScope )
00125 {
00126   d->mItemFetchScope = fetchScope;
00127 }
00128 
00129 ItemFetchScope &Monitor::itemFetchScope()
00130 {
00131   return d->mItemFetchScope;
00132 }
00133 
00134 void Monitor::setCollectionFetchScope( const CollectionFetchScope &fetchScope )
00135 {
00136   d->mCollectionFetchScope = fetchScope;
00137 }
00138 
00139 CollectionFetchScope& Monitor::collectionFetchScope()
00140 {
00141   return d->mCollectionFetchScope;
00142 }
00143 
00144 Collection::List Monitor::collectionsMonitored() const
00145 {
00146   return d->collections;
00147 }
00148 
00149 QList<Item::Id> Monitor::itemsMonitored() const
00150 {
00151   return d->items.toList();
00152 }
00153 
00154 QStringList Monitor::mimeTypesMonitored() const
00155 {
00156   return d->mimetypes.toList();
00157 }
00158 
00159 QList<QByteArray> Monitor::resourcesMonitored() const
00160 {
00161   return d->resources.toList();
00162 }
00163 
00164 bool Monitor::isAllMonitored() const
00165 {
00166   return d->monitorAll;
00167 }
00168 
00169 void Monitor::setSession( Akonadi::Session *session )
00170 {
00171   if (session == d->session)
00172     return;
00173 
00174   if (!session)
00175     d->session = Session::defaultSession();
00176   else
00177     d->session = session;
00178 
00179   d->itemCache.setSession(d->session);
00180   d->collectionCache.setSession(d->session);
00181 }
00182 
00183 Session* Monitor::session() const
00184 {
00185   return d->session;
00186 }
00187 
00188 #undef d
00189 
00190 #include "monitor.moc"

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.2-20100208
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