Skip to content

Commit

Permalink
fix: The gear icon is displayed on the USB flash drive when deleting …
Browse files Browse the repository at this point in the history
…files to the trash

The customData of trashfileinfo does not implement kitemFileRefreshIcon. Add an implementation to clean up the fileicon when comparing iconname inconsistencies when caching properties in asyncfileinfo

Log: The gear icon is displayed on the USB flash drive when deleting files to the trash
Bug: https://pms.uniontech.com/bug-view-237591.html
  • Loading branch information
liyigang1 committed Jan 2, 2024
1 parent 281d77c commit 3e292a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dfm-base/file/local/asyncfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,10 @@ int AsyncFileInfoPrivate::cacheAllAttributes()
tmp.insert(FileInfo::FileInfoAttributeID::kStandardIcon, attribute(DFileInfo::AttributeID::kStandardIcon));
tmp.insert(FileInfo::FileInfoAttributeID::kStandardIsLocalDevice, FileUtils::isLocalDevice(q->fileUrl()));
tmp.insert(FileInfo::FileInfoAttributeID::kStandardIsCdRomDevice, FileUtils::isCdRomDevice(q->fileUrl()));
if (q->nameOf(NameInfoType::kIconName) != attribute(DFileInfo::AttributeID::kStandardIcon)) {
QWriteLocker rlk(&iconLock);
fileIcon = QIcon();
}
if (cacheTmp.isEmpty()) {
{
QWriteLocker lk(&lock);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/common/core/dfmplugin-trashcore/trashfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ QVariant TrashFileInfo::customData(int role) const
return urlOf(UrlInfoType::kOriginalUrl).path();
else if (role == kItemFileDeletionDate)
return d->deletionTime().toString(FileUtils::dateTimeFormat());
else if (role == Global::ItemRoles::kItemFileRefreshIcon){
return ProxyFileInfo::customData(role);
}
else
return QVariant();
}
Expand Down

0 comments on commit 3e292a5

Please sign in to comment.