]> source.dussan.org Git - nextcloud-server.git/commitdiff
Expose currently active file list though OCA.Files.App 17536/head
authorJulius Härtl <jus@bitgrid.net>
Mon, 14 Oct 2019 18:02:51 +0000 (20:02 +0200)
committerJulius Härtl <jus@bitgrid.net>
Tue, 25 Aug 2020 20:42:44 +0000 (22:42 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/files/js/app.js
apps/files/js/filelist.js

index a6b656311d58623d5d5c094742210842a09fc52c..09468205279d77cf378156b9c97bb987bbae4d98 100644 (file)
@@ -40,6 +40,8 @@
                 */
                fileList: null,
 
+               currentFileList: null,
+
                /**
                 * Backbone model for storing files preferences
                 */
                                        maxChunkSize: OC.appConfig.files && OC.appConfig.files.max_chunk_size
                                }
                        );
+                       this.updateCurrentFileList(this.fileList)
                        this.files.initialize();
 
                        // for backward compatibility, the global FileList will
                        }
                },
 
+               /**
+                * 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.
                 *
index eee24b648f337cf8321ff463f31f77ee77c0360e..5e6225a48e9e7eb0f87c33be7ac4293be842be5f 100644 (file)
 
                        OC.Plugins.attach('OCA.Files.FileList', this);
 
+                       OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
+
                        this.initHeadersAndFooters()
                },
 
                 * 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);