[rekonq] KCookieJarServer

Lionel Chauvin megabigbug at yahoo.fr
Wed Aug 5 15:24:27 CEST 2009


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#a79a949422a7673750d185a582c623935

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.



More information about the rekonq mailing list