]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/windows/BrowserWindow.cpp
Replace the for loops in CookiesDialog with while loops. https://redmine.stoutner...
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.cpp
index 15b683e77f114e7342e11e5c7ea926631384f1ce..d3800ad8e1674c93b7c54e77c0be5618c62eed6f 100644 (file)
@@ -175,9 +175,9 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     domStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-web-browser-dom-tree")));
 
     // Update the on-the-fly menus.
-    connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString)));
+    connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString, bool)), this, SLOT(updateUserAgentActions(QString, bool)));
     connect(browserViewPointer, SIGNAL(updateZoomFactorAction(double)), this, SLOT(updateZoomFactorAction(double)));
-    connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString)), this, SLOT(updateSearchEngineActions(QString)));
+    connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString, bool)), this, SLOT(updateSearchEngineActions(QString, bool)));
 
     // Apply the on-the-fly settings when selected.
     connect(userAgentActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlyUserAgent(QAction*)));
@@ -279,7 +279,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
 void BrowserWindow::addCookieToList(const QNetworkCookie &newCookie) const
 {
-    qDebug() << "Add cookie:  " << newCookie.toRawForm();
+    //qDebug() << "Add cookie:  " << newCookie.toRawForm();
 
     // Add the new cookie to the list.
     cookieListPointer->push_front(newCookie);
@@ -440,7 +440,7 @@ void BrowserWindow::refresh() const
 
 void BrowserWindow::removeCookieFromList(const QNetworkCookie &cookie) const
 {
-    qDebug() << "Remove cookie:  " << cookie.toRawForm();
+    //qDebug() << "Remove cookie:  " << cookie.toRawForm();
 
     // Remove the cookie from the list.
     cookieListPointer->remove(cookie);
@@ -620,7 +620,7 @@ void BrowserWindow::updateLocalStorageAction(const bool &isEnabled)
     domStorageActionPointer->setEnabled(localStorageEnabled & javaScriptEnabled);
 }
 
-void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
+void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus)
 {
     // Initialize the custom search engine flag.
     bool customSearchEngine = false;
@@ -681,18 +681,22 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
         // Update the search engine menu action text.
         searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Custom"));
 
+        // Set the custom search engine text.
+        searchEngineCustomActionPointer->setText(searchEngine);
+
         // Set the custom search engine flag.
         customSearchEngine = true;
     }
 
+    // Update the custom search engine enabled boolean.
+    if (updateCustomSearchEngineStatus)
+        customSearchEngineEnabled = customSearchEngine;
+
     // Format the custom search engine.
-    if (customSearchEngine)
+    if (customSearchEngineEnabled)
     {
         // Enable the custom search engine.
         searchEngineCustomActionPointer->setEnabled(true);
-
-        // Set the custom search engine text.
-        searchEngineCustomActionPointer->setText(searchEngine);
     }
     else
     {
@@ -704,7 +708,7 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
     }
 }
 
-void BrowserWindow::updateUserAgentActions(const QString &userAgent) const
+void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus)
 {
     // Initialize the custom user agent flag.
     bool customUserAgent = false;
@@ -782,19 +786,23 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent) const
         // Update the user agent menu action text.
         userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Custom"));
 
+        // Set the custom user agent text.
+        userAgentCustomActionPointer->setText(userAgent);
+
         // Set the custom user agent flag.
         customUserAgent = true;
     }
 
+    // Update the custom user agent enabled boolean.
+    if (updateCustomUserAgentStatus)
+        customUserAgentEnabled = customUserAgent;
+
 
     // Format the custom user agent.
-    if (customUserAgent)
+    if (customUserAgentEnabled)
     {
         // Enable the custom user agent.
         userAgentCustomActionPointer->setEnabled(true);
-
-        // Set the custom user agent text.
-        userAgentCustomActionPointer->setText(userAgent);
     }
     else
     {