www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 87bf3f21e46b87fc077597a218db6ac69004a76b
parent 7da0313a8b9edc317de76b808d9a1b40356f62ed
Author: Simon Kornblith <simon@simonster.com>
Date:   Fri, 25 Mar 2011 03:38:42 +0000

preserve collection when switching between pane and tab


Diffstat:
Mchrome/content/zotero/overlay.js | 3++-
Mchrome/content/zotero/zoteroPane.js | 19+++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -302,7 +302,8 @@ var ZoteroOverlay = new function() */ this.toggleTab = function(setMode) { var tab = this.findZoteroTab(); - window.zoteroSavedSelection = ZoteroPane.itemsView.saveSelection(); + window.zoteroSavedItemSelection = ZoteroPane.itemsView.saveSelection(); + window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.saveSelection(); if(tab) { // Zotero is running in a tab if(setMode) return; // don't do anything if Zotero tab is the only tab diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -347,21 +347,28 @@ var ZoteroPane = new function() return false; } - this.unserializePersist(); + this.updateTagSelectorSize(); + // restore saved row selection (for tab switching) var containerWindow = (window.ZoteroTab ? window.ZoteroTab.containerWindow : window); - if(containerWindow.zoteroSavedSelection) { + if(containerWindow.zoteroSavedCollectionSelection) { + this.collectionsView.rememberSelection(containerWindow.zoteroSavedCollectionSelection); + delete containerWindow.zoteroSavedCollectionSelection; + } + + // restore saved item selection (for tab switching) + if(containerWindow.zoteroSavedItemSelection) { var me = this; // hack to restore saved selection after itemTreeView finishes loading window.setTimeout(function() { - if(containerWindow.zoteroSavedSelection) { - me.itemsView.rememberSelection(containerWindow.zoteroSavedSelection) - delete containerWindow.zoteroSavedSelection; + if(containerWindow.zoteroSavedItemSelection) { + me.itemsView.rememberSelection(containerWindow.zoteroSavedItemSelection); + delete containerWindow.zoteroSavedItemSelection; } }, 51); } - this.updateTagSelectorSize(); + this.unserializePersist(); // Focus the quicksearch on pane open setTimeout("document.getElementById('zotero-tb-search').inputField.select();", 1);