]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/widgets/PrivacyWebEngineView.h
Add a default folder icon to the edit folder dialog. https://redmine.stoutner.com...
[PrivacyBrowserPC.git] / src / widgets / PrivacyWebEngineView.h
1 /*
2  * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef PRIVACYWEBENGINEVIEW_H
21 #define PRIVACYWEBENGINEVIEW_H
22
23 // KDE framework headers.
24 #include <KLineEdit>
25
26 // Qt toolkit headers.
27 #include <QIcon>
28 #include <QNetworkCookie>
29 #include <QWebEngineFindTextResult>
30 #include <QWebEngineView>
31
32 class PrivacyWebEngineView : public QWebEngineView
33 {
34     // Include the Q_OBJECT macro.
35     Q_OBJECT
36
37 public:
38     // The default constructor.
39     explicit PrivacyWebEngineView(QWidget *parentWidgetPointer = nullptr);
40
41     // The public variables.
42     std::list<QNetworkCookie> *cookieListPointer = new std::list<QNetworkCookie>;
43     double defaultZoomFactor = 1.00;
44     QString domainSettingsName = QLatin1String("");
45     QIcon favoriteIcon = QIcon::fromTheme(QLatin1String("globe"), QIcon::fromTheme(QLatin1String("applications-internet")));
46     bool findCaseSensitive = false;
47     QString findString = QLatin1String("");
48     QWebEngineFindTextResult findTextResult = QWebEngineFindTextResult();
49     int httpAuthenticationDialogsDisplayed = 0;
50     bool isLoading = false;
51     int loadProgressInt = -1;
52     bool localStorageEnabled = false;
53
54     // The public functions.
55     void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
56
57 signals:
58     // The signals.
59     void displayHttpPingBlockedDialog(const QString &httpPingUrl) const;
60     void updateCookiesAction(const int numberOfCookies) const;
61     void updateUi(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
62
63 public Q_SLOTS:
64     // The public slots.
65     void addCookieToList(const QNetworkCookie &cookie) const;
66     void removeCookieFromList(const QNetworkCookie &cookie) const;
67
68 private Q_SLOTS:
69     // The private slots.
70     void applyDomainSettingsWithoutReloading(const QString &hostname);
71     void displayHttpPingDialog(const QString &httpPingUrl) const;
72     void handleAuthenticationRequest(const QUrl &requestUrl, QAuthenticator *authenticatorPointer);
73
74 private:
75     // The private variables.
76     KLineEdit *passwordLineEditPointer;
77     KLineEdit *usernameLineEditPointer;
78     QWebEngineProfile *webEngineProfilePointer;
79     QWebEngineSettings *webEngineSettingsPointer;
80
81 protected:
82     // The protected functions.
83     void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
84     QWebEngineView* createWindow(QWebEnginePage::WebWindowType webWindowType) override;
85 };
86 #endif