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

Commit

Permalink
Merge pull request #4515 from g-palmer/confirmDelete
Browse files Browse the repository at this point in the history
Confirm folder delete - fixes issue #4446
  • Loading branch information
TomMalbran committed Aug 1, 2013
2 parents 933f1f0 + ba97c12 commit f04c489
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,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.DELETE
}
]
)
.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
3 changes: 3 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 Expand Up @@ -278,6 +280,7 @@ define({
"DONT_SAVE" : "Don't Save",
"SAVE" : "Save",
"CANCEL" : "Cancel",
"DELETE" : "Delete",
"RELOAD_FROM_DISK" : "Reload from Disk",
"KEEP_CHANGES_IN_EDITOR" : "Keep Changes in Editor",
"CLOSE_DONT_SAVE" : "Close (Don't Save)",
Expand Down

0 comments on commit f04c489

Please sign in to comment.