Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Show "Confirm Delete" dialog for files, too #10258

Merged
merged 1 commit into from
Jul 24, 2016

Conversation

marcelgerber
Copy link
Contributor

For #8651 and #10190

@redmunds
Copy link
Contributor

@marcelgerber It was a conscious decision by Brackets team to not display a confirmation dialog when deleting files (because they can be retrieved from Trash/Recycle Bin). I know that some people would like this, but showing this dialog needs to controlled by a preference which is off by default.

@marcelgerber
Copy link
Contributor Author

As I've already pointed out in #8651 (comment), there are not-too-edgy cases where there's no trash available.
Take a USB stick, for example. On Windows at least, if you delete a file on a removable disk (USB stick, SD card, USB device, ...), there's no way to recover it later on.
We'd have the same with a cloud file system like Dropbox, Google Drive or FTP.

So the best solution would be to not have a prompt shown if trash is available for the current file, and to have it shown in the other case or if the user set a pref. But I don't think we can determine whether trash is available, so imo the best solution is to always show a prompt.

Also, the way we do it right now is a little odd as well, as we show a prompt for folders but not files, even though you can (usually) recover both. Why folders?

And if it matters, what Windows does is this, at least with my configuration:

  • Delete file/folder reversibly (move to trash): Show no prompt
  • Delete file/folder irreversibly: Show a prompt

@@ -129,6 +129,8 @@ define({
"SAVE_CLOSE_MESSAGE" : "Do you want to save the changes you made in the document <span class='dialog-filename'>{0}</span>?",
"SAVE_CLOSE_MULTI_MESSAGE" : "Do you want to save your changes to the following files?",
"EXT_MODIFIED_TITLE" : "External Changes",
"CONFIRM_FILE_DELETE_TITLE" : "Confirm Delete",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need 2 strings with the same text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could think of another wording in other languages, like Delete file/Delete folder. That's what Windows does, too.
But it's not a problem to use only one if that's what you want.

@TomMalbran
Copy link
Contributor

I agree with @marcelgerber that we should always show the prompt by default. If we really need it, we can add a pref for it, but disabled by default.

I know that we discussed this before, but since then, there have been several request to add a prompt, so we should reconsider it. Even if is easy to recover from the trash (when it is possible), it is easier to say "no" if you clicked delete by mistake.

@redmunds
Copy link
Contributor

redmunds commented Jan 6, 2015

What if we add a "Prompt on Delete" (or something like that) menu item to make this setting easy to toggle?

If we have an easy way to turn it off (i.e. not everyone knows how to edit JSON) then I can live with the preference being true by default. How does everyone else feel about that?

I think this would belong in the File menu.

@marcelgerber
Copy link
Contributor Author

My idea would be a "Don't show this again" checkbox in the dialog, but we've never used checkboxes in dialogs before, so I'm not sure if this needs extra work.

But still, I think in cases where there's no trash available, a warning is a must-have.

@redmunds
Copy link
Contributor

redmunds commented Jan 6, 2015

@marcelgerber The problem with "Don't show again" is people will then need to know how to get back to showing the prompt, so I think we'd still need a menu toggle in that case.

@peterflynn
Copy link
Member

We probably shouldn't make it too easy to turn the dialog off if we can't reliably detect which cases are non-undoable (in that case we'd want to ignore the setting and show the dialog anyway). Until then, IMHO it'd be ok to just have this dialog be always-on with no option to disable.

If the user is doing a lot of delete operations, it's faster to use the OS anyway (since you can multi-select), so I'm not too worried about slowing down the workflow here a tad.

@ficristo
Copy link
Collaborator

Atom, VSCode and Eclipse have the dialog.
Sublime2 does not.
I'd say to add this, and add a preference later if needed like @TomMalbran said.

If people didn't change their system preferences, the deleted file should go to the Recycle Bin: I think the confirmation message should say something about it.

@marcelgerber
Copy link
Contributor Author

marcelgerber commented Jul 22, 2016

@ficristo I've changed the string, but I'm not to keen on the current wording, either. I feel like "In most cases" is too vague.
Any suggestions?

@ficristo
Copy link
Collaborator

Actually CONFIRM_FOLDER_DELETE and CONFIRM_FILE_DELETE should be similar.
While I think it is better to mention the trash-can I guess CONFIRM_FOLDER_DELETE was like that since ever: so just leave the description as it was.
I'm sorry to have caused you some more work...

Restore the description and LGTM.

@marcelgerber
Copy link
Contributor Author

I've now decided to unite CONFIRM_FOLDER_DELETE_TITLE and CONFIRM_FILE_DELETE_TITLE to CONFIRM_DELETE_TITLE since they're probably similar in all languages (the difference should be clarified in the dialog body, not in its title).

Also reverted the string change.
Please have another look.

@ficristo
Copy link
Collaborator

Thank you, LGTM.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants