| 1 | /**************************************************************************** |
| 2 | Copyright (C) VCreate Logic Private Limited, Bangalore |
| 3 | Contact: [email protected] |
| 4 | |
| 5 | This file is developed by VCreate Logic Private Limited and used as part of the "luckyBackup" project |
| 6 | It is distributed under the terms of the GNU General Public License |
| 7 | It is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | It is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with the luckyBackup project. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | ****************************************************************************/ |
| 21 | |
| 22 | #ifndef Rsync_DIR_MODEL_H |
| 23 | #define Rsync_DIR_MODEL_H |
| 24 | |
| 25 | #include <QAbstractItemModel> |
| 26 | //#include <QAuthenticator> |
| 27 | #include <QUrl> |
| 28 | |
| 29 | class RsyncEntry; |
| 30 | |
| 31 | struct RsyncDirModelData; |
| 32 | class RsyncDirModel : public QAbstractItemModel |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | public: |
| 37 | RsyncDirModel(QObject* parent=0); |
| 38 | ~RsyncDirModel(); |
| 39 | |
| 40 | void setUrl(const QUrl& url); |
| 41 | void setUrl(const QUrl& url,const QString& cpath); |
| 42 | void setUrl(const QUrl& url,const QString& cpath, const QStringList& cargs); |
| 43 | |
| 44 | QUrl url() const; |
| 45 | |
| 46 | // void setLogin(const QString& user, |
| 47 | // const QString& password); |
| 48 | // QString user() const; |
| 49 | // QString password() const; |
| 50 | |
| 51 | QUrl url(const QModelIndex& index) const; |
| 52 | QString path(const QModelIndex& index) const; |
| 53 | QModelIndex index(const QString& path) const; |
| 54 | |
| 55 | |
| 56 | public slots: |
| 57 | void refresh(const QModelIndex& index=QModelIndex()); |
| 58 | |
| 59 | signals: |
| 60 | void listingDone(RsyncEntry*); |
| 61 | // void loginParamsRequest(QAuthenticator* auth); |
| 62 | |
| 63 | protected: |
| 64 | int rowCount(const QModelIndex& parent) const; |
| 65 | int columnCount(const QModelIndex& parent) const; |
| 66 | QVariant data(const QModelIndex& index, int role) const; |
| 67 | QModelIndex index(int row, int col, const QModelIndex& parent) const; |
| 68 | QModelIndex parent(const QModelIndex& index) const; |
| 69 | QVariant headerData(int section, |
| 70 | Qt::Orientation orientation, |
| 71 | int role = Qt::DisplayRole) const; |
| 72 | Qt::ItemFlags flags(const QModelIndex& index) const; |
| 73 | |
| 74 | QModelIndex index(RsyncEntry* entry) const; |
| 75 | bool list() const; |
| 76 | bool list(RsyncEntry* entry) const; |
| 77 | |
| 78 | private slots: |
| 79 | void slotListingDone(RsyncEntry* entry); |
| 80 | |
| 81 | private: |
| 82 | RsyncDirModelData* d; |
| 83 | |
| 84 | }; |
| 85 | |
| 86 | #endif // Rsync_DIR_MODEL_H |
| 87 | |
| 88 |