Kgapi

drivesdeletejob.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 "drivesdeletejob.h"
10#include "drives.h"
11#include "driveservice.h"
12
13#include <QNetworkRequest>
14
15using namespace KGAPI2;
16using namespace KGAPI2::Drive;
17
18class Q_DECL_HIDDEN DrivesDeleteJob::Private
19{
20public:
21 QStringList drivesIds;
22};
23
24DrivesDeleteJob::DrivesDeleteJob(const QString &drivesId, const AccountPtr &account, QObject *parent)
25 : DeleteJob(account, parent)
26 , d(new Private)
27{
28 d->drivesIds << drivesId;
29}
30
31DrivesDeleteJob::DrivesDeleteJob(const QStringList &drivesIds, const AccountPtr &account, QObject *parent)
32 : DeleteJob(account, parent)
33 , d(new Private)
34{
35 d->drivesIds << drivesIds;
36}
37
38DrivesDeleteJob::DrivesDeleteJob(const DrivesPtr &drives, const AccountPtr &account, QObject *parent)
39 : DeleteJob(account, parent)
40 , d(new Private)
41{
42 d->drivesIds << drives->id();
43}
44
45DrivesDeleteJob::DrivesDeleteJob(const DrivesList &drives, const AccountPtr &account, QObject *parent)
46 : DeleteJob(account, parent)
47 , d(new Private)
48{
49 for (const DrivesPtr &drive : std::as_const(drives)) {
50 d->drivesIds << drive->id();
51 }
52}
53
54DrivesDeleteJob::~DrivesDeleteJob() = default;
55
56void DrivesDeleteJob::start()
57{
58 if (d->drivesIds.isEmpty()) {
60 return;
61 }
62
63 const QString drivesId = d->drivesIds.takeFirst();
64 const QUrl url = DriveService::fetchDrivesUrl(drivesId);
65
66 QNetworkRequest request(url);
67 enqueueRequest(request);
68}
69
70#include "moc_drivesdeletejob.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 Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.