diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index ea4d65328..4c7f126c1 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -69,8 +69,19 @@ Zotero.CollectionTreeView.prototype.setTree = function(treebox) this.refresh(); - //select Library - this.selection.select(0); + // Select the last-viewed collection + var lastViewedFolder = Zotero.Prefs.get('lastViewedFolder'); + var matches = lastViewedFolder.match(/^(?:(C|S)([0-9]+)|L)$/); + var select = 0; + if (matches) { + if (matches[1] == 'C' && this._collectionRowMap[matches[2]]) { + select = this._collectionRowMap[matches[2]]; + } + else if (matches[1] == 'S' && this._searchRowMap[matches[2]]) { + select = this._searchRowMap[matches[2]]; + } + } + this.selection.select(select); } /* diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 3c58ae4c4..05039ce12 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -2564,6 +2564,8 @@ Zotero.Items = new function(){ function cacheFields(fields, items) { + Zotero.debug("Caching fields [" + fields.join() + "]" + + (items ? " for " + items + " items" : '')); _load(items); var primaryFields = []; diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 33cebc7d8..afaecd59e 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -24,6 +24,7 @@ pref("extensions.zotero.capitalizeTitles", true); pref("extensions.zotero.lastCreatorFieldMode",0); pref("extensions.zotero.lastAbstractExpand",0); pref("extensions.zotero.lastRenameAssociatedFile", false); +pref("extensions.zotero.lastViewedFolder", 'L'); // Keyboard shortcuts pref("extensions.zotero.keys.overrideGlobal", false);