Warning, file /maui/mauikit-filebrowsing/src/code/syncing.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #pragma once 0002 0003 #include <QObject> 0004 #include <QNetworkReply> 0005 0006 #include <QFile> 0007 0008 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0009 #include <MauiKit3/Core/fmh.h> 0010 #else 0011 #include <MauiKit4/Core/fmh.h> 0012 #endif 0013 0014 #include "filebrowsing_export.h" 0015 0016 class WebDAVClient; 0017 class WebDAVReply; 0018 /** 0019 * @brief The Syncing class 0020 */ 0021 class FILEBROWSING_EXPORT Syncing : public QObject 0022 { 0023 Q_OBJECT 0024 Q_DISABLE_COPY(Syncing) 0025 0026 public: 0027 enum SIGNAL_TYPE : uint_fast8_t { OPEN, DOWNLOAD, COPY, SAVE, CUT, DELETE, RENAME, MOVE, UPLOAD }; 0028 0029 /** 0030 * @brief uploadQueue 0031 */ 0032 QStringList uploadQueue; 0033 0034 /** 0035 * @brief Syncing 0036 * @param parent 0037 */ 0038 explicit Syncing(QObject *parent = nullptr); 0039 0040 /** 0041 * @brief listContent 0042 * @param path 0043 * @param filters 0044 * @param depth 0045 */ 0046 void listContent(const QUrl &path, const QStringList &filters, const int &depth = 1); 0047 0048 /** 0049 * @brief setCredentials 0050 * @param server 0051 * @param user 0052 * @param password 0053 */ 0054 void setCredentials(const QString &server, const QString &user, const QString &password); 0055 0056 /** 0057 * @brief download 0058 * @param path 0059 */ 0060 void download(const QUrl &path); 0061 0062 /** 0063 * @brief upload 0064 * @param path 0065 * @param filePath 0066 */ 0067 void upload(const QUrl &path, const QUrl &filePath); 0068 0069 /** 0070 * @brief createDir 0071 * @param path 0072 * @param name 0073 */ 0074 void createDir(const QUrl &path, const QString &name); 0075 0076 /** 0077 * @brief resolveFile 0078 * @param item 0079 * @param signalType 0080 */ 0081 void resolveFile(const FMH::MODEL &item, const Syncing::SIGNAL_TYPE &signalType); 0082 0083 /** 0084 * @brief setCopyTo 0085 * @param path 0086 */ 0087 void setCopyTo(const QUrl &path); 0088 0089 /** 0090 * @brief getCopyTo 0091 * @return 0092 */ 0093 QUrl getCopyTo() const; 0094 0095 /** 0096 * @brief getUser 0097 * @return 0098 */ 0099 QString getUser() const; 0100 0101 /** 0102 * @brief setUploadQueue 0103 * @param list 0104 */ 0105 void setUploadQueue(const QStringList &list); 0106 0107 /** 0108 * @brief localToAbstractCloudPath 0109 * @param url 0110 * @return 0111 */ 0112 QString localToAbstractCloudPath(const QString &url); 0113 0114 private: 0115 WebDAVClient *client; 0116 QString host = QStringLiteral("https://cloud.opendesktop.cc/remote.php/webdav/"); 0117 QString user = QStringLiteral("mauitest"); 0118 QString password = QStringLiteral("mauitest"); 0119 void listDirOutputHandler(WebDAVReply *reply, const QStringList &filters = QStringList()); 0120 0121 void saveTo(const QByteArray &array, const QUrl &path); 0122 QString saveToCache(const QString &file, const QUrl &where); 0123 QUrl getCacheFile(const QUrl &path); 0124 0125 QUrl currentPath; 0126 QUrl copyTo; 0127 0128 void emitError(const QNetworkReply::NetworkError &err); 0129 0130 SIGNAL_TYPE signalType; 0131 0132 QFile mFile; 0133 0134 Q_SIGNALS: 0135 /** 0136 * @brief listReady 0137 * @param data 0138 * @param url 0139 */ 0140 void listReady(FMH::MODEL_LIST data, QUrl url); 0141 0142 /** 0143 * @brief itemReady 0144 * @param item 0145 * @param url 0146 * @param signalType 0147 */ 0148 void itemReady(FMH::MODEL item, QUrl url, Syncing::SIGNAL_TYPE &signalType); 0149 0150 /** 0151 * @brief dirCreated 0152 * @param item 0153 * @param url 0154 */ 0155 void dirCreated(FMH::MODEL item, QUrl url); 0156 0157 /** 0158 * @brief uploadReady 0159 * @param item 0160 * @param url 0161 */ 0162 void uploadReady(FMH::MODEL item, QUrl url); 0163 0164 /** 0165 * @brief error 0166 * @param message 0167 */ 0168 void error(QString message); 0169 0170 /** 0171 * @brief progress 0172 * @param percent 0173 */ 0174 void progress(int percent); 0175 };