From 2170200a6910ea5332fa2d42ed1a2e9a9597d6ae Mon Sep 17 00:00:00 2001 From: xust Date: Thu, 12 Sep 2024 16:43:27 +0800 Subject: [PATCH] fix: [organize] files not organized after renamed. collection model source data not updated when files renamed. Log: as title. Bug: https://pms.uniontech.com/bug-view-268169.html --- .../desktop/ddplugin-organizer/models/collectionmodel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp b/src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp index 09e4dc94fa..f8c4a98a3c 100644 --- a/src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp +++ b/src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp @@ -104,8 +104,12 @@ void CollectionModelPrivate::sourceDataChanged(const QModelIndex &sourceTopleft, auto url = shell->fileUrl(q->sourceModel()->index(i, 0)); auto cur = q->index(url); - if (handler) - handler->acceptUpdate(url, roles); + if (handler && handler->acceptUpdate(url, roles)) { + if (!fileList.contains(url)) { + fileList.append(url); + fileMap.insert(url, shell->fileInfo(q->sourceModel()->index(i, 0))); + } + } if (cur.isValid()) idxs << cur;