Dooble
Loading...
Searching...
No Matches
dooble_cookies_window.h
1/*
2** Copyright (c) 2008 - present, Alexis Megas.
3** All rights reserved.
4**
5** Redistribution and use in source and binary forms, with or without
6** modification, are permitted provided that the following conditions
7** are met:
8** 1. Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** 2. Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** 3. The name of the author may not be used to endorse or promote products
14** derived from Dooble without specific prior written permission.
15**
16** DOOBLE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25** DOOBLE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef dooble_cookies_window_h
29#define dooble_cookies_window_h
30
31#include <QNetworkCookie>
32#include <QPointer>
33#include <QTimer>
34
35#include "ui_dooble_cookies_window.h"
36
37class QWebEngineCookieStore;
38class dooble_cookies;
39
40class dooble_cookies_window: public QMainWindow
41{
42 Q_OBJECT
43
44 public:
45 dooble_cookies_window(bool is_private, QWidget *parent);
46 bool is_domain_blocked(const QUrl &url) const;
47 void filter(const QString &text);
48 void populate(void);
49 void set_cookie_store(QWebEngineCookieStore *cookie_store);
50 void set_cookies(dooble_cookies *cookies);
51 void show_normal(QWidget *parent);
52
53 public slots:
54 void show(void);
55
56 protected:
57 void closeEvent(QCloseEvent *event);
58 void keyPressEvent(QKeyEvent *event);
59 void resizeEvent(QResizeEvent *event);
60
61 private:
62 QHash<QString, QHash<QByteArray, QTreeWidgetItem *> > m_child_items;
63 QHash<QString, QTreeWidgetItem *> m_top_level_items;
64 QPointer<QWebEngineCookieStore> m_cookie_store;
65 QPointer<dooble_cookies> m_cookies;
66 QTimer m_domain_filter_timer;
67 QTimer m_purge_domains_timer;
68 QToolButton *m_collapse;
69 Ui_dooble_cookies_window m_ui;
70 bool m_is_private;
71 void delete_top_level_items(const QList<QTreeWidgetItem *> &list);
72 void save_settings(void);
73
74 private slots:
75 void slot_add_blocked_domain(void);
76 void slot_block_subdomains(bool state);
77 void slot_collapse_all(void);
78 void slot_cookie_removed(const QNetworkCookie &cookie);
79 void slot_cookies_added(const QList<QNetworkCookie> &cookies,
80 const QList<int> &is_blocked_or_favorite);
81 void slot_cookies_cleared(void);
82 void slot_delete_selected(void);
83 void slot_delete_shown(void);
84 void slot_delete_unchecked(void);
85 void slot_domain_filter_timer_timeout(void);
86 void slot_find(void);
87 void slot_item_changed(QTreeWidgetItem *item, int column);
88 void slot_item_selection_changed(void);
89 void slot_periodically_purge_temporary_domains(bool state);
90 void slot_purge_domains_timer_timeout(void);
91 void slot_settings_applied(void);
92 void slot_toggle_shown(void);
93
94 signals:
95 void delete_cookie(const QNetworkCookie &cookie);
96 void delete_domain(const QString &domain);
97 void delete_items(const QList<QNetworkCookie> &cookies,
98 const QStringList &domains);
99};
100
101#endif
Definition dooble_cookies_window.h:41
Definition dooble_cookies.h:36