2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Sami Rämö - sami.ramo@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 #include "networkcookiejar.h"
30 NetworkCookieJar::NetworkCookieJar(QObject *parent)
31 : QNetworkCookieJar(parent)
33 qWarning() << __PRETTY_FUNCTION__;
38 NetworkCookieJar::~NetworkCookieJar()
40 qWarning() << __PRETTY_FUNCTION__;
45 void NetworkCookieJar::loadCookies()
47 qWarning() << __PRETTY_FUNCTION__;
49 QSettings settings(DIRECTORY_NAME, FILE_NAME);
51 QStringList list = settings.value(COOKIES, EMPTY).toStringList();
54 QList<QNetworkCookie> cookieList;
55 for(int i = 0; i < list.count(); i++) {
56 cookieList.append(QNetworkCookie::parseCookies(list.at(i).toAscii()));
59 setAllCookies(cookieList);
63 void NetworkCookieJar::saveCookies()
65 qWarning() << __PRETTY_FUNCTION__;
67 QList<QNetworkCookie> cookieList = allCookies();
70 for(int i = 0; i < cookieList.count(); i++) {
71 QNetworkCookie cookie = cookieList.at(i);
72 QByteArray byteArray = cookie.toRawForm(QNetworkCookie::Full);
73 list.append(QString(byteArray));
75 list.removeDuplicates();
77 QSettings settings(DIRECTORY_NAME, FILE_NAME);
78 settings.setValue(COOKIES, list);