Kgapi

childreferencedeletejob.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 "childreferencedeletejob.h"
10#include "childreference.h"
11#include "driveservice.h"
12
13#include <QNetworkRequest>
14
15using namespace KGAPI2;
16using namespace KGAPI2::Drive;
17
18class Q_DECL_HIDDEN ChildReferenceDeleteJob::Private
19{
20public:
21 QString folderId;
22 QStringList childrenIds;
23};
24
25ChildReferenceDeleteJob::ChildReferenceDeleteJob(const QString &folderId, const QString &childId, const AccountPtr &account, QObject *parent)
26 : DeleteJob(account, parent)
27 , d(new Private)
28{
29 d->folderId = folderId;
30 d->childrenIds << childId;
31}
32
33ChildReferenceDeleteJob::ChildReferenceDeleteJob(const QString &folderId, const QStringList &childrenIds, const AccountPtr &account, QObject *parent)
34 : DeleteJob(account, parent)
35 , d(new Private)
36{
37 d->folderId = folderId;
38 d->childrenIds << childrenIds;
39}
40
41ChildReferenceDeleteJob::ChildReferenceDeleteJob(const QString &folderId, const ChildReferencePtr &reference, const AccountPtr &account, QObject *parent)
42 : DeleteJob(account, parent)
43 , d(new Private)
44{
45 d->folderId = folderId;
46 d->childrenIds << reference->id();
47}
48
49ChildReferenceDeleteJob::ChildReferenceDeleteJob(const QString &folderId, const ChildReferencesList &references, const AccountPtr &account, QObject *parent)
50 : DeleteJob(account, parent)
51 , d(new Private)
52{
53 d->folderId = folderId;
54 for (const ChildReferencePtr &reference : references) {
55 d->childrenIds << reference->id();
56 }
57}
58
59ChildReferenceDeleteJob::~ChildReferenceDeleteJob()
60{
61 delete d;
62}
63
64void ChildReferenceDeleteJob::start()
65{
66 if (d->childrenIds.isEmpty()) {
68 return;
69 }
70
71 const QString childId = d->childrenIds.takeFirst();
72 const QUrl url = DriveService::deleteChildReference(d->folderId, childId);
73
74 QNetworkRequest request(url);
75
76 enqueueRequest(request);
77}
78
79#include "moc_childreferencedeletejob.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
bool isEmpty() const const
value_type takeFirst()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.