diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-11-02 00:23:22 +0300 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-11-04 14:56:06 +0300 |
commit | 6fb4e59120f1fd6cc4a2926bf766d5f9d29ad195 (patch) | |
tree | a04c65ce8cedf919f64413933d154d251938e042 /src/gui/sharee.h | |
parent | 309be57a12e4d6ef4190e0cd1dd2599aae7d9fc0 (diff) |
[Sharing] First step towards proper group sharing
Diffstat (limited to 'src/gui/sharee.h')
-rw-r--r-- | src/gui/sharee.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/gui/sharee.h b/src/gui/sharee.h new file mode 100644 index 000000000..86fcc8e79 --- /dev/null +++ b/src/gui/sharee.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) by Roeland Jago Douma <roeland@owncloud.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include <QObject> +#include <QFlags> +#include <QAbstractTableModel> +#include <QModelIndex> +#include <QVariant> +#include <QSharedPointer> +#include <QVector> + +#include "accountfwd.h" + +namespace OCC { + +class Sharee : public QObject { +public: + + enum Type { + User = 0, + Group = 1, + Federated = 6 + }; + Q_DECLARE_FLAGS(Types, Type) + + explicit Sharee(const QString shareWith, + const QString displayName, + const Type type); + + QString shareWith() const; + QString displayName() const; + Type type() const; + + +private: + QString _shareWith; + QString _displayName; + Type _type; +}; + +class ShareeModel : public QAbstractTableModel { + Q_OBJECT +public: + explicit ShareeModel(AccountPtr account, + const QString search, + const QString type, + QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole); + + QSharedPointer<Sharee> parseSharee(const QVariantMap &data); + +private slots: + void shareesFetched(const QVariantMap &reply); + +private: + AccountPtr _account; + QString _search; + QString _type; + + QVector<QSharedPointer<Sharee>> _sharees; +}; + +} |