From d5e854e7efda5572682988faeef500e6f71a7b57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Mon, 14 Oct 2019 20:02:51 +0200 Subject: [PATCH] Expose currently active file list though OCA.Files.App MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files/js/app.js | 25 +++++++++++++++++++++++++ apps/files/js/filelist.js | 3 +++ 2 files changed, 28 insertions(+) diff --git a/apps/files/js/app.js b/apps/files/js/app.js index a6b656311d5..09468205279 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -40,6 +40,8 @@ */ fileList: null, + currentFileList: null, + /** * Backbone model for storing files preferences */ @@ -112,6 +114,7 @@ maxChunkSize: OC.appConfig.files && OC.appConfig.files.max_chunk_size } ); + this.updateCurrentFileList(this.fileList) this.files.initialize(); // for backward compatibility, the global FileList will @@ -160,6 +163,28 @@ } }, + /** + * Set the currently active file list + * + * Due to the file list implementations being registered after clicking the + * navigation item for the first time, OCA.Files.App is not aware of those until + * they have initialized themselves. Therefore the files list needs to call this + * method manually + * + * @param {OCA.Files.FileList} newFileList + */ + updateCurrentFileList: function(newFileList) { + this.currentFileList = newFileList; + }, + + /** + * Return the currently active file list + * @return {?OCA.Files.FileList} + */ + getCurrentFileList: function () { + return this.currentFileList; + }, + /** * Returns the container of the currently visible app. * diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index eee24b648f3..5e6225a48e9 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -434,6 +434,8 @@ OC.Plugins.attach('OCA.Files.FileList', this); + OCA.Files.App && OCA.Files.App.updateCurrentFileList(this); + this.initHeadersAndFooters() }, @@ -738,6 +740,7 @@ * Event handler when leaving previously hidden state */ _onShow: function(e) { + OCA.Files.App && OCA.Files.App.updateCurrentFileList(this); if (this.shown) { if (e.itemId === this.id) { this._setCurrentDir('/', false); -- 2.39.5