Skip to content

Commit d5e854e

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

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
*/
@@ -112,6 +114,7 @@
112114
maxChunkSize: OC.appConfig.files && OC.appConfig.files.max_chunk_size
113115
}
114116
);
117+
this.updateCurrentFileList(this.fileList)
115118
this.files.initialize();
116119

117120
// for backward compatibility, the global FileList will
@@ -160,6 +163,28 @@
160163
}
161164
},
162165

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

apps/files/js/filelist.js

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

435435
OC.Plugins.attach('OCA.Files.FileList', this);
436436

437+
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
438+
437439
this.initHeadersAndFooters()
438440
},
439441

@@ -738,6 +740,7 @@
738740
* Event handler when leaving previously hidden state
739741
*/
740742
_onShow: function(e) {
743+
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
741744
if (this.shown) {
742745
if (e.itemId === this.id) {
743746
this._setCurrentDir('/', false);

0 commit comments

Comments
 (0)