2015-11-01 00:21:09 +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-01 00:21:09 +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 11:58:16 +03:00
|
|
|
#ifndef SHAREUSERGROUPWIDGET_H
|
|
|
|
#define SHAREUSERGROUPWIDGET_H
|
2015-11-01 00:21:09 +03:00
|
|
|
|
|
|
|
#include "accountfwd.h"
|
2016-03-30 12:33:34 +03:00
|
|
|
#include "sharepermissions.h"
|
2020-12-03 21:32:21 +03:00
|
|
|
#include "sharee.h"
|
2015-11-01 00:21:09 +03:00
|
|
|
#include "QProgressIndicator.h"
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QList>
|
2015-11-05 14:30:34 +03:00
|
|
|
#include <QVector>
|
2015-11-16 16:18:01 +03:00
|
|
|
#include <QTimer>
|
2018-07-25 12:18:08 +03:00
|
|
|
#include <qscrollarea.h>
|
2015-11-05 00:00:35 +03:00
|
|
|
|
2015-11-25 13:26:21 +03:00
|
|
|
class QAction;
|
2015-11-05 00:00:35 +03:00
|
|
|
class QCompleter;
|
2015-11-11 13:51:33 +03:00
|
|
|
class QModelIndex;
|
2015-11-05 00:00:35 +03:00
|
|
|
|
2015-11-01 00:21:09 +03:00
|
|
|
namespace OCC {
|
|
|
|
|
|
|
|
namespace Ui {
|
2017-05-17 11:55:42 +03:00
|
|
|
class ShareUserGroupWidget;
|
|
|
|
class ShareUserLine;
|
2015-11-01 00:21:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
class AbstractCredentials;
|
|
|
|
class SyncResult;
|
|
|
|
class Share;
|
|
|
|
class ShareManager;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The ShareDialog (user/group) class
|
|
|
|
* @ingroup gui
|
|
|
|
*/
|
2015-11-05 11:58:16 +03:00
|
|
|
class ShareUserGroupWidget : public QWidget
|
2015-11-01 00:21:09 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-05-17 11:55:42 +03:00
|
|
|
explicit ShareUserGroupWidget(AccountPtr account,
|
|
|
|
const QString &sharePath,
|
|
|
|
const QString &localPath,
|
|
|
|
SharePermissions maxSharingPermissions,
|
2017-09-15 15:24:34 +03:00
|
|
|
const QString &privateLinkUrl,
|
2018-11-11 12:56:22 +03:00
|
|
|
QWidget *parent = nullptr);
|
2015-11-05 11:58:16 +03:00
|
|
|
~ShareUserGroupWidget();
|
2015-11-02 00:23:22 +03:00
|
|
|
|
2018-03-15 21:43:26 +03:00
|
|
|
signals:
|
|
|
|
void togglePublicLinkShare(bool);
|
2019-12-09 22:59:10 +03:00
|
|
|
void styleChanged();
|
2018-03-15 21:43:26 +03:00
|
|
|
|
2015-11-02 00:23:22 +03:00
|
|
|
public slots:
|
2015-11-01 00:21:09 +03:00
|
|
|
void getShares();
|
2019-12-09 22:59:10 +03:00
|
|
|
void slotStyleChanged();
|
2015-11-01 00:21:09 +03:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
|
2015-11-02 00:23:22 +03:00
|
|
|
|
2015-11-05 00:00:35 +03:00
|
|
|
void on_shareeLineEdit_textChanged(const QString &text);
|
2020-12-03 21:32:21 +03:00
|
|
|
void searchForSharees(ShareeModel::LookupMode lookupMode);
|
2015-11-16 16:18:01 +03:00
|
|
|
void slotLineEditTextEdited(const QString &text);
|
2015-11-05 00:00:35 +03:00
|
|
|
|
2015-12-10 15:49:47 +03:00
|
|
|
void slotLineEditReturn();
|
2017-05-17 11:55:42 +03:00
|
|
|
void slotCompleterActivated(const QModelIndex &index);
|
|
|
|
void slotCompleterHighlighted(const QModelIndex &index);
|
2015-11-16 16:18:01 +03:00
|
|
|
void slotShareesReady();
|
2015-11-19 14:32:50 +03:00
|
|
|
void slotAdjustScrollWidgetSize();
|
2017-05-10 10:37:10 +03:00
|
|
|
void slotPrivateLinkShare();
|
2017-05-17 11:55:42 +03:00
|
|
|
void displayError(int code, const QString &message);
|
2015-11-02 00:23:22 +03:00
|
|
|
|
2017-05-10 10:37:10 +03:00
|
|
|
void slotPrivateLinkOpenBrowser();
|
|
|
|
void slotPrivateLinkCopy();
|
|
|
|
void slotPrivateLinkEmail();
|
|
|
|
|
2015-11-01 00:21:09 +03:00
|
|
|
private:
|
2019-12-09 22:59:10 +03:00
|
|
|
void customizeStyle();
|
|
|
|
|
2020-12-03 21:32:21 +03:00
|
|
|
void activateShareeLineEdit();
|
|
|
|
|
2015-11-05 11:58:16 +03:00
|
|
|
Ui::ShareUserGroupWidget *_ui;
|
2018-07-25 12:18:08 +03:00
|
|
|
QScrollArea *_parentScrollArea;
|
2015-11-01 00:21:09 +03:00
|
|
|
AccountPtr _account;
|
|
|
|
QString _sharePath;
|
|
|
|
QString _localPath;
|
2017-05-10 10:37:10 +03:00
|
|
|
SharePermissions _maxSharingPermissions;
|
2017-09-15 15:24:34 +03:00
|
|
|
QString _privateLinkUrl;
|
2015-11-01 00:21:09 +03:00
|
|
|
|
2015-11-05 00:00:35 +03:00
|
|
|
QCompleter *_completer;
|
|
|
|
ShareeModel *_completerModel;
|
2015-11-16 16:18:01 +03:00
|
|
|
QTimer _completionTimer;
|
2015-11-05 00:00:35 +03:00
|
|
|
|
2015-11-01 00:21:09 +03:00
|
|
|
bool _isFile;
|
2016-01-12 16:35:35 +03:00
|
|
|
bool _disableCompleterActivated; // in order to avoid that we share the contents twice
|
2015-11-01 00:21:09 +03:00
|
|
|
ShareManager *_manager;
|
2016-04-29 15:11:27 +03:00
|
|
|
|
|
|
|
QProgressIndicator _pi_sharee;
|
2015-11-01 00:21:09 +03:00
|
|
|
};
|
|
|
|
|
2017-04-04 16:05:08 +03:00
|
|
|
/**
|
|
|
|
* The widget displayed for each user/group share
|
|
|
|
*/
|
|
|
|
class ShareUserLine : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ShareUserLine(QSharedPointer<Share> Share,
|
2017-05-17 11:55:42 +03:00
|
|
|
SharePermissions maxSharingPermissions,
|
|
|
|
bool isFile,
|
2018-11-11 12:56:22 +03:00
|
|
|
QWidget *parent = nullptr);
|
2017-04-04 16:05:08 +03:00
|
|
|
~ShareUserLine();
|
|
|
|
|
|
|
|
QSharedPointer<Share> share() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void visualDeletionDone();
|
|
|
|
void resizeRequested();
|
|
|
|
|
2019-12-09 22:59:10 +03:00
|
|
|
public slots:
|
|
|
|
void slotStyleChanged();
|
|
|
|
|
2017-04-04 16:05:08 +03:00
|
|
|
private slots:
|
|
|
|
void on_deleteShareButton_clicked();
|
|
|
|
void slotPermissionsChanged();
|
|
|
|
void slotEditPermissionsChanged();
|
|
|
|
void slotDeleteAnimationFinished();
|
|
|
|
|
|
|
|
void slotShareDeleted();
|
|
|
|
void slotPermissionsSet();
|
2017-05-17 11:55:42 +03:00
|
|
|
|
2017-11-21 12:18:15 +03:00
|
|
|
void slotAvatarLoaded(QImage avatar);
|
2015-12-21 18:19:09 +03:00
|
|
|
|
2017-04-04 16:05:08 +03:00
|
|
|
private:
|
|
|
|
void displayPermissions();
|
2015-12-21 18:19:09 +03:00
|
|
|
void loadAvatar();
|
2019-12-09 22:59:10 +03:00
|
|
|
void customizeStyle();
|
2017-04-04 16:05:08 +03:00
|
|
|
|
|
|
|
Ui::ShareUserLine *_ui;
|
|
|
|
QSharedPointer<Share> _share;
|
|
|
|
bool _isFile;
|
|
|
|
|
2018-08-02 17:42:06 +03:00
|
|
|
// _permissionEdit is a checkbox
|
|
|
|
QAction *_permissionReshare;
|
2019-05-29 00:07:22 +03:00
|
|
|
QAction *_deleteShareButton;
|
2017-04-04 16:05:08 +03:00
|
|
|
QAction *_permissionCreate;
|
2018-08-02 17:42:06 +03:00
|
|
|
QAction *_permissionChange;
|
2017-04-04 16:05:08 +03:00
|
|
|
QAction *_permissionDelete;
|
|
|
|
};
|
2015-11-01 00:21:09 +03:00
|
|
|
}
|
|
|
|
|
2015-11-05 11:58:16 +03:00
|
|
|
#endif // SHAREUSERGROUPWIDGET_H
|