1/*
2 * Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15#ifndef MIRALL_COOKIEJAR_H
16#define MIRALL_COOKIEJAR_H
17
18#include <QNetworkCookieJar>
19
20#include "owncloudlib.h"
21
22namespace OCC {
23
24/**
25 * @brief The CookieJar class
26 * @ingroup libsync
27 */
28class OWNCLOUDSYNC_EXPORT CookieJar : public QNetworkCookieJar
29{
30 Q_OBJECT
31public:
32 explicit CookieJar(QObject *parent = 0);
33 ~CookieJar();
34 bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) Q_DECL_OVERRIDE;
35 QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const Q_DECL_OVERRIDE;
36
37 void clearSessionCookies();
38
39 using QNetworkCookieJar::setAllCookies;
40 using QNetworkCookieJar::allCookies;
41
42 void save(const QString &fileName);
43 void restore(const QString &fileName);
44
45signals:
46 void newCookiesForUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
47
48private:
49 QList<QNetworkCookie> removeExpired(const QList<QNetworkCookie> &cookies);
50};
51
52} // namespace OCC
53
54#endif // MIRALL_COOKIEJAR_H
55