diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 690d85847..35d6bb8a1 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -36,11 +36,15 @@ */ Zotero.CollectionTreeView = function() { - this._treebox = null; this.itemToSelect = null; + this.hideSources = []; + + this._treebox = null; this._highlightedRows = {}; this._unregisterID = Zotero.Notifier.registerObserver(this, ['collection', 'search', 'share', 'group', 'bucket']); - this.hideSources = []; + this._containerState = {}; + this._duplicatesLibraries = []; + this._unfiledLibraries = []; } /* @@ -71,7 +75,15 @@ Zotero.CollectionTreeView.prototype.setTree = function(treebox) } }, false); - this.refresh(); + try { + this.refresh(); + } + // Tree errors don't get caught by default + catch (e) { + Zotero.debug(e); + Components.utils.reportError(e); + throw (e); + } this.selection.currentColumn = this._treebox.columns.getFirstColumn(); @@ -107,86 +119,46 @@ Zotero.CollectionTreeView.prototype.refresh = function() this._dataItems = []; this.rowCount = 0; + try { + this._containerState = JSON.parse(Zotero.Prefs.get("sourceList.persist")); + } + catch (e) { + this._containerState = {}; + } + if (this.hideSources.indexOf('duplicates') == -1) { try { - var duplicateLibraries = Zotero.Prefs.get('duplicateLibraries').split(','); + this._duplicateLibraries = Zotero.Prefs.get('duplicateLibraries').split(','); } catch (e) { // Add to personal library by default Zotero.Prefs.set('duplicateLibraries', '0'); - duplicateLibraries = ['0']; + this._duplicateLibraries = ['0']; } } try { - var unfiledLibraries = Zotero.Prefs.get('unfiledLibraries').split(','); + this._unfiledLibraries = Zotero.Prefs.get('unfiledLibraries').split(','); } catch (e) { // Add to personal library by default Zotero.Prefs.set('unfiledLibraries', '0'); - unfiledLibraries = ['0']; + this._unfiledLibraries = ['0']; } var self = this; var library = { id: null, - libraryID: null, - expand: function () { - var newRows = 0; - - var collections = Zotero.getCollections(); - for (var i=0; i