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 <KXmlGuiWindow>
30 // Qt toolkit headers.
32 #include <QProgressBar>
37 class BrowserWindow : public KXmlGuiWindow
39 // Include the Q_OBJECT macro.
43 // The default constructor.
46 // The public functions.
47 QSize sizeHint() const override;
51 void addCookieToList(const QNetworkCookie &newCookie) const;
52 void addOrEditDomainSettings() const;
54 void clearUrlLineEditFocus() const;
57 void getZoomFactorFromUser();
59 void loadUrlFromLineEdit(const QString &url) const;
60 void openCookiesDialog();
61 void openDomainSettings() const;
63 void removeCookieFromList(const QNetworkCookie &cookie) const;
64 void settingsConfigure();
65 void showProgressBar(const int &progress) const;
66 void toggleCookies() const;
67 void toggleDomStorage() const;
68 void toggleJavaScript() const;
69 void updateCookiesAction(const bool &isEnabled);
70 void updateDomStorageAction(const bool &isEnabled) const;
71 void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain);
72 void updateJavaScriptAction(const bool &isEnabled);
73 void updateSearchEngineActions(const QString &searchEngine) const;
74 void updateUserAgentActions(const QString &userAgent) const;
75 void updateZoomFactorAction(const double &zoomFactor);
76 void updateSearchEngineLabel(const QString &searchEngineString) const;
77 void updateUrlLineEdit(const QUrl &newUrl);
78 void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
81 // The private variables.
82 BrowserView *browserViewPointer;
83 KConfigDialog *configDialogPointer;
84 std::list<QNetworkCookie> *cookieListPointer;
85 QAction *cookiesActionPointer;
87 QString currentDomainSettingsDomain;
89 double currentZoomFactor;
90 QAction *domStorageActionPointer;
91 QPalette domainSettingsPalette;
92 QAction *javaScriptActionPointer;
93 bool javaScriptEnabled;
94 QPalette noDomainSettingsPalette;
95 QAction *onTheFlyCookiesActionPointer;
96 QProgressBar *progressBarPointer;
97 QLabel *searchEngineLabelPointer;
98 QAction *searchEngineMojeekActionPointer;
99 QAction *searchEngineMonoclesActionPointer;
100 QAction *searchEngineMetagerActionPointer;
101 QAction *searchEngineGoogleActionPointer;
102 QAction *searchEngineBingActionPointer;
103 QAction *searchEngineYahooActionPointer;
104 QAction *searchEngineCustomActionPointer;
105 QLabel *userAgentLabelPointer;
106 QAction *userAgentPrivacyBrowserActionPointer;
107 QAction *userAgentWebEngineDefaultActionPointer;
108 QAction *userAgentFirefoxLinuxActionPointer;
109 QAction *userAgentChromiumLinuxActionPointer;
110 QAction *userAgentFirefoxWindowsActionPointer;
111 QAction *userAgentChromeWindowsActionPointer;
112 QAction *userAgentEdgeWindowsActionPointer;
113 QAction *userAgentSafariMacosActionPointer;
114 QAction *userAgentCustomActionPointer;
115 KLineEdit *urlLineEditPointer;
116 QAction *zoomFactorActionPointer;