2
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
3
Copyright (c) 2009 Sebastian Kügler <sebas@kde.org>
5
This library is free software; you can redistribute it and/or modify it
6
under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or (at your
8
option) any later version.
10
This library is distributed in the hope that it will be useful, but WITHOUT
11
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13
License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to the
17
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
#ifndef AKONADIENGINE_H
23
#define AKONADIENGINE_H
25
#include <plasma/dataengine.h>
27
#include <Akonadi/Item>
28
#include <Akonadi/Monitor>
30
#include <kmime/kmime_message.h>
31
#include <kabc/addressee.h>
33
#include <boost/shared_ptr.hpp>
34
typedef boost::shared_ptr<KMime::Message> MessagePtr;
38
class AkonadiEngine : public Plasma::DataEngine
43
AkonadiEngine( QObject* parent, const QVariantList& args );
45
QStringList sources() const;
48
bool sourceRequestEvent(const QString &name);
52
void stopMonitor(const QString &name);
54
void fetchEmailCollectionDone(KJob* job); // done retrieving whole collection
55
void fetchContactCollectionDone(KJob* job); // done retrieving a whole contact collection
56
void fetchMicroBlogDone(KJob* job);
58
void emailItemsReceived(const Akonadi::Item::List &items);
60
void fetchEmailCollectionsDone(KJob* job); // got list of collections
61
void fetchContactCollectionsDone(KJob* job);
62
void fetchMicroBlogCollectionsDone(KJob* job);
64
void emailItemAdded(const Akonadi::Item &item, const QString &collection = QString());
65
void contactItemAdded(const Akonadi::Item & item);
66
void microBlogItemAdded(const Akonadi::Item &item);
69
void initEmailMonitor();
70
void initContactMonitor();
71
void initMicroBlogMonitor();
72
// useful for debugging
73
void printMessage(MessagePtr msg);
74
void printContact(const QString &source, const KABC::Addressee &a);
76
Akonadi::Monitor* m_emailMonitor;
77
Akonadi::Monitor* m_contactMonitor;
78
Akonadi::Monitor* m_microBlogMonitor;
80
QHash<KJob*, QString> m_jobCollections;
83
K_EXPORT_PLASMA_DATAENGINE(akonadi, AkonadiEngine)