Kgapi

fileabstractuploadjob.h
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#pragma once
10
11#include "file.h"
12#include "fileabstractdatajob.h"
13#include "kgapidrive_export.h"
14
15#include <QMap>
16#include <QStringList>
17
18namespace KGAPI2
19{
20
21namespace Drive
22{
23
24class KGAPIDRIVE_EXPORT FileAbstractUploadJob : public KGAPI2::Drive::FileAbstractDataJob
25{
26 Q_OBJECT
27
28public:
29 explicit FileAbstractUploadJob(const FilePtr &metadata, const AccountPtr &account, QObject *parent = nullptr);
30 explicit FileAbstractUploadJob(const FilesList &metadata, const AccountPtr &account, QObject *parent = nullptr);
31 explicit FileAbstractUploadJob(const QString &filePath, const AccountPtr &account, QObject *parent = nullptr);
32 explicit FileAbstractUploadJob(const QString &filePath, const FilePtr &metaData, const AccountPtr &account, QObject *parent = nullptr);
33 explicit FileAbstractUploadJob(const QStringList &filePaths, const AccountPtr &account, QObject *parent = nullptr);
34 explicit FileAbstractUploadJob(const QMap<QString /* file path */, FilePtr /* metadata */> &files, const AccountPtr &account, QObject *parent = nullptr);
35 ~FileAbstractUploadJob() override;
36
37 QMap<QString /* file path */, FilePtr /* metadata */> files() const;
38
39protected:
40 void start() override;
41 void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override;
42 void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
43
44 virtual QUrl createUrl(const QString &filePath, const FilePtr &metaData) = 0;
45 virtual QNetworkReply *dispatch(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data) = 0;
46 void setSerializationOptions(File::SerializationOptions options);
47 [[nodiscard]] File::SerializationOptions serializationOptions() const;
48
49private:
50 class Private;
51 Private *const d;
52 friend class Private;
53
54 Q_PRIVATE_SLOT(d, void _k_uploadProgress(qint64 uploadedBytes, qint64 totalBytes))
55};
56
57} // namespace Drive
58
59} // namespace KGAPI2
Q_SCRIPTABLE Q_NOREPLY void start()
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 Dec 20 2024 11:59:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.