// Prepare sharing menu
_shareLinkMenu = new QMenu(this);
+ connect(_shareLinkMenu, SIGNAL(triggered(QAction *)),
+ SLOT(slotShareLinkActionTriggered(QAction *)));
_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)"));
auto shareButton = new QToolButton;
shareButton->setText("...");
shareButton->setProperty(propertyShareC, QVariant::fromValue(linkShare));
- shareButton->setMenu(_shareLinkMenu);
- shareButton->setPopupMode(QToolButton::InstantPopup);
- connect(shareButton, SIGNAL(triggered(QAction *)), SLOT(slotShareLinkButtonTriggered(QAction *)));
+ connect(shareButton, SIGNAL(clicked(bool)), SLOT(slotShareLinkButtonClicked()));
table->setCellWidget(row, 1, shareButton);
auto deleteButton = new QToolButton;
Utility::openBrowser(url, this);
}
-void ShareLinkWidget::slotShareLinkButtonTriggered(QAction *action)
+void ShareLinkWidget::slotShareLinkButtonClicked()
+{
+ auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
+ bool downloadEnabled = share->getShowFileListing();
+ _copyDirectLinkAction->setVisible(downloadEnabled);
+ _emailDirectLinkAction->setVisible(downloadEnabled);
+
+ _shareLinkMenu->setProperty(propertyShareC, QVariant::fromValue(share));
+ _shareLinkMenu->exec(QCursor::pos());
+}
+
+void ShareLinkWidget::slotShareLinkActionTriggered(QAction *action)
{
auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
void slotPasswordChanged(const QString &newText);
void slotNameEdited(QTableWidgetItem *item);
- void slotShareLinkButtonTriggered(QAction *action);
+ void slotShareLinkButtonClicked();
+ void slotShareLinkActionTriggered(QAction *action);
void slotDeleteShareFetched();
void slotCreateShareFetched(const QSharedPointer<LinkShare> share);