Skip to content

Commit 695bdf8

Browse files
committed
Expose currently active file list though OCA.Files.App
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent b076e3a commit 695bdf8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

apps/files/js/app.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
*/
4141
fileList: null,
4242

43+
currentFileList: null,
44+
4345
/**
4446
* Backbone model for storing files preferences
4547
*/
@@ -116,6 +118,7 @@
116118
maxChunkSize: OC.appConfig.files && OC.appConfig.files.max_chunk_size
117119
}
118120
);
121+
this.currentFileList = this.fileList
119122
this.files.initialize();
120123

121124
// for backward compatibility, the global FileList will
@@ -166,6 +169,28 @@
166169
}
167170
},
168171

172+
/**
173+
* Set the currently active file list
174+
*
175+
* Due to the file list implementations being registered after clicking the
176+
* navigation item for the first time, OCA.Files.App is not aware of those until
177+
* they have initialized themselves. Therefore the files list needs to call this
178+
* method manually
179+
*
180+
* @param {OCA.Files.FileList} newFileList
181+
*/
182+
updateCurrentFileList: function(newFileList) {
183+
this.currentFileList = newFileList;
184+
},
185+
186+
/**
187+
* Return the currently active file list
188+
* @return {OCA.Files.FileList}
189+
*/
190+
getCurrentFileList: function () {
191+
return this.currentFileList;
192+
},
193+
169194
/**
170195
* Returns the container of the currently visible app.
171196
*

apps/files/js/filelist.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@
408408

409409

410410
OC.Plugins.attach('OCA.Files.FileList', this);
411+
412+
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
411413
},
412414

413415
/**
@@ -683,6 +685,7 @@
683685
* Event handler when leaving previously hidden state
684686
*/
685687
_onShow: function(e) {
688+
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
686689
if (this.shown) {
687690
if (e.itemId === this.id) {
688691
this._setCurrentDir('/', false);

0 commit comments

Comments
 (0)