Kgapi

freebusyqueryjob.h
1/*
2 * SPDX-FileCopyrightText: 2015 Daniel Vrátil <dvratil@redhat.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#pragma once
8
9#include "fetchjob.h"
10#include "kgapicalendar_export.h"
11
12#include <QDateTime>
13#include <QList>
14#include <QScopedPointer>
15
16namespace KGAPI2
17{
18
19class KGAPICALENDAR_EXPORT FreeBusyQueryJob : public KGAPI2::FetchJob
20{
21 Q_OBJECT
22public:
23 struct BusyRange {
24 BusyRange() = default;
25 BusyRange(const QDateTime &busyStart, const QDateTime &busyEnd)
26 : busyStart(busyStart)
27 , busyEnd(busyEnd)
28 {
29 }
30
31 bool operator==(const BusyRange &other) const
32 {
33 return busyStart == other.busyStart && busyEnd == other.busyEnd;
34 }
35
36 QDateTime busyStart;
37 QDateTime busyEnd;
38 };
39 using BusyRangeList = QList<BusyRange>;
40
41 explicit FreeBusyQueryJob(const QString &id, const QDateTime &timeMin, const QDateTime &timeMax, const AccountPtr &account, QObject *parent = nullptr);
42 ~FreeBusyQueryJob() override;
43
44 [[nodiscard]] QString id() const;
45 [[nodiscard]] QDateTime timeMin() const;
46 [[nodiscard]] QDateTime timeMax() const;
47
48 [[nodiscard]] BusyRangeList busy() const;
49
50protected:
51 void start() override;
52 void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override;
53 void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
54
55private:
56 class Private;
58 friend class Private;
59};
60
61}
Abstract superclass for all jobs that fetch resources from Google.
Definition fetchjob.h:25
Q_SCRIPTABLE Q_NOREPLY void start()
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:59:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.