diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp index 6fce57f39..f8c9e862d 100644 --- a/src/lib/other/qzsettings.cpp +++ b/src/lib/other/qzsettings.cpp @@ -46,6 +46,10 @@ void QzSettings::loadSettings() loadTabsOnActivation = settings.value("LoadTabsOnActivation", false).toBool(); autoOpenProtocols = settings.value("AutomaticallyOpenProtocols", QStringList()).toStringList(); blockedProtocols = settings.value("BlockOpeningProtocols", QStringList()).toStringList(); + allowJsGeometryChange = settings.value("allowJavaScriptGeometryChange", false).toBool(); + allowJsHideMenuBar = settings.value("allowJavaScriptHideMenuBar", false).toBool(); + allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", false).toBool(); + allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", false).toBool(); settings.endGroup(); settings.beginGroup("Browser-Tabs-Settings"); diff --git a/src/lib/other/qzsettings.h b/src/lib/other/qzsettings.h index b5a452606..24f0620bc 100644 --- a/src/lib/other/qzsettings.h +++ b/src/lib/other/qzsettings.h @@ -47,6 +47,10 @@ public: // Web-Browser-Settings int defaultZoom; bool loadTabsOnActivation; + bool allowJsGeometryChange; + bool allowJsHideMenuBar; + bool allowJsHideStatusBar; + bool allowJsHideToolBar; QStringList autoOpenProtocols; QStringList blockedProtocols; diff --git a/src/lib/popupwindow/popupwebpage.cpp b/src/lib/popupwindow/popupwebpage.cpp index 2ff9a2b56..1e1dcd750 100644 --- a/src/lib/popupwindow/popupwebpage.cpp +++ b/src/lib/popupwindow/popupwebpage.cpp @@ -21,6 +21,7 @@ #include "qupzilla.h" #include "tabwidget.h" #include "tabbedwebview.h" +#include "qzsettings.h" #include #include @@ -56,7 +57,7 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass) void PopupWebPage::slotGeometryChangeRequested(const QRect &rect) { - if (rect.isValid()) { + if (rect.isValid() && qzSettings->allowJsGeometryChange) { m_geometry = rect; m_createNewWindow = true; } @@ -64,16 +65,19 @@ void PopupWebPage::slotGeometryChangeRequested(const QRect &rect) void PopupWebPage::slotMenuBarVisibilityChangeRequested(bool visible) { + if (!qzSettings->allowJsHideMenuBar) return; m_menuBarVisible = visible; } void PopupWebPage::slotStatusBarVisibilityChangeRequested(bool visible) { + if (!qzSettings->allowJsHideStatusBar) return; m_statusBarVisible = visible; } void PopupWebPage::slotToolBarVisibilityChangeRequested(bool visible) { + if (!qzSettings->allowJsHideToolBar) return; m_toolBarVisible = visible; }