diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-12 10:46:24 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-12 10:46:24 +0200 |
commit | e1ef4f376be81cd664912fe8e16660c0c6092989 (patch) | |
tree | 2535e05adad18ff473fdaf8e546f898ef402e9fa /src/webengine | |
parent | WebView: always add Open link actions if the link URL is not empty (diff) | |
download | smolbote-e1ef4f376be81cd664912fe8e16660c0c6092989.tar.xz |
WebView: add Open in new tab and Save actions for images
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/webview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index e77acc7..9f7385e 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -161,6 +161,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(menu->addAction(tr("Copy image URL to clipboard")), &QAction::triggered, this, [this]() { page()->triggerAction(QWebEnginePage::CopyImageUrlToClipboard); }); + if(!ctxdata.mediaUrl().isEmpty()) { + connect(menu->addAction(tr("Open image in new tab")), &QAction::triggered, this, [this, ctxdata]() { + createWindow(QWebEnginePage::WebBrowserTab)->load(ctxdata.mediaUrl()); + }); + connect(menu->addAction(tr("Save image")), &QAction::triggered, this, [this, ctxdata]() { + page()->download(ctxdata.mediaUrl()); + }); + } } else { delete menu; |