Kgapi

calendardeletejob.cpp
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "calendardeletejob.h"
10#include "calendar.h"
11#include "calendarservice.h"
12#include "private/queuehelper_p.h"
13
14#include <QNetworkRequest>
15
16using namespace KGAPI2;
17
18class Q_DECL_HIDDEN CalendarDeleteJob::Private
19{
20public:
21 QueueHelper<QString> calendarsIds;
22};
23
24CalendarDeleteJob::CalendarDeleteJob(const CalendarPtr &calendar, const AccountPtr &account, QObject *parent)
25 : DeleteJob(account, parent)
26 , d(new Private)
27{
28 d->calendarsIds << calendar->uid();
29}
30
31CalendarDeleteJob::CalendarDeleteJob(const CalendarsList &calendars, const AccountPtr &account, QObject *parent)
32 : DeleteJob(account, parent)
33 , d(new Private)
34{
35 for (const CalendarPtr &calendar : calendars) {
36 d->calendarsIds << calendar->uid();
37 }
38}
39
40CalendarDeleteJob::CalendarDeleteJob(const QString &calendarId, const AccountPtr &account, QObject *parent)
41 : DeleteJob(account, parent)
42 , d(new Private)
43{
44 d->calendarsIds << calendarId;
45}
46
47CalendarDeleteJob::CalendarDeleteJob(const QStringList &calendarsIds, const AccountPtr &account, QObject *parent)
48 : DeleteJob(account, parent)
49 , d(new Private)
50{
51 d->calendarsIds = calendarsIds;
52}
53
55
57{
58 if (d->calendarsIds.atEnd()) {
60 return;
61 }
62
63 const QString calendarId = d->calendarsIds.current();
65
66 enqueueRequest(request);
67}
68
70{
71 d->calendarsIds.currentProcessed();
72
73 KGAPI2::DeleteJob::handleReply(reply, rawData);
74}
A job to delete one or more calendars from user's Google Calendar account.
~CalendarDeleteJob() override
Destructor.
void start() override
KGAPI2::Job::start implementation.
void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override
KGAPI2::Job::handleReply implementation.
CalendarDeleteJob(const CalendarPtr &calendar, const AccountPtr &account, QObject *parent)
Constructs a new job that will delete given calendar from user's Google Calendar account.
Abstract superclass for all jobs that delete resources from Google.
Definition deletejob.h:25
void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override
KGAPI2::Job::handleReply implementation.
Definition deletejob.cpp:58
virtual void emitFinished()
Emits Job::finished() signal.
Definition job.cpp:493
virtual void enqueueRequest(const QNetworkRequest &request, const QByteArray &data=QByteArray(), const QString &contentType=QString())
Enqueues request in dispatcher queue.
Definition job.cpp:513
QUrl removeCalendarUrl(const QString &calendarID)
Returns URL for removing an existing calendar.
QNetworkRequest prepareRequest(const QUrl &url)
Preparse a QNetworkRequest for given URL.
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.