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 #10258 from MarcelGerber/confirm-delete-dialog
Browse files Browse the repository at this point in the history
Show "Confirm Delete" dialog for files, too
  • Loading branch information
Marcel Gerber authored Jul 24, 2016
2 parents 78548a5 + 75b4ff0 commit f376d89
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
54 changes: 25 additions & 29 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1525,35 +1525,31 @@ define(function (require, exports, module) {
/** Delete file command handler **/
function handleFileDelete() {
var entry = ProjectManager.getSelectedItem();
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);
}
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_EXT_DELETED,
Strings.CONFIRM_DELETE_TITLE,
StringUtils.format(
entry.isFile ? Strings.CONFIRM_FILE_DELETE : 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);
}
});
}

/** Show the selected sidebar (tree or workingset) item in Finder/Explorer */
Expand Down
3 changes: 2 additions & 1 deletion src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,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_DELETE_TITLE" : "Confirm Delete",
"CONFIRM_FILE_DELETE" : "Are you sure you want to delete the file <span class='dialog-filename'>{0}</span>?",
"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_WARNING" : "<span class='dialog-filename'>{0}</span> has been modified on disk outside of {APP_NAME}.<br /><br />Do you want to save the file and overwrite those changes?",
Expand Down

0 comments on commit f376d89

Please sign in to comment.