MauiKit File Browsing

syncing.h
1#pragma once
2
3#include <QObject>
4#include <QNetworkReply>
5
6#include <QFile>
7
8#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
9#include <MauiKit3/Core/fmh.h>
10#else
11#include <MauiKit4/Core/fmh.h>
12#endif
13
14#include "filebrowsing_export.h"
15
16class WebDAVClient;
17class WebDAVReply;
18/**
19 * @brief The Syncing class
20 */
21class FILEBROWSING_EXPORT Syncing : public QObject
22{
23 Q_OBJECT
24 Q_DISABLE_COPY(Syncing)
25
26public:
27 enum SIGNAL_TYPE : uint_fast8_t { OPEN, DOWNLOAD, COPY, SAVE, CUT, DELETE, RENAME, MOVE, UPLOAD };
28
29 /**
30 * @brief uploadQueue
31 */
33
34 /**
35 * @brief Syncing
36 * @param parent
37 */
38 explicit Syncing(QObject *parent = nullptr);
39
40 /**
41 * @brief listContent
42 * @param path
43 * @param filters
44 * @param depth
45 */
46 void listContent(const QUrl &path, const QStringList &filters, const int &depth = 1);
47
48 /**
49 * @brief setCredentials
50 * @param server
51 * @param user
52 * @param password
53 */
54 void setCredentials(const QString &server, const QString &user, const QString &password);
55
56 /**
57 * @brief download
58 * @param path
59 */
60 void download(const QUrl &path);
61
62 /**
63 * @brief upload
64 * @param path
65 * @param filePath
66 */
67 void upload(const QUrl &path, const QUrl &filePath);
68
69 /**
70 * @brief createDir
71 * @param path
72 * @param name
73 */
74 void createDir(const QUrl &path, const QString &name);
75
76 /**
77 * @brief resolveFile
78 * @param item
79 * @param signalType
80 */
81 void resolveFile(const FMH::MODEL &item, const Syncing::SIGNAL_TYPE &signalType);
82
83 /**
84 * @brief setCopyTo
85 * @param path
86 */
87 void setCopyTo(const QUrl &path);
88
89 /**
90 * @brief getCopyTo
91 * @return
92 */
93 QUrl getCopyTo() const;
94
95 /**
96 * @brief getUser
97 * @return
98 */
99 QString getUser() const;
100
101 /**
102 * @brief setUploadQueue
103 * @param list
104 */
105 void setUploadQueue(const QStringList &list);
106
107 /**
108 * @brief localToAbstractCloudPath
109 * @param url
110 * @return
111 */
112 QString localToAbstractCloudPath(const QString &url);
113
114private:
115 WebDAVClient *client;
116 QString host = QStringLiteral("https://cloud.opendesktop.cc/remote.php/webdav/");
117 QString user = QStringLiteral("mauitest");
118 QString password = QStringLiteral("mauitest");
119 void listDirOutputHandler(WebDAVReply *reply, const QStringList &filters = QStringList());
120
121 void saveTo(const QByteArray &array, const QUrl &path);
122 QString saveToCache(const QString &file, const QUrl &where);
123 QUrl getCacheFile(const QUrl &path);
124
125 QUrl currentPath;
126 QUrl copyTo;
127
128 void emitError(const QNetworkReply::NetworkError &err);
129
130 SIGNAL_TYPE signalType;
131
132 QFile mFile;
133
135 /**
136 * @brief listReady
137 * @param data
138 * @param url
139 */
141
142 /**
143 * @brief itemReady
144 * @param item
145 * @param url
146 * @param signalType
147 */
148 void itemReady(FMH::MODEL item, QUrl url, Syncing::SIGNAL_TYPE &signalType);
149
150 /**
151 * @brief dirCreated
152 * @param item
153 * @param url
154 */
155 void dirCreated(FMH::MODEL item, QUrl url);
156
157 /**
158 * @brief uploadReady
159 * @param item
160 * @param url
161 */
162 void uploadReady(FMH::MODEL item, QUrl url);
163
164 /**
165 * @brief error
166 * @param message
167 */
168 void error(QString message);
169
170 /**
171 * @brief progress
172 * @param percent
173 */
174 void progress(int percent);
175};
The Syncing class.
Definition syncing.h:22
QStringList uploadQueue
uploadQueue
Definition syncing.h:32
void uploadReady(FMH::MODEL item, QUrl url)
uploadReady
void progress(int percent)
progress
void error(QString message)
error
void listReady(FMH::MODEL_LIST data, QUrl url)
listReady
void itemReady(FMH::MODEL item, QUrl url, Syncing::SIGNAL_TYPE &signalType)
itemReady
void dirCreated(FMH::MODEL item, QUrl url)
dirCreated
Wraps the available actions for a remote item.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:51:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.