Kgapi

filecreatejob.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 "filecreatejob.h"
10#include "driveservice.h"
11
12#include <QNetworkAccessManager>
13#include <QNetworkRequest>
14
15using namespace KGAPI2;
16using namespace KGAPI2::Drive;
17
18class Q_DECL_HIDDEN FileCreateJob::Private
19{
20};
21
22FileCreateJob::FileCreateJob(const FilePtr &metadata, const AccountPtr &account, QObject *parent)
23 : FileAbstractUploadJob(metadata, account, parent)
24 , d(new Private)
25{
26}
27
28FileCreateJob::FileCreateJob(const FilesList &metadata, const AccountPtr &account, QObject *parent)
29 : FileAbstractUploadJob(metadata, account, parent)
30 , d(new Private)
31{
32}
33
34FileCreateJob::FileCreateJob(const QString &filePath, const AccountPtr &account, QObject *parent)
35 : FileAbstractUploadJob(filePath, account, parent)
36 , d(new Private)
37{
38}
39
40FileCreateJob::FileCreateJob(const QString &filePath, const FilePtr &metaData, const AccountPtr &account, QObject *parent)
41 : FileAbstractUploadJob(filePath, metaData, account, parent)
42 , d(new Private)
43{
44}
45
46FileCreateJob::FileCreateJob(const QStringList &filePaths, const AccountPtr &account, QObject *parent)
47 : FileAbstractUploadJob(filePaths, account, parent)
48 , d(new Private)
49{
50}
51
52FileCreateJob::FileCreateJob(const QMap<QString, FilePtr> &files, const AccountPtr &account, QObject *parent)
53 : FileAbstractUploadJob(files, account, parent)
54 , d(new Private)
55{
56}
57
58FileCreateJob::~FileCreateJob()
59{
60 delete d;
61}
62
63QNetworkReply *FileCreateJob::dispatch(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data)
64{
65 return accessManager->post(request, data);
66}
67
68QUrl FileCreateJob::createUrl(const QString &filePath, const FilePtr &metaData)
69{
70 if (filePath.isEmpty() && !metaData.isNull()) {
71 return DriveService::uploadMetadataFileUrl();
72 } else if (metaData.isNull()) {
73 return DriveService::uploadMediaFileUrl();
74 } else {
75 return DriveService::uploadMultipartFileUrl();
76 }
77}
78
79#include "moc_filecreatejob.cpp"
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
QNetworkReply * post(const QNetworkRequest &request, QHttpMultiPart *multiPart)
bool isNull() const const
bool isEmpty() const const
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.