MauiKit File Browsing

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

KDE's Doxygen guidelines are available online.