1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

[jsoptions] Added "Disable or change context menu" option

User can now set whether sites are allowed to change or
completely disable context menu.
This commit is contained in:
nowrep 2013-02-06 18:17:50 +01:00
parent 60550fcbfb
commit f6de3bd5a0
8 changed files with 31 additions and 4 deletions

View File

@ -15,6 +15,7 @@ Version 1.4.0
* use .qupzilla/tmp instead of /tmp for temporary data
* saving passwords should now work for much more sites
* don't steal Ctrl+B/U/I shortcuts from page
* fixed scrolling to anchor in background tabs
* fixed parsing UTF-8 filenames in Content-Disposition header
* fixed crash with context menu in websearchbar and locationbar
* fixed loading NYTimes skimmer page

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -50,6 +50,7 @@ void QzSettings::loadSettings()
allowJsHideMenuBar = settings.value("allowJavaScriptHideMenuBar", true).toBool();
allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", true).toBool();
allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", true).toBool();
allowJsDisableContextMenu = settings.value("allowJavaScriptDisableContextMenu", true).toBool();
settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings");

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -51,6 +51,7 @@ public:
bool allowJsHideMenuBar;
bool allowJsHideStatusBar;
bool allowJsHideToolBar;
bool allowJsDisableContextMenu;
QStringList autoOpenProtocols;
QStringList blockedProtocols;

View File

@ -39,6 +39,7 @@ JsOptions::JsOptions(QWidget* parent)
ui->jscanHideMenu->setChecked(settings.value("allowJavaScriptHideMenuBar", true).toBool());
ui->jscanHideStatus->setChecked(settings.value("allowJavaScriptHideStatusBar", true).toBool());
ui->jscanHideTool->setChecked(settings.value("allowJavaScriptHideToolBar", true).toBool());
ui->jscanDisableContextMenu->setChecked(settings.value("allowJavaScriptDisableContextMenu", true).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", false).toBool());
settings.endGroup();
@ -59,6 +60,7 @@ void JsOptions::accept()
settings.setValue("allowJavaScriptHideMenuBar", ui->jscanHideMenu->isChecked());
settings.setValue("allowJavaScriptHideStatusBar", ui->jscanHideStatus->isChecked());
settings.setValue("allowJavaScriptHideToolBar", ui->jscanHideTool->isChecked());
settings.setValue("allowJavaScriptDisableContextMenu", ui->jscanDisableContextMenu->isChecked());
settings.setValue("allowJavaScriptAccessClipboard", ui->jscanAccessClipboard->isChecked());
settings.endGroup();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>214</width>
<height>261</height>
<width>240</width>
<height>286</height>
</rect>
</property>
<property name="windowTitle">
@ -78,6 +78,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="jscanDisableContextMenu">
<property name="text">
<string>Disable or change context menu</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="jscanAccessClipboard">
<property name="text">

View File

@ -679,6 +679,16 @@ void WebView::showClickedFrameSource()
showSource(m_clickedFrame);
}
bool WebView::event(QEvent* event)
{
if (event->type() == QEvent::ContextMenu && !qzSettings->allowJsDisableContextMenu) {
contextMenuEvent(static_cast<QContextMenuEvent*>(event));
return true;
}
return QWebView::event(event);
}
void WebView::printPage(QWebFrame* frame)
{
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);

View File

@ -121,6 +121,7 @@ protected slots:
void showClickedFrameSource();
protected:
bool event(QEvent* event);
void wheelEvent(QWheelEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);

View File

@ -1699,6 +1699,10 @@
<source>Access clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable or change context menu</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LicenseViewer</name>