aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-03-22 10:28:34 -0700
committerAnanya Sen2012-03-22 10:28:34 -0700
commit61a419422b1a05a779fd9a66c53de3fa8ab5f65a (patch)
tree54fca046a7d42577397f11f1b4841cfc18d72028 /js/controllers
parent57cc00a5ef3ab525e54a030d7692b2d9eefaa68b (diff)
downloadninja-61a419422b1a05a779fd9a66c53de3fa8ab5f65a.tar.gz
- enable/disable save, saveAs, saveAll, close, closeAll as per documents open
- added close file and close all menu items Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Conflicts: js/helper-classes/3D/draw-utils.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 7d982a62..4363e440 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -32,22 +32,30 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
32 _iframeHolder: { value: null, enumerable: false }, 32 _iframeHolder: { value: null, enumerable: false },
33 _textHolder: { value: null, enumerable: false }, 33 _textHolder: { value: null, enumerable: false },
34 _codeMirrorCounter: {value: 1, enumerable: false}, 34 _codeMirrorCounter: {value: 1, enumerable: false},
35
36 canSave:{value: false},//for Save menu state update
37 canSaveAll:{value: false},//for Save All menu state update
35 38
36 activeDocument: { 39 activeDocument: {
37 get: function() { 40 get: function() {
38 return this._activeDocument; 41 return this._activeDocument;
39 }, 42 },
40 set: function(doc) { 43 set: function(doc) {
41 if(!!this._activeDocument) this._activeDocument.isActive = false; 44 if(!!this._activeDocument){ this._activeDocument.isActive = false;}
42
43 this._activeDocument = doc; 45 this._activeDocument = doc;
44 if(!!this._activeDocument){ 46 if(!!this._activeDocument){
45
46 if(this._documents.indexOf(doc) === -1) this._documents.push(doc); 47 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
47 this._activeDocument.isActive = true; 48 this._activeDocument.isActive = true;
49
48 if(!!this._activeDocument.editor){ 50 if(!!this._activeDocument.editor){
49 this._activeDocument.editor.focus(); 51 this._activeDocument.editor.focus();
50 } 52 }
53
54 this.canSave = doc.needsSave;
55 this.canSaveAll = doc.needsSave;
56 }else{
57 this.canSave = false;
58 this.canSaveAll = false;
51 } 59 }
52 } 60 }
53 }, 61 },
@@ -61,6 +69,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
61 this.eventManager.addEventListener("executeSaveAs", this, false); 69 this.eventManager.addEventListener("executeSaveAs", this, false);
62 this.eventManager.addEventListener("executeSaveAll", this, false); 70 this.eventManager.addEventListener("executeSaveAll", this, false);
63 this.eventManager.addEventListener("executeFileClose", this, false); 71 this.eventManager.addEventListener("executeFileClose", this, false);
72 this.eventManager.addEventListener("executeFileCloseAll", this, false);
64 73
65 this.eventManager.addEventListener("styleSheetDirty", this, false); 74 this.eventManager.addEventListener("styleSheetDirty", this, false);
66 75
@@ -172,6 +181,17 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
172 } 181 }
173 }, 182 },
174 //////////////////////////////////////////////////////////////////// 183 ////////////////////////////////////////////////////////////////////
184 handleExecuteFileCloseAll:{
185 value: function(event) {
186 var i=0;
187 if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
188 while(this._documents.length > 0){
189 this.closeDocument(this._documents[this._documents.length -1].uuid);
190 }
191 }
192 }
193 },
194 ////////////////////////////////////////////////////////////////////
175 // 195 //
176 fileSaveResult: { 196 fileSaveResult: {
177 value: function (result) { 197 value: function (result) {