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"
|
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>
|
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 {
|
2015-11-05 11:58:16 +03:00
|
|
|
class ShareUserGroupWidget;
|
2017-04-04 16:05:08 +03:00
|
|
|
class ShareUserLine;
|
2015-11-01 00:21:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
class AbstractCredentials;
|
|
|
|
class QuotaInfo;
|
|
|
|
class SyncResult;
|
|
|
|
class Share;
|
2015-11-05 14:30:34 +03:00
|
|
|
class Sharee;
|
2015-11-01 00:21:09 +03:00
|
|
|
class ShareManager;
|
2015-11-05 00:00:35 +03:00
|
|
|
class ShareeModel;
|
2015-11-01 00:21:09 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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:
|
2015-11-05 11:58:16 +03:00
|
|
|
explicit ShareUserGroupWidget(AccountPtr account,
|
2015-11-01 00:21:09 +03:00
|
|
|
const QString &sharePath,
|
|
|
|
const QString &localPath,
|
2016-03-30 12:33:34 +03:00
|
|
|
SharePermissions maxSharingPermissions,
|
2017-09-15 15:24:34 +03:00
|
|
|
const QString &privateLinkUrl,
|
2015-11-01 00:21:09 +03:00
|
|
|
QWidget *parent = 0);
|
2015-11-05 11:58:16 +03:00
|
|
|
~ShareUserGroupWidget();
|
2015-11-02 00:23:22 +03:00
|
|
|
|
|
|
|
public slots:
|
2015-11-01 00:21:09 +03:00
|
|
|
void getShares();
|
|
|
|
|
|
|
|
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);
|
2015-11-17 12:24:35 +03:00
|
|
|
void searchForSharees();
|
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();
|
2015-11-05 00:00:35 +03:00
|
|
|
void slotCompleterActivated(const QModelIndex &index);
|
2015-12-10 16:56:15 +03:00
|
|
|
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();
|
2016-01-12 15:19:33 +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:
|
2015-11-05 11:58:16 +03:00
|
|
|
Ui::ShareUserGroupWidget *_ui;
|
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,
|
|
|
|
SharePermissions maxSharingPermissions,
|
|
|
|
bool isFile,
|
|
|
|
QWidget *parent = 0);
|
|
|
|
~ShareUserLine();
|
|
|
|
|
|
|
|
QSharedPointer<Share> share() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void visualDeletionDone();
|
|
|
|
void resizeRequested();
|
|
|
|
|
|
|
|
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();
|
2017-04-04 16:05:08 +03:00
|
|
|
|
|
|
|
Ui::ShareUserLine *_ui;
|
|
|
|
QSharedPointer<Share> _share;
|
|
|
|
bool _isFile;
|
|
|
|
|
|
|
|
QAction *_permissionCreate;
|
|
|
|
QAction *_permissionUpdate;
|
|
|
|
QAction *_permissionDelete;
|
|
|
|
};
|
2015-11-01 00:21:09 +03:00
|
|
|
}
|
|
|
|
|
2015-11-05 11:58:16 +03:00
|
|
|
#endif // SHAREUSERGROUPWIDGET_H
|