Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / settings / kio / kcookiesmanagement.h
blob7cfc758a37832f62ed529c7ebd690522a0eaea67
1 /**
2 * kcookiesmanagement.h - Cookies manager
4 * Copyright 2000-2001 Marco Pinelli <pinmc@orion.it>
6 * Contributors:
7 * Copyright (c) 2000-2001 Dawit Alemayehu <adawit@kde.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef KCOOKIESMANAGEMENT_H
25 #define KCOOKIESMANAGEMENT_H
27 #include <QtCore/QList>
28 #include <QtCore/QStringList>
29 #include <QtGui/QTreeWidget>
30 #include <QtCore/QHash>
32 #include <kcmodule.h>
33 #include "ui_kcookiesmanagementdlg.h"
36 struct CookieProp;
38 class KCookiesManagementDlgUI : public QWidget, public Ui::KCookiesManagementDlgUI
40 public:
41 KCookiesManagementDlgUI( QWidget *parent ) : QWidget( parent ) {
42 setupUi( this );
47 class CookieListViewItem : public QTreeWidgetItem
49 public:
50 CookieListViewItem(QTreeWidget *parent, const QString &dom);
51 CookieListViewItem(QTreeWidgetItem *parent, CookieProp *cookie);
52 ~CookieListViewItem();
54 QString domain() const { return mDomain; }
55 CookieProp* cookie() const { return mCookie; }
56 CookieProp* leaveCookie();
57 void setCookiesLoaded() { mCookiesLoaded = true; }
58 bool cookiesLoaded() const { return mCookiesLoaded; }
60 private:
61 void init( CookieProp* cookie,
62 const QString &domain = QString(),
63 bool cookieLoaded=false );
64 CookieProp *mCookie;
65 QString mDomain;
66 bool mCookiesLoaded;
69 class KCookiesManagement : public KCModule
71 Q_OBJECT
73 public:
74 KCookiesManagement(const KComponentData &componentData, QWidget *parent );
75 ~KCookiesManagement();
77 virtual void load();
78 virtual void save();
79 virtual void defaults();
80 virtual QString quickHelp() const;
82 private Q_SLOTS:
83 void deleteCookie();
84 void deleteAllCookies();
85 void getDomains();
86 void getCookies(QTreeWidgetItem*);
87 void showCookieDetails(QTreeWidgetItem*);
88 void doPolicy();
90 private:
91 void reset (bool deleteAll = false);
92 bool cookieDetails(CookieProp *cookie);
93 void clearCookieDetails();
94 bool policyenabled();
95 bool m_bDeleteAll;
97 QWidget* mainWidget;
98 KCookiesManagementDlgUI* dlg;
100 QStringList deletedDomains;
101 typedef QList<CookieProp *> CookiePropList;
102 QHash<QString, CookiePropList> deletedCookies;
105 #endif // KCOOKIESMANAGEMENT_H