]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.h
Block all CSP requests. https://redmine.stoutner.com/issues/1193
[PrivacyBrowserPC.git] / src / widgets / TabWidget.h
index 6130fc3ee75fc27b987c26c1e726a4933e159b7d..86ba40b3cb2dce512c852eff50335408959e21f0 100644 (file)
@@ -1,24 +1,24 @@
-/*
- * Copyright 2022 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2022-2025 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
  *
  *
- * Privacy Browser PC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
  *
  *
- * You should have received a copy of the GNU General Public License
- * along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
  */
 
-#ifndef TABWIDGET_H
-#define TABWIDGET_H
+#ifndef TAB_WIDGET_H
+#define TAB_WIDGET_H
 
 // Application headers.
 #include "PrivacyWebEngineView.h"
 
 // Application headers.
 #include "PrivacyWebEngineView.h"
@@ -28,7 +28,9 @@
 #include <KLineEdit>
 
 // Qt toolkit headers.
 #include <KLineEdit>
 
 // Qt toolkit headers.
+#include <QMovie>
 #include <QPushButton>
 #include <QPushButton>
+#include <QSplitter>
 #include <QTabWidget>
 #include <QWebEngineCookieStore>
 #include <QWebEngineFullScreenRequest>
 #include <QTabWidget>
 #include <QWebEngineCookieStore>
 #include <QWebEngineFullScreenRequest>
@@ -44,19 +46,27 @@ class TabWidget : public QWidget
 
 public:
     // The primary contructor.
 
 public:
     // The primary contructor.
-    explicit TabWidget(QWidget *parent);
+    explicit TabWidget(QWidget *windowPointer);
 
     // The destructor.
     ~TabWidget();
 
 
     // The destructor.
     ~TabWidget();
 
+    // The public variables.
+    PrivacyWebEngineView *currentPrivacyWebEngineViewPointer;
+
     // The public functions.
     // The public functions.
-    void applyOnTheFlyZoomFactor(const double &zoomFactor);
+    void applyOnTheFlyZoomFactor(const double zoomFactorDouble) const;
     PrivacyWebEngineView* loadBlankInitialWebsite();
     void loadInitialWebsite();
     void findPrevious(const QString &text) const;
     std::list<QNetworkCookie>* getCookieList() const;
     PrivacyWebEngineView* loadBlankInitialWebsite();
     void loadInitialWebsite();
     void findPrevious(const QString &text) const;
     std::list<QNetworkCookie>* getCookieList() const;
+    QIcon getCurrentTabFavoritIcon() const;
+    QString getCurrentTabTitle() const;
+    QString getCurrentTabUrl() const;
+    QString getCurrentUserAgent() const;
     QString& getDomainSettingsName() const;
     void setTabBarVisible(const bool visible) const;
     QString& getDomainSettingsName() const;
     void setTabBarVisible(const bool visible) const;
+    void toggleDeveloperTools(const bool enabled) const;
     void toggleDomStorage() const;
     void toggleFindCaseSensitive(const QString &text);
     void toggleJavaScript() const;
     void toggleDomStorage() const;
     void toggleFindCaseSensitive(const QString &text);
     void toggleJavaScript() const;
@@ -65,39 +75,47 @@ public:
     // The public static variables.
     static QString webEngineDefaultUserAgent;
 
     // The public static variables.
     static QString webEngineDefaultUserAgent;
 
-signals:
+Q_SIGNALS:
     // The signals.
     void addCookie(const QNetworkCookie &cookie) const;
     // The signals.
     void addCookie(const QNetworkCookie &cookie) const;
+    void blockedRequestsUpdated(const QVector<int> blockedRequests) const;
+    void cookiesChanged(const int numberOfCookies) const;
+    void easyListStatusChanged(const bool isEnabled) const;
+    void easyPrivacyStatusChanged(const bool isEnabled) const;
+    void fanboysAnnoyanceListStatusChanged(const bool isEnabled) const;
     void removeCookie(const QNetworkCookie &cookie) const;
     void clearUrlLineEditFocus() const;
     void fullScreenRequested(const bool toggleOn) const;
     void hideProgressBar() const;
     void linkHovered(const QString &linkUrl) const;
     void showProgressBar(const int &progress) const;
     void removeCookie(const QNetworkCookie &cookie) const;
     void clearUrlLineEditFocus() const;
     void fullScreenRequested(const bool toggleOn) const;
     void hideProgressBar() const;
     void linkHovered(const QString &linkUrl) const;
     void showProgressBar(const int &progress) const;
-    void updateBackAction(const bool &isEnabled) const;
-    void updateCookiesAction(const int numberOfCookies) const;
-    void updateDomStorageAction(const bool &isEnabled) const;
+    void ultraListStatusChanged(const bool) const;
+    void ultraPrivacyStatusChanged(const bool) const;
+    void updateBackAction(const bool isEnabled) const;
+    void updateDefaultZoomFactor(const double newDefaultZoomFactorDouble) const;
+    void updateDeveloperToolsAction(const bool isEnabled) const;
+    void updateDomStorageAction(const bool isEnabled) const;
     void updateDomainSettingsIndicator(const bool status) const;
     void updateFindText(const QString &text, const bool findCaseSensitive) const;
     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
     void updateDomainSettingsIndicator(const bool status) const;
     void updateFindText(const QString &text, const bool findCaseSensitive) const;
     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
-    void updateForwardAction(const bool &isEnabled) const;
-    void updateJavaScriptAction(const bool &isEnabled) const;
-    void updateLocalStorageAction(const bool &isEnabled) const;
+    void updateForwardAction(const bool isEnabled) const;
+    void updateJavaScriptAction(const bool isEnabled) const;
+    void updateLocalStorageAction(const bool isEnabled) const;
     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus) const;
     void updateUrlLineEdit(const QUrl &newUrl) const;
     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus) const;
     void updateWindowTitle(const QString &title) const;
     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus) const;
     void updateUrlLineEdit(const QUrl &newUrl) const;
     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus) const;
     void updateWindowTitle(const QString &title) const;
-    void updateZoomFactorAction(const double &zoomFactor) const;
+    void updateZoomActions(const double zoomFactorDouble) const;
 
 public Q_SLOTS:
     // The public slots.
     void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const;
 
 public Q_SLOTS:
     // The public slots.
     void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const;
-    PrivacyWebEngineView* addTab(const bool removeUrlLineEditFocus=false, const bool backgroundTab=false);
+    PrivacyWebEngineView* addTab(const bool removeUrlLineEditFocus = false, const bool adjacent = true, const bool backgroundTab = false, const QString urlString = QLatin1String(""));
     void applyApplicationSettings();
     void applyDomainSettingsAndReload();
     void applyApplicationSettings();
     void applyDomainSettingsAndReload();
-    void applyDomainSettingsWithoutReloading(const QString &hostname);
     void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
     void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
     void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
     void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
+    void applySpellCheckLanguages() const;
     void back() const;
     void deleteAllCookies() const;
     void deleteCookieFromStore(const QNetworkCookie &cookie) const;
     void back() const;
     void deleteAllCookies() const;
     void deleteCookieFromStore(const QNetworkCookie &cookie) const;
@@ -110,6 +128,15 @@ public Q_SLOTS:
     void print() const;
     void printPreview() const;
     void refresh() const;
     void print() const;
     void printPreview() const;
     void refresh() const;
+    void reloadAndBypassCache() const;
+    void saveArchive();
+    void stop() const;
+    void storeCurrentUrlText(const QString &urlText) const;
+    void toggleEasyList() const;
+    void toggleEasyPrivacy() const;
+    void toggleFanboysAnnoyanceList() const;
+    void toggleUltraList() const;
+    void toggleUltraPrivacy() const;
 
 private Q_SLOTS:
     // The private slots.
 
 private Q_SLOTS:
     // The private slots.
@@ -118,27 +145,29 @@ private Q_SLOTS:
     void findTextFinished(const QWebEngineFindTextResult &findTextResult);
     void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest) const;
     void pageLinkHovered(const QString &linkUrl) const;
     void findTextFinished(const QWebEngineFindTextResult &findTextResult);
     void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest) const;
     void pageLinkHovered(const QString &linkUrl) const;
-    void printWebpage(QPrinter *printerPointer) const;
-    void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer);
+    void showSaveDialog(QWebEngineDownloadRequest *downloadRequestPointer);
+    void stopLoadingFavoriteIconMovie() const;
+    void updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
     void updateUiWithTabSettings();
     void updateUiWithTabSettings();
-    void useNativeDownloader(QUrl &downloadUrl, QString &suggestedFileName);
+    void useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName);
 
 private:
 
 private:
+    // The private functions.
+    void updateDownloadDirectory(QString newDownloadDirectory) const;
+
     // The private variables.
     // The private variables.
-    double currentZoomFactor;  // This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
-    PrivacyWebEngineView *currentPrivacyWebEngineViewPointer;
     QWebEngineCookieStore *currentWebEngineCookieStorePointer;
     QWebEngineHistory *currentWebEngineHistoryPointer;
     QWebEnginePage *currentWebEnginePagePointer;
     QWebEngineProfile *currentWebEngineProfilePointer;
     QWebEngineSettings *currentWebEngineSettingsPointer;
     QWebEngineCookieStore *currentWebEngineCookieStorePointer;
     QWebEngineHistory *currentWebEngineHistoryPointer;
     QWebEnginePage *currentWebEnginePagePointer;
     QWebEngineProfile *currentWebEngineProfilePointer;
     QWebEngineSettings *currentWebEngineSettingsPointer;
-    QIcon defaultTabIcon = QIcon::fromTheme(QStringLiteral("globe"));
+    QIcon defaultFavoriteIcon = QIcon::fromTheme(QLatin1String("globe"), QIcon::fromTheme(QLatin1String("applications-internet")));
+    bool isRunningKde = false;
+    QMovie *loadingFavoriteIconMoviePointer;
+    QTabWidget *qTabWidgetPointer;
+    bool savingArchive;
     QString searchEngineUrl;
     QString searchEngineUrl;
-    QTabWidget *tabWidgetPointer;
     UserAgentHelper *userAgentHelperPointer;
     bool wipingCurrentFindTextSelection = false;
     UserAgentHelper *userAgentHelperPointer;
     bool wipingCurrentFindTextSelection = false;
-
-    // The private functions.
-    void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
 };
 #endif
 };
 #endif