00001 #ifndef SRMFILESERVER_H 00002 #define SRMFILESERVER_H 00003 00004 #include <QObject> 00005 #include <QFutureWatcher> 00006 #include <QMap> 00007 #include <arc/UserConfig.h> 00008 #include "fileserver.h" 00009 #include "filetransfer.h" 00010 00012 class SRMFileServer : public QObject, public FileServer 00013 { 00014 Q_OBJECT 00015 00016 public: 00018 explicit SRMFileServer(); 00019 00020 QStringList getFileInfoLabels(); 00021 void updateFileList(QString URL); 00022 QVector<ARCFileElement*> &getFileList() { return fileList; } 00023 bool goUpOneFolder(); 00024 QString getCurrentURL(); 00025 QString getCurrentPath(); 00026 00027 bool copyFromServer(QString sourcePath, QString destinationPath); 00028 bool copyToServer(QString sourcePath, QString destinationPath); 00029 bool copyToServer(QList<QUrl> &urlList, QString destinationPath); 00030 bool deleteItem(QString URL); 00031 bool deleteItems(QStringList& URLs); 00032 bool makeDir(QString path); 00033 unsigned int getFilePermissions(QString path); 00034 void setFilePermissions(QString path, unsigned int permissions); 00035 QMap<QString, QString> fileProperties(QString URL); 00036 bool rename(QString fromURL, QString toURL); 00037 00039 00044 void startUpdateFileList(QString URL); 00045 00046 Q_SIGNALS: 00048 void onFileListFinished(bool error, QString errorMsg); 00049 00051 void onError(QString errorStr); 00052 00054 void onCopyFromServerFinished(bool error); 00055 00057 void onDeleteFinished(bool error); 00058 00060 void onMakeDirFinished(bool error); 00061 00063 void onCopyToServerFinished(bool error, QList<QString> &failedFiles); 00064 00065 public Q_SLOTS: 00067 void onCompleted(FileTransfer* fileTransfer, bool success, QString error); 00068 00069 private: 00070 Arc::UserConfig* m_usercfg; 00071 QString m_currentUrlString; 00072 QList<FileTransfer*> m_transferList; 00073 bool m_notifyParent; 00074 bool initUserConfig(); 00075 void updateFileListSilent(QString URL); 00076 void listFiles(QList<QUrl> &urlList, QString currentDir); 00077 QFutureWatcher<void> m_updateFileListWatcher; 00078 }; 00079 00080 #endif // SRMFILESERVER_H