X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwindows%2FBrowserWindow.cpp;fp=src%2Fwindows%2FBrowserWindow.cpp;h=2cfc251151648d13fcdd54d1eb2b4a135ccb84c0;hp=c70bab18cbffbc5539d43b12b858eb2fb051eac2;hb=cba9a47f00b59f59f76f1b5195086285ca0cdb59;hpb=9b6cee96126484925bec4f4ab30c2b880df687fe diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index c70bab1..2cfc251 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -238,10 +238,11 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() connect(browserViewPointer, SIGNAL(updateDomainSettingsIndicator(bool, QString)), this, SLOT(updateDomainSettingsIndicator(bool, QString))); // Initialize the cookie list. - cookieListPointer = new QList; + cookieListPointer = new std::forward_list; - // Add new cookies to the list. + // Process cookie changes. connect(browserViewPointer, SIGNAL(addCookie(QNetworkCookie)), this, SLOT(addCookieToList(QNetworkCookie))); + connect(browserViewPointer, SIGNAL(removeCookie(QNetworkCookie)), this, SLOT(removeCookieFromList(QNetworkCookie))); // Load the initial website. browserViewPointer->loadInitialWebsite(); @@ -249,15 +250,9 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() void BrowserWindow::addCookieToList(const QNetworkCookie &newCookie) const { - // Check to see if the list already contains a cookie with this ID. - for (QNetworkCookie existingCookie : *cookieListPointer) - { - // Remove the old version of the cookie. - if (existingCookie.hasSameIdentifier(newCookie)) cookieListPointer->removeOne(existingCookie); - } - + qDebug() << "Add cookie: " << newCookie.toRawForm(); // Add the new cookie to the list. - cookieListPointer->append(newCookie); + cookieListPointer->push_front(newCookie); } void BrowserWindow::addOrEditDomainSettings() const @@ -379,6 +374,7 @@ void BrowserWindow::openCookiesDialog() // Connect the dialog signals. connect(cookiesDialogPointer, SIGNAL(addCookie(QNetworkCookie)), browserViewPointer, SLOT(addCookieToStore(QNetworkCookie))); connect(cookiesDialogPointer, SIGNAL(deleteAllCookies()), browserViewPointer, SLOT(deleteAllCookies())); + connect(cookiesDialogPointer, SIGNAL(deleteCookie(QNetworkCookie)), browserViewPointer, SLOT(deleteCookieFromStore(QNetworkCookie))); } void BrowserWindow::openDomainSettings() const @@ -405,6 +401,14 @@ void BrowserWindow::refresh() const browserViewPointer->refresh(); } +void BrowserWindow::removeCookieFromList(const QNetworkCookie &cookie) const +{ + qDebug() << "Remove cookie: " << cookie.toRawForm(); + + // Remove the cookie from the list. + cookieListPointer->remove(cookie); +} + void BrowserWindow::showProgressBar(const int &progress) const { // Set the progress bar value.