Commit ca411388 authored by zoltan@webkit.org's avatar zoltan@webkit.org

[Qt] Add Toggle Frame Flattening, Auto Load Images and Disable JavaScript actions to MiniBrowser.

https://bugs.webkit.org/show_bug.cgi?id=53489

Reviewed by Andreas Kling.

Add Toggle Frame Flattening action to Develop menu. Add Auto Load Images and Disable JavaScript actions
to Settings menu.

* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::toggleFrameFlattening):
(BrowserWindow::toggleDisableJavaScript):
(BrowserWindow::toggleAutoLoadImages):
* MiniBrowser/qt/BrowserWindow.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 78ca2f28
2011-02-01 Zoltan Horvath <zoltan@webkit.org>
Reviewed by Andreas Kling.
[Qt] Add Toggle Frame Flattening, Auto Load Images and Disable JavaScript actions to MiniBrowser.
https://bugs.webkit.org/show_bug.cgi?id=53489
Add Toggle Frame Flattening action to Develop menu. Add Auto Load Images and Disable JavaScript actions
to Settings menu.
* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::toggleFrameFlattening):
(BrowserWindow::toggleDisableJavaScript):
(BrowserWindow::toggleAutoLoadImages):
* MiniBrowser/qt/BrowserWindow.h:
2011-01-31 Mihai Parparita <mihaip@chromium.org> 2011-01-31 Mihai Parparita <mihaip@chromium.org>
Reviewed by Tony Chang. Reviewed by Tony Chang.
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "BrowserWindow.h" #include "BrowserWindow.h"
#include "qwkpreferences.h"
static QWKPage* newPageFunction(QWKPage* page) static QWKPage* newPageFunction(QWKPage* page)
{ {
BrowserWindow* window = new BrowserWindow(page->context()); BrowserWindow* window = new BrowserWindow(page->context());
...@@ -76,8 +78,20 @@ BrowserWindow::BrowserWindow(QWKContext* context) ...@@ -76,8 +78,20 @@ BrowserWindow::BrowserWindow(QWKContext* context)
resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
QMenu* toolsMenu = menuBar()->addMenu("&Develop"); QMenu* toolsMenu = menuBar()->addMenu("&Develop");
QAction* toggleFrameFlattening = toolsMenu->addAction("Toggle Frame Flattening", this, SLOT(toggleFrameFlattening(bool)));
toggleFrameFlattening->setCheckable(true);
toggleFrameFlattening->setChecked(false);
toolsMenu->addSeparator();
toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog())); toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
QMenu* settingsMenu = menuBar()->addMenu("&Settings");
QAction* toggleAutoLoadImages = settingsMenu->addAction("Disable Auto Load Images", this, SLOT(toggleAutoLoadImages(bool)));
toggleAutoLoadImages->setCheckable(true);
toggleAutoLoadImages->setChecked(false);
QAction* toggleDisableJavaScript = settingsMenu->addAction("Disable JavaScript", this, SLOT(toggleDisableJavaScript(bool)));
toggleDisableJavaScript->setCheckable(true);
toggleDisableJavaScript->setChecked(false);
m_addressBar = new QLineEdit(); m_addressBar = new QLineEdit();
connect(m_addressBar, SIGNAL(returnPressed()), SLOT(changeLocation())); connect(m_addressBar, SIGNAL(returnPressed()), SLOT(changeLocation()));
...@@ -251,6 +265,13 @@ void BrowserWindow::toggleZoomTextOnly(bool b) ...@@ -251,6 +265,13 @@ void BrowserWindow::toggleZoomTextOnly(bool b)
m_isZoomTextOnly = b; m_isZoomTextOnly = b;
} }
void BrowserWindow::toggleFrameFlattening(bool toggle)
{
page()->preferences()->setAttribute(QWKPreferences::FrameFlatteningEnabled, toggle);
}
void BrowserWindow::showUserAgentDialog() void BrowserWindow::showUserAgentDialog()
{ {
updateUserAgentList(); updateUserAgentList();
...@@ -280,6 +301,16 @@ void BrowserWindow::showUserAgentDialog() ...@@ -280,6 +301,16 @@ void BrowserWindow::showUserAgentDialog()
page()->setCustomUserAgent(combo->currentText()); page()->setCustomUserAgent(combo->currentText());
} }
void BrowserWindow::toggleDisableJavaScript(bool enable)
{
page()->preferences()->setAttribute(QWKPreferences::JavascriptEnabled, !enable);
}
void BrowserWindow::toggleAutoLoadImages(bool enable)
{
page()->preferences()->setAttribute(QWKPreferences::AutoLoadImages, !enable);
}
void BrowserWindow::updateUserAgentList() void BrowserWindow::updateUserAgentList()
{ {
QFile file(":/useragentlist.txt"); QFile file(":/useragentlist.txt");
......
...@@ -63,8 +63,12 @@ protected slots: ...@@ -63,8 +63,12 @@ protected slots:
void toggleZoomTextOnly(bool on); void toggleZoomTextOnly(bool on);
void screenshot(); void screenshot();
void toggleFrameFlattening(bool);
void showUserAgentDialog(); void showUserAgentDialog();
void toggleAutoLoadImages(bool);
void toggleDisableJavaScript(bool);
private: private:
void updateUserAgentList(); void updateUserAgentList();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment