2 * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
4 * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
6 * Privacy Browser PC is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * Privacy Browser PC is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef BROWSERWINDOW_H
21 #define BROWSERWINDOW_H
23 // Application headers.
24 #include "widgets/TabWidget.h"
26 // KDE Frameworks headers.
27 #include <KConfigDialog>
28 #include <KToggleFullScreenAction>
29 #include <KXmlGuiWindow>
31 // Qt toolkit headers.
34 #include <QProgressBar>
36 class BrowserWindow : public KXmlGuiWindow
38 // Include the Q_OBJECT macro.
42 // The default constructor.
45 // The public functions.
46 QSize sizeHint() const override;
50 void addOrEditDomainSettings() const;
52 void clearUrlLineEditFocus() const;
56 void fullScreenRequested(const bool toggleOn);
57 void getZoomFactorFromUser();
59 void loadUrlFromLineEdit(const QString &url) const;
61 void showCookiesDialog();
62 void showDownloadLocationBrowseDialog() const;
63 void showDomainSettingsDialog() const;
64 void showProgressBar(const int &progress) const;
65 void showSettingsDialog();
66 void toggleDomStorage() const;
67 void toggleJavaScript() const;
68 void toggleLocalStorage() const;
69 void toggleFullScreen();
70 void updateCookiesAction(const int numberOfCookies) const;
71 void updateDomStorageAction(const bool &isEnabled) const;
72 void updateDomainSettingsIndicator(const bool status);
73 void updateJavaScriptAction(const bool &isEnabled);
74 void updateLocalStorageAction(const bool &isEnabled);
75 void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
76 void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
77 void updateZoomFactorAction(const double &zoomFactor);
78 void updateSearchEngineLabel(const QString &searchEngineString) const;
79 void updateUrlLineEdit(const QUrl &newUrl);
80 void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
83 // The private variables.
84 KConfigDialog *configDialogPointer;
85 QAction *cookiesActionPointer;
87 double currentZoomFactor;
88 bool customSearchEngineEnabled;
89 bool customUserAgentEnabled;
90 QAction *domStorageActionPointer;
91 QPalette domainSettingsPalette;
92 QComboBox *downloadLocationComboBoxPointer;
93 KToggleFullScreenAction *fullScreenActionPointer;
94 QAction *javaScriptActionPointer;
95 bool javaScriptEnabled;
96 QAction *localStorageActionPointer;
97 bool localStorageEnabled;
98 KToolBar *navigationToolBarPointer;
99 QPalette noDomainSettingsPalette;
100 QProgressBar *progressBarPointer;
101 QLabel *searchEngineLabelPointer;
102 QAction *searchEngineMenuActionPointer;
103 QAction *searchEngineMojeekActionPointer;
104 QAction *searchEngineMonoclesActionPointer;
105 QAction *searchEngineMetagerActionPointer;
106 QAction *searchEngineGoogleActionPointer;
107 QAction *searchEngineBingActionPointer;
108 QAction *searchEngineYahooActionPointer;
109 QAction *searchEngineCustomActionPointer;
110 TabWidget *tabWidgetPointer;
111 QLabel *userAgentLabelPointer;
112 QAction *userAgentMenuActionPointer;
113 QAction *userAgentPrivacyBrowserActionPointer;
114 QAction *userAgentWebEngineDefaultActionPointer;
115 QAction *userAgentFirefoxLinuxActionPointer;
116 QAction *userAgentChromiumLinuxActionPointer;
117 QAction *userAgentFirefoxWindowsActionPointer;
118 QAction *userAgentChromeWindowsActionPointer;
119 QAction *userAgentEdgeWindowsActionPointer;
120 QAction *userAgentSafariMacosActionPointer;
121 QAction *userAgentCustomActionPointer;
122 KLineEdit *urlLineEditPointer;
123 KToolBar *urlToolBarPointer;
124 QAction *zoomFactorActionPointer;