From 9c9c1e8f7ba5b199ada4f43add2549e3ad1ea9d9 Mon Sep 17 00:00:00 2001 From: Robertkill Date: Mon, 6 May 2024 15:07:09 +0800 Subject: [PATCH] fix: There are empty application groups. When uninstalling an application, the check for empty application groups is not handled. log: as title issue: https://github.com/linuxdeepin/developer-center/issues/8367 --- src/models/itemarrangementproxymodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/models/itemarrangementproxymodel.cpp b/src/models/itemarrangementproxymodel.cpp index 4e95d5c7..2302b2bc 100644 --- a/src/models/itemarrangementproxymodel.cpp +++ b/src/models/itemarrangementproxymodel.cpp @@ -312,9 +312,12 @@ void ItemArrangementProxyModel::onSourceModelChanged() } m_topLevel->removeItemsNotIn(appDesktopIdSet); - for (int i = 0; i < m_folderModel.rowCount(); i++) { + for (int i = m_folderModel.rowCount() - 1; i >= 0 ; i--) { const QString & folderId = m_folderModel.index(i, 0).data(AppItem::DesktopIdRole).toString(); m_folders.value(folderId)->removeItemsNotIn(appDesktopIdSet); + if (m_folders.value(folderId)->pageCount() == 0) { + removeFolder(QString(folderId).remove("internal/folders/")); + } } emit dataChanged(index(0, 0), index(rowCount() - 1, 0), {