diff options
author | Ananya Sen | 2012-03-22 10:38:44 -0700 |
---|---|---|
committer | Ananya Sen | 2012-03-22 10:38:44 -0700 |
commit | 2557f463c1cfe2d0dd8ea187c184755bd141dab4 (patch) | |
tree | a842cee837b5d0c5a314bdd98b3c96eb98f154da /js/io/ui/new-file-dialog | |
parent | 61a419422b1a05a779fd9a66c53de3fa8ab5f65a (diff) | |
download | ninja-2557f463c1cfe2d0dd8ea187c184755bd141dab4.tar.gz |
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 <Ananya.Sen@motorola.com>
Conflicts:
js/io/ui/new-file-dialog/new-file-workflow-controller.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/ui/new-file-dialog')
3 files changed, 26 insertions, 2 deletions
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 0e1e09a4..c4b7ea99 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | |||
@@ -34,6 +34,12 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
34 | newFileNameSetEvent.newFileName = this.newFileName.value; | 34 | newFileNameSetEvent.newFileName = this.newFileName.value; |
35 | this.eventManager.dispatchEvent(newFileNameSetEvent); | 35 | this.eventManager.dispatchEvent(newFileNameSetEvent); |
36 | } | 36 | } |
37 | if(evt.keyCode === 13){ | ||
38 | var enterPressedEvent = document.createEvent("Events"); | ||
39 | enterPressedEvent.initEvent("enterPressed", false, false); | ||
40 | enterPressedEvent.newFileName = this.newFileName.value; | ||
41 | this.eventManager.dispatchEvent(enterPressedEvent); | ||
42 | } | ||
37 | } | 43 | } |
38 | } | 44 | } |
39 | 45 | ||
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index aaf39005..5adcc250 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | |||
@@ -106,6 +106,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
106 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); | 106 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); |
107 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); | 107 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); |
108 | 108 | ||
109 | this.element.addEventListener("enterPressed", function(evt){ | ||
110 | if(!that.okButton.hasAttribute("disabled")){ | ||
111 | that.handleOkButtonAction(evt); | ||
112 | } | ||
113 | }, false); | ||
114 | |||
109 | if(!!this.newFileModel.defaultProjectType){ | 115 | if(!!this.newFileModel.defaultProjectType){ |
110 | var templates = this.newFileModel.prepareContents(this.newFileModel.defaultProjectType); | 116 | var templates = this.newFileModel.prepareContents(this.newFileModel.defaultProjectType); |
111 | this.templateList = iconsListModule.IconsList.create(); | 117 | this.templateList = iconsListModule.IconsList.create(); |
@@ -382,6 +388,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
382 | this.element.removeEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only | 388 | this.element.removeEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only |
383 | this.eventManager.removeEventListener("newFileDirectorySet", function(evt){that.handleNewFileDirectorySet(evt);}, false); | 389 | this.eventManager.removeEventListener("newFileDirectorySet", function(evt){that.handleNewFileDirectorySet(evt);}, false); |
384 | this.eventManager.removeEventListener("newFileNameSet", function(evt){that.handleNewFileNameSet(evt);}, false); | 390 | this.eventManager.removeEventListener("newFileNameSet", function(evt){that.handleNewFileNameSet(evt);}, false); |
391 | |||
392 | this.application.ninja.newFileController.newFileOptionsNav = null; | ||
385 | } | 393 | } |
386 | }, | 394 | }, |
387 | 395 | ||
diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js index d065ca35..279a74b4 100755 --- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js +++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js | |||
@@ -27,6 +27,16 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre | |||
27 | value: null | 27 | value: null |
28 | }, | 28 | }, |
29 | 29 | ||
30 | newFileOptionsNav:{ | ||
31 | enumerable:true, | ||
32 | value: null | ||
33 | }, | ||
34 | |||
35 | saveAsDialog:{ | ||
36 | enumerable:true, | ||
37 | value: null | ||
38 | }, | ||
39 | |||
30 | showNewFileDialog:{ | 40 | showNewFileDialog:{ |
31 | writable:false, | 41 | writable:false, |
32 | enumerable:true, | 42 | enumerable:true, |
@@ -49,7 +59,7 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre | |||
49 | this.model.defaultProjectType = lastSelectedProjectType; | 59 | this.model.defaultProjectType = lastSelectedProjectType; |
50 | } | 60 | } |
51 | 61 | ||
52 | var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); | 62 | var newFileOptionsNav = this.newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); |
53 | newFileOptionsNav.newFileModel = this.model; | 63 | newFileOptionsNav.newFileModel = this.model; |
54 | 64 | ||
55 | var popup = Popup.create(); | 65 | var popup = Popup.create(); |
@@ -70,7 +80,7 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre | |||
70 | var fileName = data.fileName || "filename.txt"; | 80 | var fileName = data.fileName || "filename.txt"; |
71 | var folderUri = data.folderUri || "/Documents"; | 81 | var folderUri = data.folderUri || "/Documents"; |
72 | 82 | ||
73 | var saveAsDialog = saveAsModule.SaveAsDialog.create(); | 83 | var saveAsDialog = this.saveAsDialog = saveAsModule.SaveAsDialog.create(); |
74 | saveAsDialog.fileName = fileName; | 84 | saveAsDialog.fileName = fileName; |
75 | saveAsDialog.folderUri = folderUri; | 85 | saveAsDialog.folderUri = folderUri; |
76 | saveAsDialog.callback = data.callback; | 86 | saveAsDialog.callback = data.callback; |