2015-11-05 11:58:16 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
* Copyright (C) 2015 by Klaas Freitag <freitag@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-05 11:58:16 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHARELINKWIDGET_H
|
|
|
|
#define SHARELINKWIDGET_H
|
|
|
|
|
|
|
|
#include "accountfwd.h"
|
2016-03-30 12:33:34 +03:00
|
|
|
#include "sharepermissions.h"
|
2015-11-05 11:58:16 +03:00
|
|
|
#include "QProgressIndicator.h"
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QList>
|
|
|
|
|
2017-04-05 10:38:46 +03:00
|
|
|
class QMenu;
|
2017-04-12 12:09:20 +03:00
|
|
|
class QTableWidgetItem;
|
2017-04-05 10:38:46 +03:00
|
|
|
|
2015-11-05 11:58:16 +03:00
|
|
|
namespace OCC {
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ShareLinkWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class AbstractCredentials;
|
|
|
|
class QuotaInfo;
|
|
|
|
class SyncResult;
|
|
|
|
class LinkShare;
|
|
|
|
class Share;
|
|
|
|
class ShareManager;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The ShareDialog class
|
|
|
|
* @ingroup gui
|
|
|
|
*/
|
|
|
|
class ShareLinkWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ShareLinkWidget(AccountPtr account,
|
|
|
|
const QString &sharePath,
|
|
|
|
const QString &localPath,
|
2016-03-30 12:33:34 +03:00
|
|
|
SharePermissions maxSharingPermissions,
|
2018-11-11 12:56:22 +03:00
|
|
|
QWidget *parent = nullptr);
|
2015-11-05 11:58:16 +03:00
|
|
|
~ShareLinkWidget();
|
|
|
|
void getShares();
|
2018-03-15 21:43:26 +03:00
|
|
|
void toggleButton(bool show);
|
2015-11-05 11:58:16 +03:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
|
2018-07-26 15:43:21 +03:00
|
|
|
//void slotShareSelectionChanged();
|
|
|
|
|
2018-08-19 13:43:12 +03:00
|
|
|
void slotCreateOrDeleteShareLink(bool checked);
|
2018-07-26 15:43:21 +03:00
|
|
|
void slotCreatePassword();
|
|
|
|
|
2017-04-05 10:38:46 +03:00
|
|
|
void slotExpireDateChanged(const QDate &date);
|
2018-08-19 20:37:21 +03:00
|
|
|
void slotSetExpireDate();
|
2017-04-05 10:38:46 +03:00
|
|
|
|
2017-11-15 17:01:48 +03:00
|
|
|
void slotContextMenuButtonClicked();
|
|
|
|
void slotLinkContextMenuActionTriggered(QAction *action);
|
2017-04-05 10:38:46 +03:00
|
|
|
|
|
|
|
void slotDeleteShareFetched();
|
2018-07-26 15:43:21 +03:00
|
|
|
void slotCreateShareFetched();
|
2017-04-05 10:38:46 +03:00
|
|
|
void slotCreateShareRequiresPassword(const QString &message);
|
2018-08-19 20:37:21 +03:00
|
|
|
|
2017-04-05 10:38:46 +03:00
|
|
|
void slotPasswordSet();
|
2018-08-19 20:37:21 +03:00
|
|
|
void slotExpireDateSet();
|
2015-11-05 11:58:16 +03:00
|
|
|
|
2016-01-22 13:56:05 +03:00
|
|
|
void slotServerError(int code, const QString &message);
|
|
|
|
void slotPasswordSetError(int code, const QString &message);
|
2015-11-05 11:58:16 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void displayError(const QString &errMsg);
|
2017-04-05 10:38:46 +03:00
|
|
|
|
2018-11-17 01:02:34 +03:00
|
|
|
void showPasswordOptions(bool show);
|
2018-07-26 15:43:21 +03:00
|
|
|
void togglePasswordOptions(bool enable);
|
2017-04-05 10:38:46 +03:00
|
|
|
void setPassword(const QString &password);
|
2018-07-26 15:43:21 +03:00
|
|
|
|
2018-11-17 01:02:34 +03:00
|
|
|
void showExpireDateOptions(bool show);
|
2018-07-26 15:43:21 +03:00
|
|
|
void toggleExpireDateOptions(bool enable);
|
2017-04-05 10:38:46 +03:00
|
|
|
void setExpireDate(const QDate &date);
|
|
|
|
|
|
|
|
void copyShareLink(const QUrl &url);
|
|
|
|
|
2017-11-15 17:01:48 +03:00
|
|
|
/** Confirm with the user and then delete the share */
|
2018-07-26 15:43:21 +03:00
|
|
|
void confirmAndDeleteShare();
|
2017-11-15 17:01:48 +03:00
|
|
|
|
|
|
|
/** Retrieve a share's name, accounting for _namesSupported */
|
2018-07-26 15:43:21 +03:00
|
|
|
QString shareName() const;
|
2017-11-15 17:01:48 +03:00
|
|
|
|
2018-08-19 20:37:21 +03:00
|
|
|
void toggleAnimation(bool start);
|
2015-11-05 11:58:16 +03:00
|
|
|
|
|
|
|
Ui::ShareLinkWidget *_ui;
|
|
|
|
AccountPtr _account;
|
|
|
|
QString _sharePath;
|
|
|
|
QString _localPath;
|
|
|
|
QString _shareUrl;
|
|
|
|
|
|
|
|
ShareManager *_manager;
|
2018-07-26 15:43:21 +03:00
|
|
|
QSharedPointer<LinkShare> _linkShare;
|
2015-11-05 11:58:16 +03:00
|
|
|
|
|
|
|
bool _isFile;
|
2015-12-01 14:43:14 +03:00
|
|
|
bool _passwordRequired;
|
2017-04-05 10:38:46 +03:00
|
|
|
bool _expiryRequired;
|
|
|
|
bool _namesSupported;
|
|
|
|
|
2018-07-26 15:43:21 +03:00
|
|
|
QMenu *_linkContextMenu;
|
|
|
|
QAction *_copyLinkAction;
|
|
|
|
QAction *_readOnlyLinkAction;
|
|
|
|
QAction *_allowEditingLinkAction;
|
|
|
|
QAction *_allowUploadEditingLinkAction;
|
|
|
|
QAction *_allowUploadLinkAction;
|
|
|
|
QAction *_passwordProtectLinkAction;
|
|
|
|
QAction *_expirationDateLinkAction;
|
|
|
|
QAction *_unshareLinkAction;
|
2015-11-05 11:58:16 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SHARELINKWIDGET_H
|