diff --git a/src/gui/cookiesdialog.cpp b/src/gui/cookiesdialog.cpp index cec21f8f2..f030a52b6 100644 --- a/src/gui/cookiesdialog.cpp +++ b/src/gui/cookiesdialog.cpp @@ -28,6 +28,8 @@ #include "cookiesdialog.h" +#include + #include "base/settingsstorage.h" #include "base/net/downloadmanager.h" #include "guiiconprovider.h" @@ -85,5 +87,16 @@ void CookiesDialog::onButtonAddClicked() void CookiesDialog::onButtonDeleteClicked() { - m_cookiesModel->removeRow(m_ui->treeView->selectionModel()->currentIndex().row()); + QModelIndexList idxs = m_ui->treeView->selectionModel()->selectedRows(); + + // sort in descending order + std::sort(idxs.begin(), idxs.end(), + [](const QModelIndex &l, const QModelIndex &r) + { + return (l.row() > r.row()); + } + ); + + for (const QModelIndex &idx : idxs) + m_cookiesModel->removeRow(idx.row()); } diff --git a/src/gui/cookiesdialog.ui b/src/gui/cookiesdialog.ui index 631cbc999..0f08a69d9 100644 --- a/src/gui/cookiesdialog.ui +++ b/src/gui/cookiesdialog.ui @@ -17,7 +17,17 @@ - + + + QAbstractItemView::AllEditTriggers + + + true + + + QAbstractItemView::ExtendedSelection + + diff --git a/src/gui/cookiesmodel.cpp b/src/gui/cookiesmodel.cpp index d3e08412b..7c283a66f 100644 --- a/src/gui/cookiesmodel.cpp +++ b/src/gui/cookiesmodel.cpp @@ -145,7 +145,7 @@ bool CookiesModel::insertRows(int row, int count, const QModelIndex &parent) if ((row < 0) || (row > m_cookies.size())) return false; QNetworkCookie newCookie; - newCookie.setExpirationDate(QDateTime::currentDateTime().addYears(99)); + newCookie.setExpirationDate(QDateTime::currentDateTime().addYears(2)); beginInsertRows(parent, row, row + count - 1); while (count-- > 0)