2015-11-02 00:23:22 +03:00
|
|
|
/*
|
|
|
|
* 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
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2015-11-02 00:23:22 +03:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2015-11-05 00:00:35 +03:00
|
|
|
#ifndef SHAREE_H
|
|
|
|
#define SHAREE_H
|
|
|
|
|
2015-11-02 00:23:22 +03:00
|
|
|
#include <QObject>
|
|
|
|
#include <QFlags>
|
2015-11-05 00:00:35 +03:00
|
|
|
#include <QAbstractListModel>
|
2017-05-09 15:24:11 +03:00
|
|
|
#include <QLoggingCategory>
|
2015-11-02 00:23:22 +03:00
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include "accountfwd.h"
|
|
|
|
|
2017-04-26 12:38:10 +03:00
|
|
|
class QJsonDocument;
|
|
|
|
class QJsonObject;
|
|
|
|
|
2015-11-02 00:23:22 +03:00
|
|
|
namespace OCC {
|
|
|
|
|
2017-05-09 15:24:11 +03:00
|
|
|
Q_DECLARE_LOGGING_CATEGORY(lcSharing)
|
|
|
|
|
2015-11-05 00:00:35 +03:00
|
|
|
class Sharee
|
|
|
|
{
|
2023-02-24 16:06:29 +03:00
|
|
|
Q_GADGET
|
|
|
|
Q_PROPERTY(QString format READ format)
|
|
|
|
Q_PROPERTY(QString shareWith MEMBER _shareWith)
|
|
|
|
Q_PROPERTY(QString displayName MEMBER _displayName)
|
|
|
|
Q_PROPERTY(QString iconUrlColoured MEMBER _iconUrlColoured)
|
|
|
|
Q_PROPERTY(Type type MEMBER _type)
|
|
|
|
|
2015-11-02 00:23:22 +03:00
|
|
|
public:
|
2015-11-19 12:50:21 +03:00
|
|
|
// Keep in sync with Share::ShareType
|
2023-02-24 16:06:29 +03:00
|
|
|
enum Type { Invalid = -1, User = 0, Group = 1, Email = 4, Federated = 6, Circle = 7, Room = 10, LookupServerSearch = 999, LookupServerSearchResults = 1000 };
|
|
|
|
Q_ENUM(Type);
|
|
|
|
explicit Sharee() = default;
|
|
|
|
explicit Sharee(const QString &shareWith, const QString &displayName, const Type type, const QString &iconUrl = {});
|
2015-11-19 12:50:21 +03:00
|
|
|
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] QString format() const;
|
|
|
|
[[nodiscard]] QString shareWith() const;
|
|
|
|
[[nodiscard]] QString displayName() const;
|
2023-02-24 16:06:29 +03:00
|
|
|
[[nodiscard]] QString iconUrl() const;
|
|
|
|
[[nodiscard]] QString iconUrlColoured() const;
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] Type type() const;
|
2023-02-24 16:06:29 +03:00
|
|
|
bool updateIconUrl();
|
|
|
|
|
|
|
|
void setDisplayName(const QString &displayName);
|
|
|
|
void setType(const Type &type);
|
|
|
|
void setIsIconColourful(const bool isColourful);
|
|
|
|
void setIconUrl(const QString &iconUrl);
|
2015-11-16 16:18:01 +03:00
|
|
|
|
2015-11-02 00:23:22 +03:00
|
|
|
private:
|
|
|
|
QString _shareWith;
|
|
|
|
QString _displayName;
|
2023-02-24 16:06:29 +03:00
|
|
|
QString _iconUrlColoured;
|
|
|
|
QString _iconColor;
|
|
|
|
Type _type = Type::Invalid;
|
|
|
|
QString _iconUrl;
|
|
|
|
bool _isIconColourful = false;
|
2015-11-02 00:23:22 +03:00
|
|
|
};
|
|
|
|
|
2022-07-25 19:57:18 +03:00
|
|
|
using ShareePtr = QSharedPointer<OCC::Sharee>;
|
2015-11-02 00:23:22 +03:00
|
|
|
}
|
2015-11-05 00:00:35 +03:00
|
|
|
|
2022-07-25 19:57:18 +03:00
|
|
|
Q_DECLARE_METATYPE(OCC::ShareePtr)
|
2023-02-24 16:06:29 +03:00
|
|
|
Q_DECLARE_METATYPE(OCC::Sharee)
|
2015-11-09 19:21:42 +03:00
|
|
|
|
2015-11-05 00:00:35 +03:00
|
|
|
#endif //SHAREE_H
|