Share dialog: Add option to copy/email direct links #5627

This commit is contained in:
Christian Kamm 2017-05-02 12:58:01 +02:00 committed by Markus Goetz
parent 3db8d3dfb6
commit d709a47b93
4 changed files with 23 additions and 4 deletions

View file

@ -153,7 +153,9 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
_shareLinkMenu = new QMenu(this);
_openLinkAction = _shareLinkMenu->addAction(tr("Open link in browser"));
_copyLinkAction = _shareLinkMenu->addAction(tr("Copy link to clipboard"));
_copyDirectLinkAction = _shareLinkMenu->addAction(tr("Copy link to clipboard (direct download)"));
_emailLinkAction = _shareLinkMenu->addAction(tr("Send link by email"));
_emailDirectLinkAction = _shareLinkMenu->addAction(tr("Send link by email (direct download)"));
/*
* Create the share manager and connect it properly
@ -533,14 +535,17 @@ void ShareLinkWidget::openShareLink(const QUrl &url)
void ShareLinkWidget::slotShareLinkButtonTriggered(QAction *action)
{
auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
QUrl url = share->getLink();
if (action == _copyLinkAction) {
copyShareLink(url);
copyShareLink(share->getLink());
} else if (action == _copyDirectLinkAction) {
copyShareLink(share->getDirectDownloadLink());
} else if (action == _emailLinkAction) {
emailShareLink(url);
emailShareLink(share->getLink());
} else if (action == _emailDirectLinkAction) {
emailShareLink(share->getDirectDownloadLink());
} else if (action == _openLinkAction) {
openShareLink(url);
openShareLink(share->getLink());
}
}

View file

@ -123,7 +123,9 @@ private:
QMenu *_shareLinkMenu;
QAction *_openLinkAction;
QAction *_copyLinkAction;
QAction *_copyDirectLinkAction;
QAction *_emailLinkAction;
QAction *_emailDirectLinkAction;
};
}

View file

@ -109,6 +109,13 @@ QUrl LinkShare::getLink() const
return _url;
}
QUrl LinkShare::getDirectDownloadLink() const
{
QUrl url = _url;
url.setPath(url.path() + "/download");
return url;
}
QDate LinkShare::getExpireDate() const
{
return _expireDate;

View file

@ -144,6 +144,11 @@ public:
*/
QUrl getLink() const;
/*
* The share's link for direct downloading.
*/
QUrl getDirectDownloadLink() const;
/*
* Get the publicUpload status of this share
*/