Summary: | JJ: Konqueror cookie settings delete ALL cookies, even if filter is used | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Jens <jens-bugs.kde.org> |
Component: | kcookiejar | Assignee: | Unassigned bugs mailing-list <unassigned-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | lex.lists, mueller, richih-kde |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch for KDE bug #113497
Improved patch for KDE bug #113497 |
Description
Jens
2005-09-28 13:35:57 UTC
I agree this needs fixing. perhaps the button could be changed to "Delete All..." and then make you confirm that you REALLY want to delete ALL cookies. I just lost all my cookies because of this bug. This is certainly not the behaviour I expected. Almost certainly the same thing as in bug 122158: need to iterate over only the visible items in the delete list. Makes a nice Junior Job... Created attachment 19618 [details] Patch for KDE bug #113497 This is a patch that modifies the "delete all" behaviour for both cookie policy and cookie management so that only visible (filtered) list items will be deleted. Thomas, you might want to also send the patch to the kde-core-devel@kde.org mailing list - there are more people reading that list than this bug, so someone there should be able to review and commit it for you :-) Created attachment 19652 [details] Improved patch for KDE bug #113497 Created new patch based on comments by John Tapsell. It should work better by now. SVN commit 707822 by adawit: When delete all is pressed, only delete the visible cookies if the view is filtered. BUG:113497 M +44 -13 kcookiesmanagement.cpp M +4 -1 kcookiesmanagement.h --- branches/KDE/3.5/kdebase/kcontrol/kio/kcookiesmanagement.cpp #707821:707822 @@ -152,7 +152,6 @@ KMessageBox::sorry (this, caption, message); return; } - m_bDeleteAll = false; // deleted[Cookies|Domains] have been cleared yet } @@ -215,11 +214,8 @@ emit changed (false); } -void KCookiesManagement::reset(bool deleteAll) +void KCookiesManagement::reset() { - if ( !deleteAll ) - m_bDeleteAll = false; - clearCookieDetails(); dlg->lvCookies->clear(); deletedDomains.clear(); @@ -405,10 +401,9 @@ } -void KCookiesManagement::deleteCookie() +void KCookiesManagement::deleteCookie(QListViewItem* deleteItem) { - QListViewItem* currentItem = dlg->lvCookies->currentItem(); - CookieListViewItem *item = static_cast<CookieListViewItem*>( currentItem ); + CookieListViewItem *item = static_cast<CookieListViewItem*>( deleteItem ); if( item->cookie() ) { CookieListViewItem *parent = static_cast<CookieListViewItem*>(item->parent()); @@ -419,8 +414,10 @@ list->setAutoDelete(true); deletedCookies.insert(parent->domain(), list); } + list->append(item->leaveCookie()); delete item; + if(parent->childCount() == 0) delete parent; } @@ -429,8 +426,14 @@ deletedDomains.append(item->domain()); delete item; } +} - currentItem = dlg->lvCookies->currentItem(); +void KCookiesManagement::deleteCookie() +{ + deleteCookie(dlg->lvCookies->currentItem()); + + QListViewItem* currentItem = dlg->lvCookies->currentItem(); + if ( currentItem ) { dlg->lvCookies->setSelected( currentItem, true ); @@ -439,18 +442,46 @@ else clearCookieDetails(); - dlg->pbDelete->setEnabled(dlg->lvCookies->selectedItem()); dlg->pbDeleteAll->setEnabled(dlg->lvCookies->childCount()); - dlg->pbPolicy->setEnabled(dlg->lvCookies->selectedItem()); + const bool hasSelectedItem = dlg->lvCookies->selectedItem(); + dlg->pbDelete->setEnabled(hasSelectedItem); + dlg->pbPolicy->setEnabled(hasSelectedItem); + emit changed( true ); } void KCookiesManagement::deleteAllCookies() { - m_bDeleteAll = true; - reset(true); + if ( dlg->kListViewSearchLine->text().isEmpty()) + { + reset(); + m_bDeleteAll = true; + } + else + { + QListViewItem* item = dlg->lvCookies->firstChild(); + while (item) + { + if (item->isVisible()) + { + deleteCookie(item); + item = dlg->lvCookies->currentItem(); + } + else + item = item->nextSibling(); + } + + const int count = dlg->lvCookies->childCount(); + m_bDeleteAll = (count == 0); + dlg->pbDeleteAll->setEnabled(count); + + const bool hasSelectedItem = dlg->lvCookies->selectedItem(); + dlg->pbDelete->setEnabled(hasSelectedItem); + dlg->pbPolicy->setEnabled(hasSelectedItem); + } + emit changed( true ); } --- branches/KDE/3.5/kdebase/kcontrol/kio/kcookiesmanagement.h #707821:707822 @@ -81,10 +81,13 @@ void doPolicy(); private: - void reset (bool deleteAll = false); + void reset (); + void deleteCookie(QListViewItem*); bool cookieDetails(CookieProp *cookie); void clearCookieDetails(); bool policyenabled(); + +private: bool m_bDeleteAll; QWidget* mainWidget; *** Bug 144055 has been marked as a duplicate of this bug. *** |