From 122b886cab8d23a30c2543b3e82b370c2724ea84 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 15 Aug 2022 08:12:03 +0200 Subject: [PATCH] fix #774 --- .../desktop/com.github.rssguard.appdata.xml | 2 +- .../services/abstract/accountcheckmodel.cpp | 33 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index 0fce873e9..207e974b4 100644 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -26,7 +26,7 @@ https://github.com/sponsors/martinrotter - + none diff --git a/src/librssguard/services/abstract/accountcheckmodel.cpp b/src/librssguard/services/abstract/accountcheckmodel.cpp index 6264fe1e3..8b2c31626 100644 --- a/src/librssguard/services/abstract/accountcheckmodel.cpp +++ b/src/librssguard/services/abstract/accountcheckmodel.cpp @@ -281,15 +281,17 @@ Qt::ItemFlags AccountCheckModel::flags(const QModelIndex& index) const { QList AccountCheckModel::checkedItems() const { auto keys = m_checkStates.keys(); - auto res = boolinq::from(keys).where([&](const auto& key) { - return m_checkStates.value(key) == Qt::CheckState::Checked; - }).toStdList(); + auto res = boolinq::from(keys) + .where([&](const auto& key) { + return m_checkStates.value(key) == Qt::CheckState::Checked; + }) + .toStdList(); return FROM_STD_LIST(QList, res); } bool AccountCheckModel::isItemChecked(RootItem* item) const { - return m_checkStates.value(item, Qt::CheckState::Unchecked) == Qt::CheckState::Checked; + return m_checkStates.value(item, Qt::CheckState::Unchecked) != Qt::CheckState::Unchecked; } bool AccountCheckModel::setItemChecked(RootItem* item, Qt::CheckState check) { @@ -308,14 +310,12 @@ bool AccountCheckSortedModel::lessThan(const QModelIndex& source_left, const QMo auto* rhs = m_sourceModel->itemForIndex(source_right); if (lhs != nullptr && rhs != nullptr) { - QList priorities = { - RootItem::Kind::Category, - RootItem::Kind::Feed, - RootItem::Kind::Labels, - RootItem::Kind::Important, - RootItem::Kind::Unread, - RootItem::Kind::Bin - }; + QList priorities = {RootItem::Kind::Category, + RootItem::Kind::Feed, + RootItem::Kind::Labels, + RootItem::Kind::Important, + RootItem::Kind::Unread, + RootItem::Kind::Bin}; if (lhs->keepOnTop()) { return sortOrder() == Qt::SortOrder::AscendingOrder; @@ -331,9 +331,8 @@ bool AccountCheckSortedModel::lessThan(const QModelIndex& source_left, const QMo return QString::localeAwareCompare(lhs->title().toLower(), rhs->title().toLower()) < 0; } else { - return sortOrder() == Qt::SortOrder::AscendingOrder - ? left_priority < right_priority - : right_priority < left_priority; + return sortOrder() == Qt::SortOrder::AscendingOrder ? left_priority < right_priority + : right_priority < left_priority; } } @@ -361,6 +360,6 @@ void AccountCheckSortedModel::uncheckAllItems() { bool AccountCheckSortedModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const { auto kind = m_sourceModel->itemForIndex(m_sourceModel->index(source_row, 0, source_parent))->kind(); - return kind == RootItem::Kind::Root || kind == RootItem::Kind::ServiceRoot || - kind == RootItem::Kind::Category || kind == RootItem::Kind::Feed; + return kind == RootItem::Kind::Root || kind == RootItem::Kind::ServiceRoot || kind == RootItem::Kind::Category || + kind == RootItem::Kind::Feed; }