Don't show AddDirect delegate if we don't have any DMs

In this case, it's nicer to fall back to the placeholder, which has the same action
This commit is contained in:
Tobias Fella
2025-08-20 20:53:14 +02:00
parent 54a918b0cf
commit 74deb684e1

View File

@@ -82,8 +82,8 @@ QString SortFilterRoomTreeModel::filterText() const
bool SortFilterRoomTreeModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
if (!source_parent.isValid()) {
if (sourceModel()->data(sourceModel()->index(source_row, 0), RoomTreeModel::CategoryRole).toInt() == NeoChatRoomType::AddDirect
&& m_mode == DirectChats) {
if (sourceModel()->data(sourceModel()->index(source_row, 0), RoomTreeModel::CategoryRole).toInt() == NeoChatRoomType::AddDirect && m_mode == DirectChats
&& sourceModel()->rowCount(sourceModel()->index(NeoChatRoomType::Direct, 0)) > 0) {
return true;
}
return false;