Kgapi

teamdrivedeletejob.cpp
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2019 David Barchiesi <david@barchie.si>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "teamdrivedeletejob.h"
10#include "driveservice.h"
11#include "teamdrive.h"
12
13#include <QNetworkRequest>
14
15using namespace KGAPI2;
16using namespace KGAPI2::Drive;
17
18class Q_DECL_HIDDEN TeamdriveDeleteJob::Private
19{
20public:
21 QStringList teamdrivesIds;
22};
23
24TeamdriveDeleteJob::TeamdriveDeleteJob(const QString &teamdriveId, const AccountPtr &account, QObject *parent)
25 : DeleteJob(account, parent)
26 , d(new Private)
27{
28 d->teamdrivesIds << teamdriveId;
29}
30
31TeamdriveDeleteJob::TeamdriveDeleteJob(const QStringList &teamdrivesIds, const AccountPtr &account, QObject *parent)
32 : DeleteJob(account, parent)
33 , d(new Private)
34{
35 d->teamdrivesIds << teamdrivesIds;
36}
37
38TeamdriveDeleteJob::TeamdriveDeleteJob(const TeamdrivePtr &teamdrive, const AccountPtr &account, QObject *parent)
39 : DeleteJob(account, parent)
40 , d(new Private)
41{
42 d->teamdrivesIds << teamdrive->id();
43}
44
45TeamdriveDeleteJob::TeamdriveDeleteJob(const TeamdrivesList &teamdrives, const AccountPtr &account, QObject *parent)
46 : DeleteJob(account, parent)
47 , d(new Private)
48{
49 for (const TeamdrivePtr &teamdrive : std::as_const(teamdrives)) {
50 d->teamdrivesIds << teamdrive->id();
51 }
52}
53
54TeamdriveDeleteJob::~TeamdriveDeleteJob() = default;
55
56void TeamdriveDeleteJob::start()
57{
58 if (d->teamdrivesIds.isEmpty()) {
60 return;
61 }
62
63 const QString teamdriveId = d->teamdrivesIds.takeFirst();
64 const QUrl url = DriveService::fetchTeamdriveUrl(teamdriveId);
65
66 QNetworkRequest request(url);
67 enqueueRequest(request);
68}
69
70#include "moc_teamdrivedeletejob.cpp"
Abstract superclass for all jobs that delete resources from Google.
Definition deletejob.h:25
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
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 Fri Nov 29 2024 11:54:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.