diff options
-rw-r--r-- | src/webengine/webview.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index 5307291..930b747 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -7,8 +7,13 @@ */ #include "webview.h" +#include "browser.h" +#include "conf.hpp" #include "subwindow/subwindow.h" +#include "wallet/wallet.h" #include "webpage.h" +#include "webprofile.h" +#include "webprofilemanager.h" #include <QContextMenuEvent> #include <QDialog> #include <QMenu> @@ -20,11 +25,6 @@ #include <QWebEngineContextMenuData> #include <QWebEngineHistoryItem> #include <QWidgetAction> -#include "webprofilemanager.h" -#include "webprofile.h" -#include "browser.h" -#include "wallet/wallet.h" -#include "conf.hpp" inline QAction *historyAction(QWebEngineView *view, const QWebEngineHistoryItem &item) { @@ -212,6 +212,18 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) page()->triggerAction(QWebEnginePage::ReloadAndBypassCache); }); + menu->addSeparator(); + + connect(menu->addAction(tr("Select All")), &QAction::triggered, this, [this]() { + page()->triggerAction(QWebEnginePage::SelectAll); + }); + connect(menu->addAction(tr("Clear Selection")), &QAction::triggered, this, [this]() { + page()->triggerAction(QWebEnginePage::Unselect); + }); + connect(menu->addAction(tr("Copy to clipboard")), &QAction::triggered, this, [this]() { + page()->triggerAction(QWebEnginePage::Copy); + }); + } else if(ctxdata.mediaType() == QWebEngineContextMenuData::MediaTypeImage) { connect(menu->addAction(tr("Copy image to clipboard")), &QAction::triggered, this, [this]() { page()->triggerAction(QWebEnginePage::CopyImageToClipboard); @@ -245,7 +257,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) }); auto *newTabMenu = menu->addMenu(tr("Open link in new tab with profile")); - dynamic_cast<Browser*>(qApp)->getProfileManager()->profileMenu(newTabMenu, [this, ctxdata](WebProfile *profile) { + dynamic_cast<Browser *>(qApp)->getProfileManager()->profileMenu(newTabMenu, [this, ctxdata](WebProfile *profile) { auto *view = this->createWindow(QWebEnginePage::WebBrowserTab); view->setProfile(profile); view->load(ctxdata.linkUrl()); |