aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui
diff options
context:
space:
mode:
authorAnanya Sen2012-02-21 13:04:58 -0800
committerAnanya Sen2012-02-21 13:04:58 -0800
commitadb90eff3323aa780f9a0879572e3cf3b9f0b969 (patch)
tree64294ab5135c537083f5c78269699420b62e3ce1 /js/io/ui
parent9f80fc891b7952900dabec04877606c6c8229c61 (diff)
downloadninja-adb90eff3323aa780f9a0879572e3cf3b9f0b969.tar.gz
- file picker - select file on double click
- check cloud availability before IO operations [open file, new file, Save, Save As]. Canceling operation if cloud was unavailable, as per team's agreement. Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/ui')
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js26
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js7
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js4
3 files changed, 23 insertions, 14 deletions
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 411386f9..428e7bab 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
@@ -214,6 +214,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
214 214
215 this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data 215 this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data
216 this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only 216 this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only
217 this.element.addEventListener("selectFile", function(evt){that.handlePickerNavSelectedFile(evt);}, false);//for file selection
217 this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon 218 this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon
218 this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon 219 this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon
219 //this.addressGo.addEventListener("click", this, false); 220 //this.addressGo.addEventListener("click", this, false);
@@ -669,14 +670,29 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
669 } 670 }
670 }, 671 },
671 672
673 handlePickerNavSelectedFile:{
674 value: function(evt){
675 var uri = evt.fileUri;
676
677 //do selection if in file selection mode
678 if(this.pickerModel.inFileMode && (this.application.ninja.filePickerController._directoryContentCache[uri].type === "file")){
679 this.okButton.removeAttribute("disabled");
680 //put into selectedItems..currently single selection is supported
681 this.selectedItems = [uri];
682 this.currentURI = uri.substring(0, uri.lastIndexOf("/"));
683 this.handleOkButtonAction();
684 }
685 }
686 },
687
672 handlePickerNavShowMetadata: { 688 handlePickerNavShowMetadata: {
673 value: function(evt){ 689 value: function(evt){
674 //update matadata only if nothing is already selected 690 //update matadata only if nothing is already selected
675 if(this.currentSelectedNode == null){ 691 if(this.currentSelectedNode == null){
676 //console.log("handle showmetadata - true"); 692 //console.log("handle showmetadata - true");
677 this.metadataSection.innerHTML = evt.metadata; 693 this.metadataSection.innerHTML = evt.metadata;
678 }
679 } 694 }
695 }
680 }, 696 },
681 697
682 handlePickerNavUpdateMetadata:{ 698 handlePickerNavUpdateMetadata:{
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 7b7f4572..f34ee000 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
@@ -19,12 +19,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
19 writable:false, 19 writable:false,
20 enumerable:true, 20 enumerable:true,
21 value:function(){ 21 value:function(){
22 var that = this;
23
24 this.eventManager.addEventListener("saveAs", function(evt){
25 var data = evt._event.data || {};//data will contain the current file name, directory location and callback
26 that.showSaveAsDialog(data);
27 }, false);
28 } 22 }
29 }, 23 },
30 24
@@ -99,7 +93,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
99 saveAsDialog.fileName = fileName; 93 saveAsDialog.fileName = fileName;
100 saveAsDialog.folderUri = folderUri; 94 saveAsDialog.folderUri = folderUri;
101 saveAsDialog.callback = data.callback; 95 saveAsDialog.callback = data.callback;
102 saveAsDialog.callbackScope = data.callbackScope;
103 saveAsDialog.element = saveAsDialogContainer; 96 saveAsDialog.element = saveAsDialogContainer;
104 97
105 //remove after rendering and add in modal dialog 98 //remove after rendering and add in modal dialog
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 55a09fa8..0a322b99 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
@@ -117,8 +117,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
117 try{ 117 try{
118 //validate file name and folder path 118 //validate file name and folder path
119 //check if file already exists 119 //check if file already exists
120 if(!!this.callback && !!this.callbackScope){//inform document-controller if save successful 120 if(!!this.callback){//inform document-controller if save successful
121 this.callback.call(this.callbackScope, {"filename":filename, "destination": newFileDirectory});//document-controller api 121 this.callback({"filename":filename, "destination": newFileDirectory});//document-controller api
122 }else{ 122 }else{
123 //send save as event 123 //send save as event
124 var saveAsEvent = document.createEvent("Events"); 124 var saveAsEvent = document.createEvent("Events");