Changeset View
Changeset View
Standalone View
Standalone View
src/calendar/freebusyqueryjob.h
| Show All 20 Lines | |||||
| 21 | #ifndef KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | 21 | #ifndef KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | ||
| 22 | #define KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | 22 | #define KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | ||
| 23 | 23 | | |||
| 24 | #include "fetchjob.h" | 24 | #include "fetchjob.h" | ||
| 25 | #include "kgapicalendar_export.h" | 25 | #include "kgapicalendar_export.h" | ||
| 26 | 26 | | |||
| 27 | #include <QVector> | 27 | #include <QVector> | ||
| 28 | #include <QDateTime> | 28 | #include <QDateTime> | ||
| 29 | #include <QScopedPointer> | ||||
| 29 | 30 | | |||
| 30 | namespace KGAPI2 { | 31 | namespace KGAPI2 { | ||
| 31 | 32 | | |||
| 32 | class KGAPICALENDAR_EXPORT FreeBusyQueryJob : public KGAPI2::FetchJob | 33 | class KGAPICALENDAR_EXPORT FreeBusyQueryJob : public KGAPI2::FetchJob | ||
| 33 | { | 34 | { | ||
| 34 | Q_OBJECT | 35 | Q_OBJECT | ||
| 35 | public: | 36 | public: | ||
| 36 | struct BusyRange { | 37 | struct BusyRange { | ||
| 37 | BusyRange() {}; | 38 | BusyRange() = default; | ||
| 38 | BusyRange(const QDateTime &busyStart, const QDateTime &busyEnd) | 39 | BusyRange(const QDateTime &busyStart, const QDateTime &busyEnd) | ||
| 39 | : busyStart(busyStart), busyEnd(busyEnd) | 40 | : busyStart(busyStart), busyEnd(busyEnd) | ||
| 40 | {} | 41 | {} | ||
| 41 | 42 | | |||
| 42 | bool operator==(const BusyRange &other) const | 43 | bool operator==(const BusyRange &other) const | ||
| 43 | { | 44 | { | ||
| 44 | return busyStart == other.busyStart && busyEnd == other.busyEnd; | 45 | return busyStart == other.busyStart && busyEnd == other.busyEnd; | ||
| 45 | } | 46 | } | ||
| 46 | 47 | | |||
| 47 | QDateTime busyStart; | 48 | QDateTime busyStart; | ||
| 48 | QDateTime busyEnd; | 49 | QDateTime busyEnd; | ||
| 49 | }; | 50 | }; | ||
| 50 | typedef QVector<BusyRange> BusyRangeList; | 51 | typedef QVector<BusyRange> BusyRangeList; | ||
| 51 | 52 | | |||
| 52 | explicit FreeBusyQueryJob(const QString &id, | 53 | explicit FreeBusyQueryJob(const QString &id, | ||
| 53 | const QDateTime &timeMin, | 54 | const QDateTime &timeMin, | ||
| 54 | const QDateTime &timeMax, | 55 | const QDateTime &timeMax, | ||
| 55 | const AccountPtr &account, | 56 | const AccountPtr &account, | ||
| 56 | QObject* parent = nullptr); | 57 | QObject* parent = nullptr); | ||
| 57 | ~FreeBusyQueryJob(); | 58 | ~FreeBusyQueryJob() override; | ||
| 58 | 59 | | |||
| 59 | QString id() const; | 60 | QString id() const; | ||
| 60 | QDateTime timeMin() const; | 61 | QDateTime timeMin() const; | ||
| 61 | QDateTime timeMax() const; | 62 | QDateTime timeMax() const; | ||
| 62 | 63 | | |||
| 63 | BusyRangeList busy() const; | 64 | BusyRangeList busy() const; | ||
| 64 | 65 | | |||
| 65 | protected: | 66 | protected: | ||
| 66 | void start() override; | 67 | void start() override; | ||
| 67 | void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override; | 68 | void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override; | ||
| 68 | void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override; | 69 | void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override; | ||
| 69 | 70 | | |||
| 70 | private: | 71 | private: | ||
| 71 | class Private; | 72 | class Private; | ||
| 72 | Private * const d; | 73 | QScopedPointer<Private> const d; | ||
| 73 | friend class Private; | 74 | friend class Private; | ||
| 74 | 75 | | |||
| 75 | }; | 76 | }; | ||
| 76 | 77 | | |||
| 77 | } | 78 | } | ||
| 78 | 79 | | |||
| 79 | #endif // KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | 80 | #endif // KGAPI2_CALENDAR_FREEBUSYQUERYJOB_H | ||