From 0fc3252895b0cd1b2d1213aae6ce822114048ec2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 24 Feb 2010 21:07:23 +0000 Subject: [PATCH] Closes #1637, Load "Start" page on upgrade Show start page when first run pref is on and either the DB was just initialized or there's no username and password in the Sync pane --- chrome/content/zotero/overlay.js | 16 +++++++++------- chrome/content/zotero/xpcom/zotero.js | 10 ++++++++++ defaults/preferences/zotero.js | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index fc0abb4ff9..e75c68f318 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -181,17 +181,19 @@ var ZoteroPane = new function() } }, 1000); } - // If the database was initialized and Zotero hasn't been run before - // in this profile, display the Quick Start Guide -- this way the guide - // won't be displayed when they sync their DB to another profile or if - // the DB is initialized erroneously (e.g. while switching data - // directory locations) - else if (Zotero.Schema.dbInitialized && Zotero.Prefs.get('firstRun')) { + // If the database was initialized or there are no sync credentials and + // Zotero hasn't been run before in this profile, display the start page + // -- this way the page won't be displayed when they sync their DB to + // another profile or if the DB is initialized erroneously (e.g. while + // switching data directory locations) + else if (Zotero.Prefs.get('firstRun2') + && (Zotero.Schema.dbInitialized || !Zotero.Sync.Server.enabled)) { setTimeout(function () { var url = "http://zotero.org/start"; gBrowser.selectedTab = gBrowser.addTab(url); }, 400); - Zotero.Prefs.set('firstRun', false); + Zotero.Prefs.set('firstRun2', false); + Zotero.Prefs.clear('firstRun'); } // Hide sync debugging menu by default diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 902b6ed80e..ea92749482 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1309,6 +1309,16 @@ Zotero.Prefs = new function(){ } + this.clear = function (pref) { + try { + this.prefBranch.clearUserPref(pref); + } + catch (e) { + throw ("Invalid preference '" + pref + "'"); + } + } + + // // Methods to register a preferences observer // diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 4c5193036e..899c60697d 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -3,7 +3,7 @@ // Add new user-adjustable hidden preferences to // http://www.zotero.org/documentation/hidden_prefs -pref("extensions.zotero.firstRun", true); +pref("extensions.zotero.firstRun2", true); pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zotero.properties"); pref("extensions.zotero.useDataDir", false);