[rekonq] KCookieJarServer

Andrea Diamantini adjam7 at gmail.com
Wed Aug 5 16:47:40 CEST 2009


On Wednesday 05 August 2009 15:24:27 Lionel Chauvin wrote:
> I am working at modify CookieJar class to communicate to KCookieJarServer
> via dbus instead of call QNetworkCookieJar
>
> Here is the doc: http://api.kde.org/4.x-api/kdelibs-
> apidocs/kioslave/html/classKCookieServer.html#a79a949422a7673750d185a582c62
>3935
>
> From now I have done that :
>
> QList<QNetworkCookie> CookieJar::cookiesForUrl2( const QUrl &url) const
> {
>     QList<QNetworkCookie> l;
>
>     qlonglong windowId = 0; //TODO
>     QDBusInterface kcookiejar( "org.kde.kded", "/modules/kcookiejar",
> "org.kde.KCookieServer" );
>     QDBusReply<QString> reply = kcookiejar.call( "findCookies", url,
> windowId );
>
>     if ( !reply.isValid() )
>     {
>         kWarning(7113) << "Can't communicate with kded_kcookiejar!";
>         return l;
>     }
>
>     QString temp = reply.value();
>
> //TODO: fill l
>
>     return l;
> }
>
> bool CookieJar::setCookiesFromUrl2(const QList<QNetworkCookie> &cookieList,
> const QUrl &url)
> {
>     qlonglong windowId = 0;//TODO
>     QByteArray cookieHeader; //TODO
>     QDBusInterface kcookiejar( "org.kde.kded", "/modules/kcookiejar",
> "org.kde.KCookieServer" );
>     QDBusReply<bool> reply = kcookiejar.call( QDBus::NoBlock, "addCookies",
> url,
>                            cookieHeader, windowId );
>
>     return reply.value();
> }
>
>
> I don't know what is "windowId". I believe it is for when there are several
> applications communicating to KCookieJarServer.
>
> findCookies() returns a string with a list inside. I don't know how to
> convert it to QList<QNetworkCookie>.
>
> addCookies() needs a QByteArray cookieHeader. I don't know how to convert
> QList<QNetworkCookie> to that.
>
> I really need help for that, but I think it is the good way.

I'm working on the same aspects, inspired by adawit code in kdewebkit 
implementation 
(http://websvn.kde.org/trunk/playground/libs/webkitkde/kdewebkit/kwebpage.cpp?view=markup)

I'll publish my first code in a KCookieSupport branch in a while..

-- 
Andrea Diamantini,
rekonq project
WEB: http://rekonq.sourceforge.net
IRC: adjam_AT_freenode
GPG Fingerprint: 57DE 8E32 7D1A 0E16 AA52 59D8 84F9 3ECD DBF9 730F


More information about the rekonq mailing list