aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-11-09 22:09:47 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2019-11-09 22:09:47 +0200
commitb146ece4f63334b95e0e29409239b98d506d4e80 (patch)
treeb7ff28bc74da14e07bdae831ebeb85a07f9786d1
parentAdd configuration subcommand (diff)
downloadsmolbote-b146ece4f63334b95e0e29409239b98d506d4e80.tar.xz
Context menu: add actions for MediaTypeNone
- Select All - Clear Selection - Copy
-rw-r--r--src/webengine/webview.cpp24
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());