fix #774
This commit is contained in:
parent
37ba269311
commit
122b886cab
@ -26,7 +26,7 @@
|
|||||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="4.2.3" date="2022-07-20"/>
|
<release version="4.2.3" date="2022-08-15"/>
|
||||||
</releases>
|
</releases>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||||
|
@ -281,15 +281,17 @@ Qt::ItemFlags AccountCheckModel::flags(const QModelIndex& index) const {
|
|||||||
|
|
||||||
QList<RootItem*> AccountCheckModel::checkedItems() const {
|
QList<RootItem*> AccountCheckModel::checkedItems() const {
|
||||||
auto keys = m_checkStates.keys();
|
auto keys = m_checkStates.keys();
|
||||||
auto res = boolinq::from(keys).where([&](const auto& key) {
|
auto res = boolinq::from(keys)
|
||||||
return m_checkStates.value(key) == Qt::CheckState::Checked;
|
.where([&](const auto& key) {
|
||||||
}).toStdList();
|
return m_checkStates.value(key) == Qt::CheckState::Checked;
|
||||||
|
})
|
||||||
|
.toStdList();
|
||||||
|
|
||||||
return FROM_STD_LIST(QList<RootItem*>, res);
|
return FROM_STD_LIST(QList<RootItem*>, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountCheckModel::isItemChecked(RootItem* item) const {
|
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) {
|
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);
|
auto* rhs = m_sourceModel->itemForIndex(source_right);
|
||||||
|
|
||||||
if (lhs != nullptr && rhs != nullptr) {
|
if (lhs != nullptr && rhs != nullptr) {
|
||||||
QList<RootItem::Kind> priorities = {
|
QList<RootItem::Kind> priorities = {RootItem::Kind::Category,
|
||||||
RootItem::Kind::Category,
|
RootItem::Kind::Feed,
|
||||||
RootItem::Kind::Feed,
|
RootItem::Kind::Labels,
|
||||||
RootItem::Kind::Labels,
|
RootItem::Kind::Important,
|
||||||
RootItem::Kind::Important,
|
RootItem::Kind::Unread,
|
||||||
RootItem::Kind::Unread,
|
RootItem::Kind::Bin};
|
||||||
RootItem::Kind::Bin
|
|
||||||
};
|
|
||||||
|
|
||||||
if (lhs->keepOnTop()) {
|
if (lhs->keepOnTop()) {
|
||||||
return sortOrder() == Qt::SortOrder::AscendingOrder;
|
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;
|
return QString::localeAwareCompare(lhs->title().toLower(), rhs->title().toLower()) < 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return sortOrder() == Qt::SortOrder::AscendingOrder
|
return sortOrder() == Qt::SortOrder::AscendingOrder ? left_priority < right_priority
|
||||||
? left_priority < right_priority
|
: right_priority < left_priority;
|
||||||
: right_priority < left_priority;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,6 +360,6 @@ void AccountCheckSortedModel::uncheckAllItems() {
|
|||||||
bool AccountCheckSortedModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const {
|
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();
|
auto kind = m_sourceModel->itemForIndex(m_sourceModel->index(source_row, 0, source_parent))->kind();
|
||||||
|
|
||||||
return kind == RootItem::Kind::Root || kind == RootItem::Kind::ServiceRoot ||
|
return kind == RootItem::Kind::Root || kind == RootItem::Kind::ServiceRoot || kind == RootItem::Kind::Category ||
|
||||||
kind == RootItem::Kind::Category || kind == RootItem::Kind::Feed;
|
kind == RootItem::Kind::Feed;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user