1.1.1
by Mattias Ellert
Import upstream version 0.4.3 |
1 |
#ifndef __ArcFileServer_H__
|
2 |
#define __ArcFileServer_H__
|
|
3 |
||
4 |
#include <QObject> |
|
5 |
#include <QFutureWatcher> |
|
6 |
#include <QMap> |
|
7 |
||
8 |
#include <arc/UserConfig.h> |
|
9 |
||
10 |
#include "fileserver.h" |
|
11 |
#include "filetransfer.h" |
|
12 |
||
13 |
/// ARC File server class
|
|
14 |
class ArcFileServer : public QObject, public FileServer |
|
15 |
{
|
|
16 |
Q_OBJECT
|
|
17 |
||
18 |
public: |
|
19 |
/// Create a ArcFileServer object.
|
|
20 |
explicit ArcFileServer(); |
|
21 |
||
22 |
QStringList getFileInfoLabels(); |
|
23 |
void updateFileList(QString URL); |
|
24 |
QVector<ARCFileElement*> &getFileList() { return fileList; } |
|
25 |
bool goUpOneFolder(); |
|
26 |
QString getCurrentURL(); |
|
27 |
QString getCurrentPath(); |
|
28 |
||
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); |
|
39 |
||
40 |
/// Starts a background file file list update.
|
|
41 |
/**
|
|
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.
|
|
45 |
*/
|
|
46 |
void startUpdateFileList(QString URL); |
|
47 |
||
48 |
Q_SIGNALS: |
|
49 |
/// Called when the updateFileList() has completed on the background thread.
|
|
50 |
void onFileListFinished(bool error, QString errorMsg); |
|
51 |
||
52 |
/// Called when an error occurs.
|
|
53 |
void onError(QString errorStr); |
|
54 |
||
55 |
/// Called when a file transfer has completed.
|
|
56 |
void onCopyFromServerFinished(bool error); |
|
57 |
||
58 |
/// Called when a delete operation has completed. (NOT IMPLEMENTED YET)
|
|
59 |
void onDeleteFinished(bool error); |
|
60 |
||
61 |
/// Called when a makedir operation has completed. (NOT IMPLEMENTED YET)
|
|
62 |
void onMakeDirFinished(bool error); |
|
63 |
||
64 |
/// Called when a copy to server operation has completed.
|
|
65 |
void onCopyToServerFinished(bool error, QList<QString> &failedFiles); |
|
66 |
||
67 |
/// Called when a rename operation has completed.
|
|
68 |
void onRenameFinished(bool error); |
|
69 |
||
70 |
public Q_SLOTS: |
|
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); |
|
73 |
||
74 |
private: |
|
75 |
Arc::UserConfig* m_usercfg; |
|
76 |
QString m_currentUrlString; |
|
77 |
QList<FileTransfer*> m_transferList; |
|
78 |
bool m_notifyParent; |
|
79 |
bool initUserConfig(); |
|
80 |
void updateFileListSilent(QString URL); |
|
81 |
void listFiles(QList<QUrl> &urlList, QString currentDir); |
|
82 |
QFutureWatcher<void> m_updateFileListWatcher; |
|
83 |
};
|
|
84 |
||
85 |
#endif // ArcFileServer_H |