From 63b34dc6ccd32c9bc7c3d8c0137ff12530238bde Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 30 Oct 2008 01:50:51 +0100 Subject: reKonq initial commit. Yeah! --- src/cookiejar.h | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 src/cookiejar.h (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h new file mode 100644 index 00000000..50d007f0 --- /dev/null +++ b/src/cookiejar.h @@ -0,0 +1,200 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +#ifndef COOKIEJAR_H +#define COOKIEJAR_H + +#include + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE +class QSortFilterProxyModel; +class QKeyEvent; +QT_END_NAMESPACE + +class AutoSaver; + +class CookieJar : public QNetworkCookieJar +{ + friend class CookieModel; + Q_OBJECT + Q_PROPERTY(AcceptPolicy acceptPolicy READ acceptPolicy WRITE setAcceptPolicy) + Q_PROPERTY(KeepPolicy keepPolicy READ keepPolicy WRITE setKeepPolicy) + Q_PROPERTY(QStringList blockedCookies READ blockedCookies WRITE setBlockedCookies) + Q_PROPERTY(QStringList allowedCookies READ allowedCookies WRITE setAllowedCookies) + Q_PROPERTY(QStringList allowForSessionCookies READ allowForSessionCookies WRITE setAllowForSessionCookies) + Q_ENUMS(KeepPolicy) + Q_ENUMS(AcceptPolicy) + +signals: + void cookiesChanged(); + +public: + enum AcceptPolicy { + AcceptAlways, + AcceptNever, + AcceptOnlyFromSitesNavigatedTo + }; + + enum KeepPolicy { + KeepUntilExpire, + KeepUntilExit, + KeepUntilTimeLimit + }; + + CookieJar(QObject *parent = 0); + ~CookieJar(); + + QList cookiesForUrl(const QUrl &url) const; + bool setCookiesFromUrl(const QList &cookieList, const QUrl &url); + + AcceptPolicy acceptPolicy() const; + void setAcceptPolicy(AcceptPolicy policy); + + KeepPolicy keepPolicy() const; + void setKeepPolicy(KeepPolicy policy); + + QStringList blockedCookies() const; + QStringList allowedCookies() const; + QStringList allowForSessionCookies() const; + + void setBlockedCookies(const QStringList &list); + void setAllowedCookies(const QStringList &list); + void setAllowForSessionCookies(const QStringList &list); + +public slots: + void clear(); + void loadSettings(); + +private slots: + void save(); + +private: + void purgeOldCookies(); + void load(); + bool m_loaded; + AutoSaver *m_saveTimer; + + AcceptPolicy m_acceptCookies; + KeepPolicy m_keepCookies; + + QStringList m_exceptions_block; + QStringList m_exceptions_allow; + QStringList m_exceptions_allowForSession; +}; + +class CookieModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + CookieModel(CookieJar *jar, QObject *parent = 0); + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + +private slots: + void cookiesChanged(); + +private: + CookieJar *m_cookieJar; +}; + +#include "ui_cookies.h" +#include "ui_cookiesexceptions.h" + +class CookiesDialog : public QDialog, public Ui_CookiesDialog +{ + Q_OBJECT + +public: + CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0); + +private: + QSortFilterProxyModel *m_proxyModel; +}; + +class CookieExceptionsModel : public QAbstractTableModel +{ + Q_OBJECT + friend class CookiesExceptionsDialog; + +public: + CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0); + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + +private: + CookieJar *m_cookieJar; + + // Domains we allow, Domains we block, Domains we allow for this session + QStringList m_allowedCookies; + QStringList m_blockedCookies; + QStringList m_sessionCookies; +}; + +class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialog +{ + Q_OBJECT + +public: + CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0); + +private slots: + void block(); + void allow(); + void allowForSession(); + void textChanged(const QString &text); + +private: + CookieExceptionsModel *m_exceptionsModel; + QSortFilterProxyModel *m_proxyModel; + CookieJar *m_cookieJar; +}; + +#endif // COOKIEJAR_H + -- cgit v1.2.1 From 4a0acb308cfecde67af334f48a521c221c4aee1a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 7 Nov 2008 00:17:56 +0100 Subject: Setting right license --- src/cookiejar.h | 55 +++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 36 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index 50d007f0..fbc89946 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -1,39 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef COOKIEJAR_H #define COOKIEJAR_H -- cgit v1.2.1 From 3397fd277b12d82d8c260f8a9dab7b203924d1a8 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 21 Nov 2008 09:48:44 +0100 Subject: KDE-izing cookie dialogs.. removed searchlineedit support, almost everywhere.. We just need a new url bar to be ready for 0.0.1 release.. --- src/cookiejar.h | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index fbc89946..d3843c51 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -21,13 +21,16 @@ #ifndef COOKIEJAR_H #define COOKIEJAR_H -#include -#include -#include +// KDE Includes +#include -#include -#include + +// Qt Includes +#include +#include +#include +#include QT_BEGIN_NAMESPACE class QSortFilterProxyModel; @@ -105,6 +108,12 @@ private: QStringList m_exceptions_allowForSession; }; + + + // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + + class CookieModel : public QAbstractTableModel { Q_OBJECT @@ -124,8 +133,13 @@ private: CookieJar *m_cookieJar; }; + + +// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + + #include "ui_cookies.h" -#include "ui_cookiesexceptions.h" class CookiesDialog : public QDialog, public Ui_CookiesDialog { @@ -160,6 +174,15 @@ private: QStringList m_sessionCookies; }; + + + +// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + + +#include "ui_cookiesexceptions.h" + class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialog { Q_OBJECT -- cgit v1.2.1 From 19e901a0ca9630b2003dd24ccfa6da54eb70bb09 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 14 Dec 2008 18:27:17 +0100 Subject: adjusted rekonq name commented out (hopefully, for now) resizeEvents and focusInEvents in urlbar & searchbar --- src/cookiejar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index d3843c51..835700f1 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -1,6 +1,6 @@ /* ============================================================  * - * This file is a part of the reKonq project + * This file is a part of the rekonq project  * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 by Andrea Diamantini -- cgit v1.2.1 From 76d30285358bedd8b2fc6caf48d2a871f7546685 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Jan 2009 02:26:13 +0100 Subject: Ported tons of code to KConfigXT. To merge kcfg branch we need just to port cookie settings.. --- src/cookiejar.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index 835700f1..d4868f21 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -25,7 +25,6 @@ // KDE Includes #include - // Qt Includes #include #include @@ -109,9 +108,7 @@ private: }; - - // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - +// ------------------------------------------------------------------------------------------------------------- class CookieModel : public QAbstractTableModel @@ -134,9 +131,7 @@ private: }; - -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - +// ---------------------------------------------------------------------------------------------------------------------- #include "ui_cookies.h" @@ -175,10 +170,7 @@ private: }; - - -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - +// ----------------------------------------------------------------------------------------------------------------- #include "ui_cookiesexceptions.h" @@ -203,4 +195,3 @@ private: }; #endif // COOKIEJAR_H - -- cgit v1.2.1 From 39409ac6a2880ad815d6096231d0fcdcfd2547f6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 22 Mar 2009 10:21:09 +0100 Subject: Fixed Copyright intro --- src/cookiejar.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index d4868f21..b61cebcc 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -1,22 +1,23 @@ /* ============================================================ - * - * This file is a part of the rekonq project - * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved - * Copyright (C) 2008 by Andrea Diamantini - * - * - * This program is free software; you can redistribute it - * and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; - * either version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * ============================================================ */ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved +* Copyright (C) 2008 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it +* and/or modify it under the terms of the GNU General +* Public License as published by the Free Software Foundation; +* either version 2, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* ============================================================ */ + #ifndef COOKIEJAR_H #define COOKIEJAR_H -- cgit v1.2.1 From 48b25611c94d380b40948a3de0bfab5678668e1d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 25 Mar 2009 00:47:24 +0100 Subject: Huge update. Fixed quite all of the settings troubles.. From now on, we (mainly) go on WebView bugfixing.. --- src/cookiejar.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index b61cebcc..1796d252 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -32,13 +32,12 @@ #include #include -QT_BEGIN_NAMESPACE +// Forward Declarations class QSortFilterProxyModel; class QKeyEvent; -QT_END_NAMESPACE - class AutoSaver; + class CookieJar : public QNetworkCookieJar { friend class CookieModel; @@ -55,13 +54,15 @@ signals: void cookiesChanged(); public: - enum AcceptPolicy { + enum AcceptPolicy + { AcceptAlways, AcceptNever, AcceptOnlyFromSitesNavigatedTo }; - enum KeepPolicy { + enum KeepPolicy + { KeepUntilExpire, KeepUntilExit, KeepUntilTimeLimit -- cgit v1.2.1 From 7557af13f9f904cb9a6240d2101fb14e1ffdca99 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 22 Apr 2009 01:33:28 +0200 Subject: Fixing Copyrights --- src/cookiejar.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index 1796d252..150ae8ae 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -3,7 +3,8 @@ * This file is a part of the rekonq project * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008 by Andrea Diamantini +* Copyright (C) 2008-2009 by Andrea Diamantini +* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details * * * This program is free software; you can redistribute it -- cgit v1.2.1 From e657ef44ef1eef1f998101ab3dcce1a251d729fc Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 26 Apr 2009 01:45:38 +0200 Subject: Fixed copyright strings, per file, as decided --- src/cookiejar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index 150ae8ae..27071b6d 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -4,7 +4,7 @@ * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008-2009 by Andrea Diamantini -* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details +* Copyright (C) 2009 by Domrachev Alexandr * * * This program is free software; you can redistribute it -- cgit v1.2.1 From 06b2dc0ce6ec6dd4cb090c22e2f9f8521138146b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 6 May 2009 03:09:23 +0200 Subject: EBN Krazy fixes. 1st round.. --- src/cookiejar.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/cookiejar.h') diff --git a/src/cookiejar.h b/src/cookiejar.h index 27071b6d..6cd91782 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -119,7 +119,8 @@ class CookieModel : public QAbstractTableModel Q_OBJECT public: - CookieModel(CookieJar *jar, QObject *parent = 0); + explicit CookieModel(CookieJar *jar, QObject *parent = 0); + QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -144,19 +145,24 @@ class CookiesDialog : public QDialog, public Ui_CookiesDialog Q_OBJECT public: - CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0); + explicit CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0); private: QSortFilterProxyModel *m_proxyModel; }; + +// ---------------------------------------------------------------------------------------------------------------------- + + class CookieExceptionsModel : public QAbstractTableModel { Q_OBJECT friend class CookiesExceptionsDialog; public: - CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0); + explicit CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0); + QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -183,7 +189,7 @@ class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialo Q_OBJECT public: - CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0); + explicit CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0); private slots: void block(); -- cgit v1.2.1