Skip to content

Commit

Permalink
fix: [trash]Read-only empty directory, deletion prompts insufficient …
Browse files Browse the repository at this point in the history
…permissions

When executing the delete shortcut, the execution is moving to the recycle bin, here read-only directories can not achieve gio's trash function, only pop-up prompt box for him to completely delete the

Log: Read-only empty directory, deletion prompts insufficient permissions
Bug: https://pms.uniontech.com/bug-view-220283.html
  • Loading branch information
liyigang1 authored and deepin-bot[bot] committed Oct 9, 2023
1 parent 124ae20 commit b4fc964
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ JobHandlePointer TrashFileEventReceiver::doMoveToTrash(const quint64 windowId, c

const QUrl &sourceFirst = sources.first();
JobHandlePointer handle = nullptr;
if (!FileUtils::fileCanTrash(sourceFirst) || !dfmio::DFMUtils::supportTrash(sourceFirst)) {
bool nullDirDelete = false;
if (sources.count() == 1) {
auto info = InfoFactory::create<FileInfo>(sourceFirst);
nullDirDelete = info && info->isAttributes(OptInfoType::kIsDir)
&& !info->isAttributes(OptInfoType::kIsSymLink)
&& !info->isAttributes(OptInfoType::kIsWritable);
}
if (nullDirDelete || !FileUtils::fileCanTrash(sourceFirst) || !dfmio::DFMUtils::supportTrash(sourceFirst)) {
if (DialogManagerInstance->showDeleteFilesDialog(sources, true) != QDialog::Accepted)
return nullptr;
handle = copyMoveJob->deletes(sources, flags);
Expand Down

0 comments on commit b4fc964

Please sign in to comment.