mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
AccountSettings: add an item to open the folder in the browser
from the selective sync context menu Issue: #6471
This commit is contained in:
parent
07c134b67e
commit
964c84a07e
@ -34,6 +34,7 @@
|
||||
#include "tooltipupdater.h"
|
||||
#include "filesystem.h"
|
||||
#include "wizard/owncloudwizard.h"
|
||||
#include "guiutility.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user