]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.cpp
Partial filter list implementation.
[PrivacyBrowserPC.git] / src / widgets / TabWidget.cpp
index f65c79ea2177b404eef157f441245dab7175ed73..0728ecc7cd4375ef81e03a76421b30af1f401673 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
  *
- * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+ * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc/>.
  *
  * Privacy Browser PC is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -452,12 +452,20 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const
     // Plugins must be enabled for the PDF viewer to work.  <https://doc.qt.io/qt-5/qtwebengine-features.html#pdf-file-viewing>
     webEngineSettingsPointer->setAttribute(QWebEngineSettings::PluginsEnabled, true);
 
+    // Update the blocked requests action.
+    connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::requestBlocked, [this, privacyWebEngineViewPointer] (const int blockedRequests)
+    {
+        // Update the blocked requests action if the specified privacy WebEngine view is the current privacy WebEngine view.
+        if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+            emit blockedRequestsUpdated(blockedRequests);
+    });
+
     // Update the cookies action.
-    connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::updateCookiesAction, [this, privacyWebEngineViewPointer] (const int numberOfCookies)
+    connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::numberOfCookiesChanged, [this, privacyWebEngineViewPointer] (const int numberOfCookies)
     {
         // Update the cookie action if the specified privacy WebEngine view is the current privacy WebEngine view.
         if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
-            emit updateCookiesAction(numberOfCookies);
+            emit cookiesChanged(numberOfCookies);
     });
 
     // Process cookie changes.
@@ -1264,9 +1272,10 @@ void TabWidget::updateUiWithTabSettings()
     DevToolsWebEngineView *devToolsWebEngineViewPointer = qTabWidgetPointer->currentWidget()->findChild<DevToolsWebEngineView *>();
 
     // Update the actions.
+    emit blockedRequestsUpdated(currentPrivacyWebEngineViewPointer->blockedRequests);
+    emit cookiesChanged(currentPrivacyWebEngineViewPointer->cookieListPointer->size());
     emit updateDefaultZoomFactor(currentPrivacyWebEngineViewPointer->defaultZoomFactor);
     emit updateBackAction(currentWebEngineHistoryPointer->canGoBack());
-    emit updateCookiesAction(currentPrivacyWebEngineViewPointer->cookieListPointer->size());
     emit updateDeveloperToolsAction(devToolsWebEngineViewPointer->isVisible());
     emit updateDomStorageAction(currentWebEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
     emit updateForwardAction(currentWebEngineHistoryPointer->canGoForward());