aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui
diff options
context:
space:
mode:
authorAnanya Sen2012-03-22 10:38:44 -0700
committerAnanya Sen2012-03-22 10:38:44 -0700
commit2557f463c1cfe2d0dd8ea187c184755bd141dab4 (patch)
treea842cee837b5d0c5a314bdd98b3c96eb98f154da /js/io/ui
parent61a419422b1a05a779fd9a66c53de3fa8ab5f65a (diff)
downloadninja-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')
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js7
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js2
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js6
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js8
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js14
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js23
6 files changed, 54 insertions, 6 deletions
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 105dc223..e3276ee6 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -23,6 +23,11 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
23 } 23 }
24 }, 24 },
25 25
26 pickerNavChoices:{
27 enumerable: true,
28 value: null
29 },
30
26 filePickerPopupType:{ 31 filePickerPopupType:{
27 enumerable: false, 32 enumerable: false,
28 value: "filePicker" 33 value: "filePicker"
@@ -149,7 +154,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
149 writable:false, 154 writable:false,
150 enumerable:true, 155 enumerable:true,
151 value:function(callback, aModel){ 156 value:function(callback, aModel){
152 var pickerNavChoices = Montage.create(pickerNavigatorReel); 157 var pickerNavChoices = this.pickerNavChoices = Montage.create(pickerNavigatorReel);
153 var initUri = aModel.currentRoot; 158 var initUri = aModel.currentRoot;
154 159
155 //remove extra / at the end 160 //remove extra / at the end
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
index 7a9d90b4..e31fa29d 100644
--- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
+++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
@@ -258,7 +258,6 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
258 this.element.addEventListener("refreshTreeSegment", function(evt){that.handlePickerNavRefreshTreeSegment(evt);}, false); 258 this.element.addEventListener("refreshTreeSegment", function(evt){that.handlePickerNavRefreshTreeSegment(evt);}, false);
259 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); 259 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false);
260 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); 260 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false);
261
262 this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); 261 this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false);
263 this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); 262 this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false);
264 263
@@ -1071,6 +1070,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
1071 //clear memory - TODO:check for more memory leaks 1070 //clear memory - TODO:check for more memory leaks
1072 this.pickerModel = null; 1071 this.pickerModel = null;
1073 this.application.ninja.filePickerController._directoryContentCache = {}; 1072 this.application.ninja.filePickerController._directoryContentCache = {};
1073 this.application.ninja.filePickerController.pickerNavChoices = null;
1074 //remove listeners 1074 //remove listeners
1075 this.element.removeEventListener("openFolder", this, false);//add icon double click event listener to reload iconList with new set of data 1075 this.element.removeEventListener("openFolder", this, false);//add icon double click event listener to reload iconList with new set of data
1076 this.element.removeEventListener("selectedItem", this, false);//for single selection only 1076 this.element.removeEventListener("selectedItem", this, false);//for single selection only
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;
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, {
83 this.enableOk(); 83 this.enableOk();
84 } 84 }
85 } 85 }
86 if(evt.keyCode === 13){
87 if(!this.okButton.hasAttribute("disabled")){
88 this.handleOkButtonAction(evt);
89 }
90 }
86 } 91 }
87 }, 92 },
88 93
@@ -99,7 +104,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
99 handleCancelButtonAction :{ 104 handleCancelButtonAction :{
100 value:function(evt){ 105 value:function(evt){
101 //clean up memory 106 //clean up memory
102 //this.cleanup(); 107 this.cleanup();
103 108
104 if(this.popup){ 109 if(this.popup){
105 this.popup.hide(); 110 this.popup.hide();
@@ -134,7 +139,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
134 139
135 if(success){ 140 if(success){
136 //clean up memory 141 //clean up memory
137 //this.cleanup(); 142 this.cleanup();
138 143
139 if(this.popup){ 144 if(this.popup){
140 this.popup.hide(); 145 this.popup.hide();
@@ -227,6 +232,20 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
227 } 232 }
228 return status; 233 return status;
229 } 234 }
235 },
236