KIOSlave
kcookieserver.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE File Manager 00003 00004 Copyright (C) 1998 Waldo Bastian (bastian@kde.org) 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public License 00008 as published by the Free Software Foundation; either 00009 version 2, or (at your option) version 3. 00010 00011 This software is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this library; see the file COPYING. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 //---------------------------------------------------------------------------- 00022 // 00023 // KDE Cookie Server 00024 00025 #ifndef KCOOKIESERVER_H 00026 #define KCOOKIESERVER_H 00027 00028 #include <QtCore/QStringList> 00029 #include <kdedmodule.h> 00030 #include <QtDBus/QtDBus> 00031 #include <QtDBus/QDBusContext> 00032 00033 class KHttpCookieList; 00034 class KCookieJar; 00035 class KHttpCookie; 00036 class QTimer; 00037 class RequestList; 00038 class KConfig; 00039 00040 class KCookieServer : public KDEDModule, protected QDBusContext 00041 { 00042 Q_OBJECT 00043 Q_CLASSINFO("D-Bus Interface", "org.kde.KCookieServer") 00044 public: 00045 KCookieServer(QObject* parent, const QList<QVariant>&); 00046 ~KCookieServer(); 00047 00048 public Q_SLOTS: 00049 // KDE5 TODO: don't overload names here, it prevents calling e.g. findCookies from the command-line using qdbus. 00050 QString listCookies(const QString &url); 00051 QString findCookies(const QString &url, qlonglong windowId); 00052 QStringList findDomains(); 00053 // KDE5: rename 00054 QStringList findCookies(const QList<int> &fields,const QString &domain,const QString& fqdn,const QString &path, const QString &name); 00055 QString findDOMCookies(const QString &url); 00056 QString findDOMCookies(const QString &url, qlonglong windowId); // KDE5: merge with above, using default value (windowId = 0) 00057 void addCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId); 00058 void deleteCookie(const QString &domain, const QString &fqdn, const QString &path, const QString &name); 00059 void deleteCookiesFromDomain(const QString &domain); 00060 void deleteSessionCookies(qlonglong windowId); 00061 void deleteSessionCookiesFor(const QString &fqdn, qlonglong windowId); 00062 void deleteAllCookies(); 00063 void addDOMCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId); 00067 bool setDomainAdvice(const QString &url, const QString &advice); 00071 QString getDomainAdvice(const QString &url); 00072 void reloadPolicy(); 00073 void shutdown(); 00074 00075 public: 00076 bool cookiesPending(const QString &url, KHttpCookieList *cookieList=0); 00077 void addCookies(const QString &url, const QByteArray &cookieHeader, 00078 qlonglong windowId, bool useDOMFormat); 00079 void checkCookies(KHttpCookieList *cookieList); 00080 00081 private Q_SLOTS: 00082 void slotSave(); 00083 void slotDeleteSessionCookies(qlonglong windowId); 00084 00085 private: 00086 KCookieJar *mCookieJar; 00087 KHttpCookieList *mPendingCookies; 00088 RequestList *mRequestList; 00089 QTimer *mTimer; 00090 bool mAdvicePending; 00091 KConfig *mConfig; 00092 00093 private: 00094 virtual int newInstance(QList<QByteArray>) { return 0; } 00095 bool cookieMatches(const KHttpCookie&, const QString&, const QString&, const QString&, const QString&); 00096 void putCookie(QStringList&, const KHttpCookie&, const QList<int>&); 00097 void saveCookieJar(); 00098 }; 00099 00100 #endif
KDE 4.6 API Reference