Falkon Develop
Cross-platform Qt-based web browser
cookiemanager.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef COOKIEMANAGER_H
19#define COOKIEMANAGER_H
20
21#include <QDialog>
22
23#include "qzcommon.h"
24
25namespace Ui
26{
27class CookieManager;
28}
29
30class QTreeWidgetItem;
31class QNetworkCookie;
32
33class BrowserWindow;
34
35class FALKON_EXPORT CookieManager : public QDialog
36{
37 Q_OBJECT
38
39public:
40 explicit CookieManager(QWidget *parent = nullptr);
41 ~CookieManager() override;
42
43private Q_SLOTS:
44 void currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent);
45 void remove();
46 void removeAll();
47
48 void addWhitelist();
49 void removeWhitelist();
50 void addBlacklist();
51 void removeBlacklist();
52
53 void deletePressed();
54
55 void filterString(const QString &string);
56
57 void addCookie(const QNetworkCookie &cookie);
58 void removeCookie(const QNetworkCookie &cookie);
59
60private:
61 void closeEvent(QCloseEvent* e) override;
62 void keyPressEvent(QKeyEvent* e) override;
63
64 void initWhiteAndBlacklist();
65
66 void addBlacklist(const QString &server);
67 QString cookieDomain(const QNetworkCookie &cookie) const;
68 QTreeWidgetItem *cookieItem(const QNetworkCookie &cookie) const;
69
70 Ui::CookieManager* ui;
71
72 QHash<QString, int> m_listModifications;
73 QHash<QString, QTreeWidgetItem*> m_domainHash;
74 QHash<QTreeWidgetItem*, QNetworkCookie> m_itemHash;
75};
76
77#endif // COOKIEMANAGER_H
#define FALKON_EXPORT
Definition: qzcommon.h:28