1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Private browsing now makes a temporary cookies, instead of disabling it

all. After private browsing mode is turned off, original cookies are
restored.
This commit is contained in:
nowrep 2011-05-20 17:52:32 +02:00
parent 90e8ef01bd
commit 8fccdf0848
3 changed files with 16 additions and 2 deletions

View File

@ -1129,7 +1129,7 @@ void QupZilla::startPrivate(bool state)
}
mApp->webSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, state);
mApp->history()->setSaving(!state);
mApp->cookieJar()->setAllowCookies(!state);
mApp->cookieJar()->turnPrivateJar(state);
emit message(MainApplication::CheckPrivateBrowsing, state);
}

View File

@ -25,7 +25,6 @@ CookieJar::CookieJar(QupZilla* mainClass, QObject* parent) :
,p_QupZilla(mainClass)
{
loadSettings();
// activeProfil = mApp->getActiveProfil();
m_activeProfil = mApp->getActiveProfil();
}
@ -127,3 +126,15 @@ void CookieJar::setAllCookies(const QList<QNetworkCookie> &cookieList)
{
QNetworkCookieJar::setAllCookies(cookieList);
}
void CookieJar::turnPrivateJar(bool state)
{
if (state) {
m_tempList = QNetworkCookieJar::allCookies();
QNetworkCookieJar::setAllCookies(QList<QNetworkCookie>());
} else {
QNetworkCookieJar::setAllCookies(m_tempList);
m_tempList.clear();
}
}

View File

@ -39,6 +39,8 @@ public:
void restoreCookies();
void setAllowCookies(bool allow);
void turnPrivateJar(bool state);
signals:
public slots:
@ -51,6 +53,7 @@ private:
bool m_deleteOnClose;
QString m_activeProfil;
QList<QNetworkCookie> m_tempList;
};
#endif // COOKIEJAR_H