KDE 4.6 PyKDE API Reference

- KDE's Python API

# CookieJar Class Reference

`from PyKDE4.kio import *`

Inherits:
Namespace: KIO.Integration

## Detailed Description

A KDE implementation of QNetworkCookieJar.

Use this class in place of QNetworkCookieJar if you want to integrate with KDE's cookiejar instead of the one that comes with Qt.

Here is a simple example that shows how to set the QtWebKit module to use KDE's cookiejar:

       QWebView *view = new QWebView(this);
       KIO.Integration.CookieJar *cookieJar = new KIO.Integration.CookieJar;
       cookieJar->setWindowId(view->window()->winId());
       view->page()->networkAccessManager()->setCookieJar(cookieJar);

To access member functions in the cookiejar class at a later point in your code simply downcast the pointer returned by QNetworkAccessManager.cookieJar as follows:

       KIO.Integration.CookieJar *cookieJar = qobject_cast<KIO.Integration.CookieJar*>(view->page()->accessManager()->cookieJar());

IMPORTANTThis class is not a replacement for the standard KDE API. It should ONLY be used to to provide KDE integration in applications that cannot use the standard KDE API directly.

See also:
  QNetworkAccessManager.setCookieJar for details.

Author:
  Dawit Alemayehu <adawit @kde.org>

Since:
  4.4

## Methods

| __init__ (self, QObject parent=0)
[QNetworkCookie] | cookiesForUrl (self, QUrl url)
bool | isCookieStorageDisabled (self)
| reparseConfiguration (self)
bool | setCookiesFromUrl (self, [QNetworkCookie] cookieList, QUrl url)
| setDisableCookieStorage (self, bool disable)
| setWindowId (self, int id)
int | windowId (self)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

Constructs a KNetworkCookieJar with parent parent.

[QNetworkCookie] cookiesForUrl | ( | self, |
|  | QUrl | url
| ) |  |  |

Reimplemented for internal reasons, the API is not affected.

See also:
  QNetworkCookieJar.cookiesForUrl

Internal:

bool isCookieStorageDisabled | ( |  | self ) |

Returns true if persistent caching of cookies is disabled.

See also:
  setDisableCookieStorage

Since:
  4.6

reparseConfiguration | ( |  | self ) |

Reparse the KDE cookiejar configuration file.

bool setCookiesFromUrl | ( | self, |
|  | [QNetworkCookie] | cookieList,
|  | QUrl | url
| ) |  |  |

Reimplemented for internal reasons, the API is not affected.

See also:
  QNetworkCookieJar.setCookiesFromUrl

Internal:

setDisableCookieStorage | ( | self, |
|  | bool | disable
| ) |  |  |

Prevent persistent storage of cookies.

Call this function if you do not want cookies to be stored locally for later access without disabling the cookiejar. All cookies will be discarded once the sessions that are using the cookie are done.

Since:
  4.6

setWindowId | ( | self, |
|  | int | id
| ) |  |  |

Sets the window id of the application.

This value is used by KDE's cookiejar to manage session cookies, namely to delete them when the last application referring to such cookies is closed by the end user.

See also:
  QWidget.window()

See also:
  QWidget.winId()

Parameters:

  | id | the value of QWidget.winId() from the window that contains your widget.

int windowId | ( |  | self ) |

Returns the currently set window id. The default value is -1.