diff options
author | Ananya Sen | 2012-02-16 13:11:48 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-16 13:11:48 -0800 |
commit | a9c369c2e5d8f6fc8d936f7e1e6b84f693226ddf (patch) | |
tree | c82b8845ed4dee8d30797d317d44aa8b169bc62f /js/components/ui/FilePicker/file-picker-model.js | |
parent | 302ae3c1812086d976eb67c9cf693c43205f3904 (diff) | |
download | ninja-a9c369c2e5d8f6fc8d936f7e1e6b84f693226ddf.tar.gz |
moved file picker in file io
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components/ui/FilePicker/file-picker-model.js')
-rwxr-xr-x | js/components/ui/FilePicker/file-picker-model.js | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/js/components/ui/FilePicker/file-picker-model.js b/js/components/ui/FilePicker/file-picker-model.js deleted file mode 100755 index d9cf02ed..00000000 --- a/js/components/ui/FilePicker/file-picker-model.js +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var filePickerControllerModule = require("js/components/ui/FilePicker/file-picker-controller"); | ||
8 | |||
9 | //this is per file picker instance | ||
10 | exports.FilePickerModel = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, { | ||
11 | |||
12 | fatalError:{ | ||
13 | writable:true, | ||
14 | enumerable:true, | ||
15 | value:null | ||
16 | }, | ||
17 | |||
18 | _fileFilters:{ | ||
19 | writable:true, | ||
20 | enumerable:false, | ||
21 | value:null | ||
22 | }, | ||
23 | fileFilters:{ | ||
24 | get:function(){ | ||
25 | return this._fileFilters; | ||
26 | }, | ||
27 | set:function(value){ | ||
28 | this._fileFilters = value; | ||
29 | } | ||
30 | }, | ||
31 | _currentFilter:{ | ||
32 | writable:true, | ||
33 | enumerable:false, | ||
34 | value:null | ||
35 | }, | ||
36 | currentFilter:{ | ||
37 | get:function(){ | ||
38 | return this._currentFilter; | ||
39 | }, | ||
40 | set:function(value){ | ||
41 | this._currentFilter = value; | ||
42 | } | ||
43 | }, | ||
44 | |||
45 | /** | ||
46 | * true -> file selection mode | ||
47 | * false -> directory selection mode | ||
48 | */ | ||
49 | inFileMode:{ | ||
50 | writable:true, | ||
51 | enumerable:false, | ||
52 | value:null | ||
53 | }, | ||
54 | |||
55 | /** | ||
56 | * pickerMode: ["read", "write"] : specifies if the file picker is opened to read a file/folder or to save a file | ||
57 | */ | ||
58 | pickerMode:{ | ||
59 | writable:true, | ||
60 | enumerable:false, | ||
61 | value:null | ||
62 | }, | ||
63 | |||
64 | topLevelDirectories:{ | ||
65 | writable:true, | ||
66 | enumerable:true, | ||
67 | value:[] | ||
68 | }, | ||
69 | |||
70 | currentRoot:{ | ||
71 | writable:true, | ||
72 | enumerable:true, | ||
73 | value:"" | ||
74 | }, | ||
75 | |||
76 | callback:{ | ||
77 | writable:true, | ||
78 | enumerable:true, | ||
79 | value:null | ||
80 | }, | ||
81 | |||
82 | callbackScope:{ | ||
83 | writable:true, | ||
84 | enumerable:true, | ||
85 | value:null | ||
86 | }, | ||
87 | |||
88 | /** | ||
89 | * stores the previously viewed directory uris in an array [FILO] per file picker instance | ||
90 | */ | ||
91 | _history:{ | ||
92 | writable:true, | ||
93 | enumerable:true, | ||
94 | value:[]//array of visited URIs for the back/forward arrows | ||
95 | }, | ||
96 | |||
97 | /** | ||
98 | * store history of folders navigated if it was already not visited last | ||
99 | */ | ||
100 | storeHistory:{ | ||
101 | writable:false, | ||
102 | enumerable:true, | ||
103 | value:function(uri){ | ||
104 | //remove redundant / at end | ||
105 | // uri = new String(uri); | ||
106 | // if((uri.charAt(uri.length - 1) === "/") || (uri.charAt(uri.length - 1) === "\\")){ | ||
107 | // uri = uri.substring(0, (uri.length - 1)); | ||
108 | // } | ||
109 | //console.log("storeHistory: "+uri); | ||
110 | if(uri && (uri !== this._history[this._history.length -1]) && (!!filePickerControllerModule.FilePickerController._directoryContentCache[uri]) && (filePickerControllerModule.FilePickerController._directoryContentCache[uri].type === "directory")){ | ||
111 | //remove history after current pointer | ||
112 | if(this._history.length >0){ | ||
113 | this._history.splice((this.currentHistoryPointer+1), (this._history.length - this.currentHistoryPointer - 1)); | ||
114 | } | ||
115 | //now add the new state | ||
116 | this._history.push(uri); | ||
117 | this.currentHistoryPointer = this._history.length -1; | ||
118 | //console.log("### stored: "+uri+" : pointer="+this.currentHistoryPointer); | ||
119 | } | ||
120 | } | ||
121 | }, | ||
122 | |||
123 | currentHistoryPointer:{ | ||
124 | writable:true, | ||
125 | enumerable:true, | ||
126 | value:-1 | ||
127 | } | ||
128 | }); \ No newline at end of file | ||