]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/dialogs/CookiesDialog.h
f34beca66ad7b95153b93030472a7649f6069e69
[PrivacyBrowserPC.git] / src / dialogs / CookiesDialog.h
1 /*
2  * Copyright © 2022 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 COOKIESDIALOG_H
21 #define COOKIESDIALOG_H
22
23 // Qt toolkit headers.
24 #include <QDialog>
25 #include <QItemSelectionModel>
26 #include <QNetworkCookie>
27 #include <QStandardItemModel>
28 #include <QTreeView>
29
30 // C++ headers.
31 #include <list>
32
33 class CookiesDialog : public QDialog
34 {
35     // Include the Q_OBJECT macro.
36     Q_OBJECT
37
38 public:
39     // The primary constructor.
40     explicit CookiesDialog(std::list<QNetworkCookie> *cookieListPointer);
41
42 signals:
43     // The signals.
44     void addCookie(const QNetworkCookie &cookie) const;
45     void deleteAllCookies() const;
46     void deleteCookie(const QNetworkCookie &cookie) const;
47
48 private Q_SLOTS:
49     // The private slots.
50     void addCookieFromDialog(const QNetworkCookie &cookie) const;
51     void deleteCookieFromDialog(const QNetworkCookie &cookie) const;
52     void showAddCookieDialog() const;
53     void showDeleteAllMessageBox() const;
54     void showDeleteCookieMessageBox() const;
55     void showEditCookieDialog() const;
56     void updateUi() const;
57
58 private:
59     // The private variables.
60     QItemSelectionModel *treeViewSelectionModelPointer;
61     QPushButton *addCookieButtonPointer;
62     std::list<QNetworkCookie> *cookieListPointer;
63     QPushButton *deleteAllButtonPointer;
64     QPushButton *deleteCookieButtonPointer;
65     QPushButton *editCookieButtonPointer;
66     QStandardItemModel *standardItemModelPointer;
67     QTreeView *treeViewPointer;
68
69     // The private functions.
70     void deleteCookie(const QModelIndex &modelIndex) const;
71 };
72 #endif