2011-02-04 Kundu Suchismita <suchi.kundu@nokia.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 03:11:50 +0000 (03:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 03:11:50 +0000 (03:11 +0000)
        Reviewed by Andreas Kling.

        Local Storage settings can be enable/disable from "Develop" menu
        https://bugs.webkit.org/show_bug.cgi?id=52296

        * QtTestBrowser/launcherwindow.cpp:
        (LauncherWindow::createChrome):
        (LauncherWindow::toggleLocalStorage):
        (LauncherWindow::toggleOfflineStorageDatabase):
        (LauncherWindow::toggleOfflineWebApplicationCache):
        (LauncherWindow::setOfflineStorageDefaultQuota):
        * QtTestBrowser/launcherwindow.h:
        (WindowOptions::WindowOptions):
        * QtTestBrowser/main.cpp:
        (LauncherApplication::handleUserOptions):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77725 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/QtTestBrowser/launcherwindow.cpp
Tools/QtTestBrowser/launcherwindow.h
Tools/QtTestBrowser/main.cpp

index d06344984b6e5acdd785c1685b6be80705309386..1f042cabd283dd800d53537a9e9ea87548fa0338 100644 (file)
@@ -1,3 +1,21 @@
+2011-02-04  Kundu Suchismita  <suchi.kundu@nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        Local Storage settings can be enable/disable from "Develop" menu
+        https://bugs.webkit.org/show_bug.cgi?id=52296
+
+        * QtTestBrowser/launcherwindow.cpp:
+        (LauncherWindow::createChrome):
+        (LauncherWindow::toggleLocalStorage):
+        (LauncherWindow::toggleOfflineStorageDatabase):
+        (LauncherWindow::toggleOfflineWebApplicationCache):
+        (LauncherWindow::setOfflineStorageDefaultQuota):
+        * QtTestBrowser/launcherwindow.h:
+        (WindowOptions::WindowOptions):
+        * QtTestBrowser/main.cpp:
+        (LauncherApplication::handleUserOptions):
+
 2011-02-04  Tony Chang  <tony@chromium.org>
 
         Reviewed by Eric Seidel.
index 666942f4edfb4ed337166d654cefacba94dd5816..21f43c56aa731cb38fd451620800d3e5a6469574 100644 (file)
@@ -264,6 +264,24 @@ void LauncherWindow::createChrome()
 
     toolsMenu->addSeparator();
 
+    QAction* toggleLocalStorage = toolsMenu->addAction("Enable Local Storage", this, SLOT(toggleLocalStorage(bool)));
+    toggleLocalStorage->setCheckable(true);
+    toggleLocalStorage->setChecked(m_windowOptions.useLocalStorage);
+
+    QAction* toggleOfflineStorageDatabase = toolsMenu->addAction("Enable Offline Storage Database", this, SLOT(toggleOfflineStorageDatabase(bool)));
+    toggleOfflineStorageDatabase->setCheckable(true);
+    toggleOfflineStorageDatabase->setChecked(m_windowOptions.useOfflineStorageDatabase);
+
+    QAction* toggleOfflineWebApplicationCache = toolsMenu->addAction("Enable Offline Web Application Cache", this, SLOT(toggleOfflineWebApplicationCache(bool)));
+    toggleOfflineWebApplicationCache->setCheckable(true);
+    toggleOfflineWebApplicationCache->setChecked(m_windowOptions.useOfflineWebApplicationCache);
+
+    QAction* offlineStorageDefaultQuotaAction = toolsMenu->addAction("Set Offline Storage Default Quota Size", this, SLOT(setOfflineStorageDefaultQuota()));
+    offlineStorageDefaultQuotaAction->setCheckable(true);
+    offlineStorageDefaultQuotaAction->setChecked(m_windowOptions.offlineStorageDefaultQuotaSize);
+
+    toolsMenu->addSeparator();
+
     QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
     userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U));
 
@@ -902,6 +920,38 @@ void LauncherWindow::updateFPS(int fps)
 #endif
 }
 
