summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/cookiejar.cpp32
-rw-r--r--src/cookiejar.h5
3 files changed, 21 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65315be8..bc8ef53d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -58,7 +58,6 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR}
ADD_DEFINITIONS ( ${KDE4_DEFINITIONS} )
-
### --------------- ADDING EXECUTABLE...
KDE4_ADD_EXECUTABLE( rekonq ${rekonq_SRCS} )
diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp
index 6aceaf6a..324fe827 100644
--- a/src/cookiejar.cpp
+++ b/src/cookiejar.cpp
@@ -49,8 +49,9 @@
#include <QtDBus/QDBusReply>
-CookieJar::CookieJar(QObject* parent)
- : QNetworkCookieJar(parent)
+CookieJar::CookieJar(QObject* parent)
+ : QNetworkCookieJar(parent)
+ , m_windowId(10) //m_windowId is important else doesn't connect with KCookieServer
{
}
@@ -62,19 +63,20 @@ CookieJar::~CookieJar()
QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const
{
+
QList<QNetworkCookie> cookieList;
- if ( true ) // FIXME WebKitSettings::self()->isCookieJarEnabled())
+ if ( true ) // FIXME WebKitSettings::self()->isCookieJarEnabled())
{
QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer");
- QDBusReply<QString> reply = kcookiejar.call("findCookies", url.toString() ); // , m_windowId);
+ QDBusReply<QString> reply = kcookiejar.call("findCookies", url.toString() , m_windowId);
- if (reply.isValid())
+ if (reply.isValid())
{
cookieList << reply.value().toUtf8();
//kDebug() << reply.value();
- }
- else
+ }
+ else
{
kWarning() << "Unable to communicate with the cookiejar!";
}
@@ -84,6 +86,7 @@ QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const
}
+
bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, const QUrl & url)
{
@@ -92,22 +95,21 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, cons
QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer");
QByteArray cookieHeader;
- Q_FOREACH(const QNetworkCookie& cookie, cookieList)
+ foreach(const QNetworkCookie& cookie, cookieList)
{
cookieHeader = "Set-Cookie: ";
cookieHeader += cookie.toRawForm();
- kcookiejar.call("addCookies", url.toString(), cookieHeader); //, m_windowId);
+ kcookiejar.call("addCookies", url.toString(), cookieHeader, m_windowId);
//kDebug() << "url: " << url.host() << ", cookie: " << cookieHeader;
}
return !kcookiejar.lastError().isValid();
}
-
+
return false;
}
-
-// void CookieJar::setWindowId(qlonglong id)
-// {
-// m_windowId = id;
-// }
+void CookieJar::setWindowId(qlonglong id)
+{
+ m_windowId=id;
+}
diff --git a/src/cookiejar.h b/src/cookiejar.h
index 85e91fef..e6e3f701 100644
--- a/src/cookiejar.h
+++ b/src/cookiejar.h
@@ -41,10 +41,13 @@ class CookieJar : public QNetworkCookieJar
public:
CookieJar(QObject* parent = 0);
virtual ~CookieJar();
+ void setWindowId(qlonglong id);
virtual QList<QNetworkCookie> cookiesForUrl(const QUrl & url) const;
-
virtual bool setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, const QUrl & url);
+
+private:
+ qlonglong m_windowId;
};
#endif // RECOOKIEJAR_H