/*
* 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
#include "TabWidget.h"
#include "Settings.h"
#include "ui_AddTabWidget.h"
-#include "ui_Tab.h"
#include "ui_TabWidget.h"
#include "databases/CookiesDatabase.h"
#include "dialogs/SaveDialog.h"
#include <QPrintDialog>
#include <QPrintPreviewDialog>
#include <QPrinter>
+#include <QSplitter>
// Initialize the public static variables.
QString TabWidget::webEngineDefaultUserAgent = QLatin1String("");
// 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.
void TabWidget::refresh() const
{
+ // Reset the HTTP authentication dialog counter.
+ currentPrivacyWebEngineViewPointer->httpAuthenticationDialogsDisplayed = 0;
+
// Reload the website.
currentPrivacyWebEngineViewPointer->reload();
}
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());