1
#ifndef __ArcFileServer_H__
2
#define __ArcFileServer_H__
5
#include <QFutureWatcher>
8
#include <arc/UserConfig.h>
10
#include "fileserver.h"
11
#include "filetransfer.h"
13
/// ARC File server class
14
class ArcFileServer : public QObject, public FileServer
19
/// Create a ArcFileServer object.
20
explicit ArcFileServer();
22
QStringList getFileInfoLabels();
23
void updateFileList(QString URL);
24
QVector<ARCFileElement*> &getFileList() { return fileList; }
26
QString getCurrentURL();
27
QString getCurrentPath();
29
bool copyFromServer(QString sourcePath, QString destinationPath);
30
bool copyToServer(QString sourcePath, QString destinationPath);
31
bool copyToServer(QList<QUrl> &urlList, QString destinationPath);
32
bool deleteItem(QString URL);
33
bool deleteItems(QStringList& URLs);
34
bool makeDir(QString path);
35
unsigned int getFilePermissions(QString path);
36
void setFilePermissions(QString path, unsigned int permissions);
37
QMap<QString, QString> fileProperties(QString URL);
38
bool rename(QString fromURL, QString toURL);
40
/// Starts a background file file list update.
42
* This calls the updateFileList() method on a background thread. When completed
43
* The onFileListFinished() method is called.
44
* @param URL to pass to the updateFileList() method.
46
void startUpdateFileList(QString URL);
49
/// Called when the updateFileList() has completed on the background thread.
50
void onFileListFinished(bool error, QString errorMsg);
52
/// Called when an error occurs.
53
void onError(QString errorStr);
55
/// Called when a file transfer has completed.
56
void onCopyFromServerFinished(bool error);
58
/// Called when a delete operation has completed. (NOT IMPLEMENTED YET)
59
void onDeleteFinished(bool error);
61
/// Called when a makedir operation has completed. (NOT IMPLEMENTED YET)
62
void onMakeDirFinished(bool error);
64
/// Called when a copy to server operation has completed.
65
void onCopyToServerFinished(bool error, QList<QString> &failedFiles);
67
/// Called when a rename operation has completed.
68
void onRenameFinished(bool error);
71
/// This slot is used by FileTransfer object to "call" home when a transfer has completed.
72
void onCompleted(FileTransfer* fileTransfer, bool success, QString error);
75
Arc::UserConfig* m_usercfg;
76
QString m_currentUrlString;
77
QList<FileTransfer*> m_transferList;
79
bool initUserConfig();
80
void updateFileListSilent(QString URL);
81
void listFiles(QList<QUrl> &urlList, QString currentDir);
82
QFutureWatcher<void> m_updateFileListWatcher;
85
#endif // ArcFileServer_H