Implement move to recycle bin feature
VI
2mo ago+87+87+01234567890123456789-9-9-0123456789
Move files and folders to recycle bin instead of permanent delete and an option to show delete confirmation dialog. Both are default to true.
Summary by cubic
Summary of changes
Changes the Explorer plugin's delete action to send files and folders to the Recycle Bin instead of permanently deleting them. Two new settings control whether the recycle bin is used and whether a confirmation prompt appears.
- The delete context menu now calls
MoveToRecycleBinwhenDeleteToRecycleBinis enabled; when disabled, it falls back to the existingFile.Delete/Directory.Deletepermanent delete path (no existing code removed). - The confirmation dialog now only appears when
ConfirmBeforeDeletingis true (previously always shown), and subtitles and success messages change to reflect the chosen destination. - Added the
MoveToRecycleBinextension method, which uses theIFileOperationCOM API withFOF_ALLOWUNDO; two new settings (DeleteToRecycleBin,ConfirmBeforeDeleting, both default true) come with checkboxes in the Explorer settings UI and new localization strings inen.xaml. - COM objects created in
MoveToRecycleBinare released viaMarshal.FinalReleaseComObjectin afinallyblock, so memory usage impact is minimal. - No new security risks: the change uses the standard Windows shell API with no privilege escalation, and the default confirmation prompt helps prevent accidental deletions.
- No unit tests are included; manual verification of the shell integration is required.
Release Note
Deleted files and folders now go to the Recycle Bin instead of being permanently removed, and you can skip the confirmation prompt if you prefer.