21 #ifndef AKONADI_FREEBUSYMANAGER_P_H
22 #define AKONADI_FREEBUSYMANAGER_P_H
24 #include "etmcalendar.h"
25 #include "mailscheduler_p.h"
27 #include <kcalcore/freebusy.h>
28 #include <kcalcore/icalformat.h>
30 #include <QtCore/QPointer>
31 #include <QtDBus/QDBusContext>
32 #include <QtDBus/QDBusInterface>
43 class FreeBusyManager;
45 class FreeBusyManagerPrivate :
public QObject
49 FreeBusyManager *
const q_ptr;
50 Q_DECLARE_PUBLIC(FreeBusyManager)
55 FreeBusyProviderRequest(
const QString &provider);
63 Status mRequestStatus;
64 QSharedPointer<QDBusInterface> mInterface;
67 struct FreeBusyProvidersRequestsQueue
69 explicit FreeBusyProvidersRequestsQueue(
const QString &start = QString(),
70 const QString &end = QString());
72 FreeBusyProvidersRequestsQueue(
const KDateTime &start,
const KDateTime &end);
76 QList<FreeBusyProviderRequest> mRequests;
78 KCalCore::FreeBusy::Ptr mResultingFreeBusy;
82 Akonadi::ETMCalendar::Ptr mCalendar;
83 KCalCore::ICalFormat mFormat;
85 QStringList mRetrieveQueue;
86 QMap<KUrl, QString> mFreeBusyUrlEmailMap;
87 QMap<QString, FreeBusyProvidersRequestsQueue> mProvidersRequestsByEmail;
90 QDateTime mNextUploadTime;
92 bool mUploadingFreeBusy;
95 QPointer<QWidget > mParentWidgetForMailling;
98 QPointer<QWidget> mParentWidgetForRetrieval;
101 FreeBusyManagerPrivate(FreeBusyManager *q);
102 void checkFreeBusyUrl();
103 QString freeBusyDir()
const;
104 void fetchFreeBusyUrl(
const QString &email);
105 QString freeBusyToIcal(
const KCalCore::FreeBusy::Ptr &);
106 KCalCore::FreeBusy::Ptr iCalToFreeBusy(
const QByteArray &freeBusyData);
107 KCalCore::FreeBusy::Ptr ownerFreeBusy();
108 QString ownerFreeBusyAsString();
109 void processFreeBusyDownloadResult(KJob *_job);
110 void processFreeBusyUploadResult(KJob *_job);
111 void uploadFreeBusy();
112 QStringList getFreeBusyProviders()
const;
113 void queryFreeBusyProviders(
const QStringList &providers,
const QString &email);
114 void queryFreeBusyProviders(
const QStringList &providers,
const QString &email,
115 const KDateTime &start,
const KDateTime &end);
118 void processRetrieveQueue();
119 void contactSearchJobFinished(KJob *_job);
120 void finishProcessRetrieveQueue(
const QString &email,
const KUrl &url);
121 void onHandlesFreeBusy(
const QString &email,
bool handles);
122 void onFreeBusyRetrieved(
const QString &email,
const QString &freeBusy,
123 bool success,
const QString &errorText);
124 void processMailSchedulerResult(Akonadi::Scheduler::Result result,
const QString &errorMsg);
125 void fbCheckerJobFinished(KJob*);
128 void freeBusyUrlRetrieved(
const QString &email,
const KUrl &url);
131 class FbCheckerJob :
public KJob
135 explicit FbCheckerJob(
const QList<KUrl> &urlsToCheck, QObject *parent = 0);
136 virtual void start();
138 KUrl validUrl()
const;
141 void onGetJobFinished(KJob *job);
142 void dataReceived(KIO::Job *,
const QByteArray &data);
146 QList<KUrl> mUrlsToCheck;
153 #endif // FREEBUSYMANAGER_P_H