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

Confirm folder delete - fixes issue #4446 #4515

Merged
merged 8 commits into from
Aug 1, 2013
Merged
30 changes: 29 additions & 1 deletion src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,35 @@ define(function (require, exports, module) {

function handleFileDelete() {
var entry = ProjectManager.getSelectedItem();
ProjectManager.deleteItem(entry);
if (entry.isDirectory) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_EXT_DELETED,
Strings.CONFIRM_FOLDER_DELETE_TITLE,
StringUtils.format(
Strings.CONFIRM_FOLDER_DELETE,
StringUtils.breakableUrl(entry.name)
),
[
{
className : Dialogs.DIALOG_BTN_CLASS_NORMAL,
id : Dialogs.DIALOG_BTN_CANCEL,
text : Strings.CANCEL
},
{
className : Dialogs.DIALOG_BTN_CLASS_PRIMARY,
id : Dialogs.DIALOG_BTN_OK,
text : Strings.CMD_FILE_DELETE
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I prefer if this was a new string. If we ever change the name of the Command, this button should still be delete. Could you add the new string? Place it close to CANCEL and OK, as is the name of the button.

}
]
)
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
ProjectManager.deleteItem(entry);
}
});
} else {
ProjectManager.deleteItem(entry);
}
}

/** Show the selected sidebar (tree or working set) item in Finder/Explorer */
Expand Down
2 changes: 2 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,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_FOLDER_DELETE_TITLE" : "Confirm Delete",
"CONFIRM_FOLDER_DELETE" : "Are you sure you want to delete the folder <span class='dialog-filename'>{0}</span>?",
"FILE_DELETED_TITLE" : "File Deleted",
"EXT_MODIFIED_MESSAGE" : "<span class='dialog-filename'>{0}</span> has been modified on disk, but also has unsaved changes in {APP_NAME}.<br /><br />Which version do you want to keep?",
"EXT_DELETED_MESSAGE" : "<span class='dialog-filename'>{0}</span> has been deleted on disk, but has unsaved changes in {APP_NAME}.<br /><br />Do you want to keep your changes?",
Expand Down