KIO.Integration.CookieJar

KDE 4.5 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)
| reparseConfiguration (self)
bool | setCookiesFromUrl (self, [QNetworkCookie] cookieList, QUrl url)
| 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:

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:

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.