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 "views/BrowserView.h"
26 // KDE Frameworks headers.
27 #include <KConfigDialog>
28 #include <KToggleFullScreenAction>
29 #include <KXmlGuiWindow>
31 // Qt toolkit headers.
34 #include <QProgressBar>
39 class BrowserWindow : public KXmlGuiWindow
41 // Include the Q_OBJECT macro.
45 // The default constructor.
48 // The public functions.
49 QSize sizeHint() const override;
53 void addCookieToList(const QNetworkCookie &newCookie) const;
54 void addOrEditDomainSettings() const;
56 void clearUrlLineEditFocus() const;
60 void fullScreenRequested(const bool toggleOn);
61 void getZoomFactorFromUser();
63 void loadUrlFromLineEdit(const QString &url) const;
65 void removeCookieFromList(const QNetworkCookie &cookie) const;
66 void showCookiesDialog();
67 void showDownloadLocationBrowseDialog() const;
68 void showDomainSettingsDialog() const;
69 void showProgressBar(const int &progress) const;
70 void showSettingsDialog();
71 void toggleDomStorage() const;
72 void toggleJavaScript() const;
73 void toggleLocalStorage() const;
74 void toggleFullScreen();
75 void updateDomStorageAction(const bool &isEnabled) const;
76 void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain);
77 void updateJavaScriptAction(const bool &isEnabled);
78 void updateLocalStorageAction(const bool &isEnabled);
79 void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
80 void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
81 void updateZoomFactorAction(const double &zoomFactor);
82 void updateSearchEngineLabel(const QString &searchEngineString) const;
83 void updateUrlLineEdit(const QUrl &newUrl);
84 void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
87 // The private variables.
88 BrowserView *browserViewPointer;
89 KConfigDialog *configDialogPointer;
90 std::list<QNetworkCookie> *cookieListPointer;
91 QAction *cookiesActionPointer;
92 QString currentDomainSettingsDomain;
94 double currentZoomFactor;
95 bool customSearchEngineEnabled;
96 bool customUserAgentEnabled;
97 QAction *domStorageActionPointer;
98 QPalette domainSettingsPalette;
99 QComboBox *downloadLocationComboBoxPointer;
100 KToggleFullScreenAction *fullScreenActionPointer;
101 QAction *javaScriptActionPointer;
102 bool javaScriptEnabled;
103 QAction *localStorageActionPointer;
104 bool localStorageEnabled;
105 KToolBar *navigationToolBarPointer;
106 QPalette noDomainSettingsPalette;
107 QProgressBar *progressBarPointer;
108 QLabel *searchEngineLabelPointer;
109 QAction *searchEngineMenuActionPointer;
110 QAction *searchEngineMojeekActionPointer;
111 QAction *searchEngineMonoclesActionPointer;
112 QAction *searchEngineMetagerActionPointer;
113 QAction *searchEngineGoogleActionPointer;
114 QAction *searchEngineBingActionPointer;
115 QAction *searchEngineYahooActionPointer;
116 QAction *searchEngineCustomActionPointer;
117 QLabel *userAgentLabelPointer;
118 QAction *userAgentMenuActionPointer;
119 QAction *userAgentPrivacyBrowserActionPointer;
120 QAction *userAgentWebEngineDefaultActionPointer;
121 QAction *userAgentFirefoxLinuxActionPointer;
122 QAction *userAgentChromiumLinuxActionPointer;
123 QAction *userAgentFirefoxWindowsActionPointer;
124 QAction *userAgentChromeWindowsActionPointer;
125 QAction *userAgentEdgeWindowsActionPointer;
126 QAction *userAgentSafariMacosActionPointer;
127 QAction *userAgentCustomActionPointer;
128 KLineEdit *urlLineEditPointer;
129 KToolBar *urlToolBarPointer;
130 QAction *zoomFactorActionPointer;