From 964c84a07e49b6ed7bd2e67b8284fb3ddde009db Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 4 Dec 2018 13:20:49 +0100 Subject: [PATCH] AccountSettings: add an item to open the folder in the browser from the selective sync context menu Issue: #6471 --- src/gui/accountsettings.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 4fbc90d241..d0f0ea7d48 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -34,6 +34,7 @@ #include "tooltipupdater.h" #include "filesystem.h" #include "wizard/owncloudwizard.h" +#include "guiutility.h" #include @@ -267,7 +268,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) QMenu *menu = new QMenu(tv); menu->setAttribute(Qt::WA_DeleteOnClose); - QAction *ac = menu->addAction(tr("Open folder")); + QAction *ac = menu->addAction(tr("Open local folder")); connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenCurrentLocalSubFolder); QString fileName = _model->data(index, FolderStatusDelegate::FolderPathRole).toString(); @@ -275,6 +276,21 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) ac->setEnabled(false); } + ac = menu->addAction(tr("Open folder in browser")); + auto info = _model->infoForIndex(index); + ASSERT(info); + QString path = info->_folder->remotePath(); + if (!path.endsWith(QLatin1Char('/'))) { + path += QLatin1Char('/'); + } + path += info->_path; + connect(ac, &QAction::triggered, this, [this, path]{ + fetchPrivateLinkUrl(_accountState->account(), path, {}, this, [](const QString &url) { + Utility::openBrowser(url, nullptr); + }); + }); + + menu->popup(tv->mapToGlobal(pos)); return; }