Kgapi

revisiondeletejob.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 "revisiondeletejob.h"
10#include "driveservice.h"
11#include "revision.h"
12
13#include <QNetworkRequest>
14
15using namespace KGAPI2;
16using namespace KGAPI2::Drive;
17
18class Q_DECL_HIDDEN RevisionDeleteJob::Private
19{
20public:
21 QString fileId;
22 QStringList revisionsIds;
23};
24
25RevisionDeleteJob::RevisionDeleteJob(const QString &fileId, const QString &revisionId, const AccountPtr &account, QObject *parent)
26 : DeleteJob(account, parent)
27 , d(new Private)
28{
29 d->fileId = fileId;
30 d->revisionsIds << revisionId;
31}
32
33RevisionDeleteJob::RevisionDeleteJob(const QString &fileId, const QStringList &revisionsIds, const AccountPtr &account, QObject *parent)
34 : DeleteJob(account, parent)
35 , d(new Private)
36{
37 d->fileId = fileId;
38 d->revisionsIds << revisionsIds;
39}
40
41RevisionDeleteJob::RevisionDeleteJob(const QString &fileId, const RevisionPtr &revision, const AccountPtr &account, QObject *parent)
42 : DeleteJob(account, parent)
43 , d(new Private)
44{
45 d->fileId = fileId;
46 d->revisionsIds << revision->id();
47}
48
49RevisionDeleteJob::RevisionDeleteJob(const QString &fileId, const RevisionsList &revisions, const AccountPtr &account, QObject *parent)
50 : DeleteJob(account, parent)
51 , d(new Private)
52{
53 d->fileId = fileId;
54 for (const RevisionPtr &revision : std::as_const(revisions)) {
55 d->revisionsIds << revision->id();
56 }
57}
58
59RevisionDeleteJob::~RevisionDeleteJob()
60{
61 delete d;
62}
63
64void RevisionDeleteJob::start()
65{
66 if (d->revisionsIds.isEmpty()) {
68 return;
69 }
70
71 const QString revisionId = d->revisionsIds.takeFirst();
72 const QUrl url = DriveService::deleteRevisionUrl(d->fileId, revisionId);
73
74 QNetworkRequest request(url);
75 enqueueRequest(request);
76}
77
78#include "moc_revisiondeletejob.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 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.