1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01: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 * use .qupzilla/tmp instead of /tmp for temporary data
* saving passwords should now work for much more sites * saving passwords should now work for much more sites
* don't steal Ctrl+B/U/I shortcuts from page * 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 parsing UTF-8 filenames in Content-Disposition header
* fixed crash with context menu in websearchbar and locationbar * fixed crash with context menu in websearchbar and locationbar
* fixed loading NYTimes skimmer page * fixed loading NYTimes skimmer page

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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(); allowJsHideMenuBar = settings.value("allowJavaScriptHideMenuBar", true).toBool();
allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", true).toBool(); allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", true).toBool();
allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", true).toBool(); allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", true).toBool();
allowJsDisableContextMenu = settings.value("allowJavaScriptDisableContextMenu", true).toBool();
settings.endGroup(); settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings"); settings.beginGroup("Browser-Tabs-Settings");

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -51,6 +51,7 @@ public:
bool allowJsHideMenuBar; bool allowJsHideMenuBar;
bool allowJsHideStatusBar; bool allowJsHideStatusBar;
bool allowJsHideToolBar; bool allowJsHideToolBar;
bool allowJsDisableContextMenu;
QStringList autoOpenProtocols; QStringList autoOpenProtocols;
QStringList blockedProtocols; QStringList blockedProtocols;

View File

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

View File

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

View File

@ -679,6 +679,16 @@ void WebView::showClickedFrameSource()
showSource(m_clickedFrame); 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) void WebView::printPage(QWebFrame* frame)
{ {
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);

View File

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

View File

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