From 8d587d4627fcf3d4c811bdd201d7cc1435a1153d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 26 Sep 2009 00:56:41 +0200 Subject: cookie jar fixes... --- src/cookiejar.cpp | 18 +++++++++++------- src/cookiejar.h | 3 +-- src/webpage.cpp | 7 +++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp index a8ba18bc..05ffb987 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -52,21 +52,22 @@ CookieJar::CookieJar(QObject* parent) : QNetworkCookieJar(parent) - , m_kcookiejar(new QDBusInterface("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer")) + , m_windowId(-1) { } CookieJar::~CookieJar() { - delete m_kcookiejar; } QList CookieJar::cookiesForUrl(const QUrl & url) const { + + QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); QList cookieList; - QDBusReply reply = m_kcookiejar->call("listCookies", url.toString() ); + QDBusReply reply = kcookiejar.call("findDOMCookies", url.toString() ); if (reply.isValid()) { @@ -83,24 +84,27 @@ QList CookieJar::cookiesForUrl(const QUrl & url) const bool CookieJar::setCookiesFromUrl(const QList & cookieList, const QUrl & url) { + QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); QByteArray cookieHeader; Q_FOREACH(const QNetworkCookie& cookie, cookieList) { cookieHeader = "Set-Cookie: "; cookieHeader += cookie.toRawForm(); - m_kcookiejar->call("addCookies", url.toString(), cookieHeader, 0 ); + kcookiejar.call("addCookies", url.toString(), cookieHeader, m_windowId ); } - return !m_kcookiejar->lastError().isValid(); + return !kcookiejar.lastError().isValid(); } void CookieJar::clear() { - QDBusReply reply = m_kcookiejar->call( "deleteAllCookies" ); + QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); + + QDBusReply reply = kcookiejar.call( "deleteAllCookies" ); if (!reply.isValid()) { kWarning() << "Unable to delete all the cookies as requested."; - return; } + return; } diff --git a/src/cookiejar.h b/src/cookiejar.h index 4dea1e60..3f9f366c 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -31,7 +31,6 @@ // Qt Includes #include -#include // Forward Declarations class QUrl; @@ -51,7 +50,7 @@ public: void clear(); private: - QDBusInterface *m_kcookiejar; + qlonglong m_windowId; }; #endif // RECOOKIEJAR_H diff --git a/src/webpage.cpp b/src/webpage.cpp index f1e5db33..942f20e3 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -272,8 +272,11 @@ bool WebPage::javaScriptPrompt(QWebFrame *frame, const QString &msg, const QStri QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { - kDebug() << "create Plugin requested with classId: " << classId; - + kDebug() << "create Plugin requested:"; + kDebug() << "classid:" << classId; + kDebug() << "url:" << url; + kDebug() << "paramNames:" << paramNames << " paramValues:" << paramValues; + QUiLoader loader; return loader.createWidget(classId, view()); } -- cgit v1.2.1