From 2557f463c1cfe2d0dd8ea187c184755bd141dab4 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 10:38:44 -0700 Subject: IKNINJA-1302 : For File>New and File>SaveAll dialogs, 'ESC' key now triggers Cancel button and 'Enter' key now triggers OK button. For File picker, the 'ESC' now triggers the Cancel button. Signed-off-by: Ananya Sen Conflicts: js/io/ui/new-file-dialog/new-file-workflow-controller.js Signed-off-by: Ananya Sen --- js/io/ui/save-as-dialog.reel/save-as-dialog.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'js/io/ui/save-as-dialog.reel') diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index c60a92f9..98749106 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js @@ -83,6 +83,11 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { this.enableOk(); } } + if(evt.keyCode === 13){ + if(!this.okButton.hasAttribute("disabled")){ + this.handleOkButtonAction(evt); + } + } } }, @@ -99,7 +104,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { handleCancelButtonAction :{ value:function(evt){ //clean up memory - //this.cleanup(); + this.cleanup(); if(this.popup){ this.popup.hide(); @@ -134,7 +139,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { if(success){ //clean up memory - //this.cleanup(); + this.cleanup(); if(this.popup){ this.popup.hide(); @@ -227,6 +232,20 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { } return status; } + }, + + cleanup:{ + value:function(){ + var self = this; + + //remove event listener + this.newFileName.removeEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); + this.eventManager.removeEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); + this.okButton.removeEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); + this.cancelButton.removeEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); + + this.application.ninja.newFileController.saveAsDialog = null; } + } }); \ No newline at end of file -- cgit v1.2.3