From 75b4ff0e8499ab59636be4a7787335a38d700b16 Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Sun, 21 Dec 2014 14:39:20 +0100 Subject: [PATCH] Show "Confirm Delete" dialog for files, too --- src/document/DocumentCommandHandlers.js | 54 ++++++++++++------------- src/nls/root/strings.js | 3 +- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index 7d019e0ba2f..25890e5f173 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -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 */ diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 056fb163aa0..f9c44d0c591 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -131,7 +131,8 @@ define({ "SAVE_CLOSE_MESSAGE" : "Do you want to save the changes you made in the document {0}?", "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 {0}?", "CONFIRM_FOLDER_DELETE" : "Are you sure you want to delete the folder {0}?", "FILE_DELETED_TITLE" : "File Deleted", "EXT_MODIFIED_WARNING" : "{0} has been modified on disk outside of {APP_NAME}.

Do you want to save the file and overwrite those changes?",