[webkit-qt] How do I disable cookies in QtWebKit?
Paul Pedriana
ppedriana at gmail.com
Mon Aug 16 03:00:11 PDT 2010
>>Maybe it might help:
>>http://doc.trolltech.com/main-snapshot/qnetworkaccessmanager.html#setCookieJar
Thanks. Based on that, I think code like this (which I haven't compiled
yet) could do it:
class QNetworkCookieJarEx : public QNetworkCookieJar
{
public:
QNetworkCookieJarEx()
: mEnabled(true){ }
bool enabled() const
{ return mEnabled; }
void setEnabled(bool enabled)
{
if(mEnabled != enabled)
{
mEnabled = enabled;
// Possibly clear cookies, if we could get access to the
parent class container. However, currently it is private.
}
}
QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const
{
if(mEnabled )
return QNetworkCookieJar::cookiesForUrl(url);
else
return QList<QNetworkCookie>();
}
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList,
const QUrl &url)
{
if(mEnabled )
return QNetworkCookieJar::setCookiesFromUrl(cookieList, url);
else
return false;
}
QList<QNetworkCookie> allCookies() const
{
if(mEnabled )
return QNetworkCookieJar::allCookies();
else
return QList<QNetworkCookie>();
}
void setAllCookies(const QList<QNetworkCookie>& cookieList)
{
if(mEnabled )
return QNetworkCookieJar::setAllCookies();
}
protected:
bool mEnabled;
};
> Maybe it might help:
> http://doc.trolltech.com/main-snapshot/qnetworkaccessmanager.html#setCookieJar
>
> On Sun, Aug 15, 2010 at 8:36 PM, Paul Pedriana<ppedriana at gmail.com> wrote:
>
>> Our app embeds a QWebKit instance, but we need to disable cookies. Is there
>> a way to do that? I've searched the API, the mailing list, and Google and
>> haven't found an answer.
>>
>> Thanks
>>
>>
>>
>> _______________________________________________
>> webkit-qt mailing list
>> webkit-qt at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>>
>>
>
>
>
More information about the webkit-qt
mailing list