+void LauncherWindow::toggleLocalStorage(bool toggle)
+{
+    m_windowOptions.useLocalStorage = toggle;
+    page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, toggle);
+}
+
+void LauncherWindow::toggleOfflineStorageDatabase(bool toggle)
+{
+    m_windowOptions.useOfflineStorageDatabase = toggle;
+    page()->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, toggle);
+}
+
+void LauncherWindow::toggleOfflineWebApplicationCache(bool toggle)
+{
+    m_windowOptions.useOfflineWebApplicationCache = toggle;
+    page()->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, toggle);
+}
+
+void LauncherWindow::setOfflineStorageDefaultQuota()
+{
+    // For command line execution, quota size is taken from command line.   
+    if (m_windowOptions.offlineStorageDefaultQuotaSize)
+        page()->settings()->setOfflineStorageDefaultQuota(m_windowOptions.offlineStorageDefaultQuotaSize);
+    else {
+        bool ok;
+        // Maximum size is set to 25 * 1024 * 1024.
+        int quotaSize = QInputDialog::getInt(this, "Offline Storage Default Quota Size" , "Quota Size", 0, 0, 26214400, 1, &ok);
+        if (ok) 
+            page()->settings()->setOfflineStorageDefaultQuota(quotaSize);
+    }
+}
+
 LauncherWindow* LauncherWindow::newWindow()
 {
     LauncherWindow* mw = new LauncherWindow(&m_windowOptions);
index 4487f658ac110bfe47c192e0aa1366661fab2c56..c879318483ea416925714ca7a545fa72ebbeb416 100644 (file)
@@ -94,6 +94,10 @@ public:
         , showFrameRate(false)
         , resizesToContents(false)
         , viewportUpdateMode(QGraphicsView::MinimalViewportUpdate)
+        , useLocalStorage(false)
+        , useOfflineStorageDatabase(false)
+        , useOfflineWebApplicationCache(false)
+        , offlineStorageDefaultQuotaSize(0)
 #if defined(QT_CONFIGURED_WITH_OPENGL)
         , useQGLWidgetViewport(false)
 #endif
@@ -115,6 +119,10 @@ public:
 #endif
     QUrl inspectorUrl;
     quint16 remoteInspectorPort;
+    bool useLocalStorage;
+    bool useOfflineStorageDatabase;
+    bool useOfflineWebApplicationCache;
+    quint64 offlineStorageDefaultQuotaSize;
 };
 
 class LauncherWindow : public MainWindow {
@@ -165,6 +173,10 @@ protected slots:
     void toggleJavascriptCanOpenWindows(bool enable);
     void toggleAutoLoadImages(bool enable);
     void togglePlugins(bool enable);
+    void toggleLocalStorage(bool toggle);
+    void toggleOfflineStorageDatabase(bool toggle);
+    void toggleOfflineWebApplicationCache(bool toggle);
+    void setOfflineStorageDefaultQuota();
 
 #if defined(QT_CONFIGURED_WITH_OPENGL)
     void toggleQGLWidgetViewport(bool enable);
index ec5f1d9408de2bb31d9bf4cdc291b94c5438fad2..eecd9c30dc3acb3e9bd1926c3e27cf7692a481e1 100644 (file)
@@ -164,18 +164,18 @@ void LauncherApplication::handleUserOptions()
     }
     
     if (args.contains("-local-storage-enabled"))
-        QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+        windowOptions.useLocalStorage = true;
         
     if (args.contains("-offline-storage-database-enabled"))
-        QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
+        windowOptions.useOfflineStorageDatabase = true;
         
     if (args.contains("-offline-web-application-cache-enabled"))   
-        QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
+        windowOptions.useOfflineWebApplicationCache = true;
     
     int setOfflineStorageDefaultQuotaIndex = args.indexOf("-set-offline-storage-default-quota");
     if (setOfflineStorageDefaultQuotaIndex != -1) {
-        int maxSize = takeOptionValue(&args, setOfflineStorageDefaultQuotaIndex).toInt();
-        QWebSettings::globalSettings()->setOfflineStorageDefaultQuota(maxSize);
+        unsigned int maxSize = takeOptionValue(&args, setOfflineStorageDefaultQuotaIndex).toUInt();
+        windowOptions.offlineStorageDefaultQuotaSize = maxSize;
     }   
     
     if (defaultForAnimations)