From 74cfccd69d7249f6380120e9a8c46c1566e0f7b6 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Sat, 25 Mar 2023 03:11:26 +0100 Subject: [PATCH] History: Don't delete all items under dates when filtering BUG: 466936 FIXED-IN: 23.04.0 Signed-off-by: Juraj Oravec --- src/lib/history/historymodel.cpp | 5 +++++ src/lib/history/historymodel.h | 1 + src/lib/history/historytreeview.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index 78621cddf..1aabedfe9 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -561,3 +561,8 @@ bool HistoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sour return (index.data(HistoryModel::UrlStringRole).toString().contains(m_pattern, Qt::CaseInsensitive) || index.data(HistoryModel::TitleRole).toString().contains(m_pattern, Qt::CaseInsensitive)); } + +bool HistoryFilterModel::isPatternEmpty() const +{ + return m_pattern.isEmpty(); +} diff --git a/src/lib/history/historymodel.h b/src/lib/history/historymodel.h index ab8caf8dd..77115b0af 100644 --- a/src/lib/history/historymodel.h +++ b/src/lib/history/historymodel.h @@ -89,6 +89,7 @@ class FALKON_EXPORT HistoryFilterModel : public QSortFilterProxyModel Q_OBJECT public: explicit HistoryFilterModel(QAbstractItemModel* parent); + bool isPatternEmpty() const; public Q_SLOTS: void setFilterFixedString(const QString &pattern); diff --git a/src/lib/history/historytreeview.cpp b/src/lib/history/historytreeview.cpp index 56bebbd05..a7a731a43 100644 --- a/src/lib/history/historytreeview.cpp +++ b/src/lib/history/historytreeview.cpp @@ -111,7 +111,7 @@ void HistoryTreeView::removeSelectedItems() continue; } - if (index.data(HistoryModel::IsTopLevelRole).toBool()) { + if ((index.data(HistoryModel::IsTopLevelRole).toBool()) && (m_filter->isPatternEmpty())) { qint64 start = index.data(HistoryModel::TimestampStartRole).toLongLong(); qint64 end = index.data(HistoryModel::TimestampEndRole).toLongLong();