commit 3e26c36b69f7ca754223863a7f8560bb5fc4d597
parent c24aad3af4479f99dc85081bc887434a476e91a5
Author: Simon Kornblith <simon@simonster.com>
Date: Wed, 20 Jul 2011 03:48:17 +0000
Use Zotero.startupError for connector-related errors and use the DB busy error if Zotero switched to
connector mode and then couldn't contact the connector.
Diffstat:
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -178,7 +178,12 @@ var ZoteroOverlay = new function()
* Hides/displays the Zotero interface
*/
this.toggleDisplay = function(makeVisible)
- {
+ {
+ if(!Zotero || !Zotero.initialized) {
+ ZoteroPane.displayStartupError();
+ return;
+ }
+
if(makeVisible || makeVisible === undefined) {
if(Zotero.isConnector) {
// If in connector mode, bring Zotero Standalone to foreground
@@ -191,11 +196,6 @@ var ZoteroOverlay = new function()
}
}
- if(!Zotero || !Zotero.initialized) {
- ZoteroPane.displayStartupError();
- return;
- }
-
if(makeVisible === undefined) makeVisible = zoteroPane.hidden || zoteroPane.collapsed;
zoteroSplitter.setAttribute('hidden', !makeVisible);
diff --git a/chrome/content/zotero/xpcom/connector/connector_firefox.js b/chrome/content/zotero/xpcom/connector/connector_firefox.js
@@ -24,23 +24,29 @@
*/
Zotero.Connector_Browser = new function() {
- var _incompatibleVersionMessageShown;
-
/**
* Called if Zotero version is determined to be incompatible with Standalone
*/
this.onIncompatibleStandaloneVersion = function(zoteroVersion, standaloneVersion) {
- if(_incompatibleVersionMessageShown) return;
- var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
- createInstance(Components.interfaces.nsIPromptService);
- ps.alert(null,
- Zotero.getString("connector.error.title"),
- 'Zotero '+zoteroVersion+' is incompatible with the running '+
+ Zotero.startupError = 'Zotero for Firefox '+Zotero.version+' is incompatible with the running '+
'version of Zotero Standalone'+(standaloneVersion ? " ("+standaloneVersion+")" : "")+
- '. Zotero Connector will continue to operate, but functionality that relies upon '+
- 'Zotero Standalone may be unavaliable.\n\n'+
- 'Please ensure that you have installed the latest version of these components. See '+
- 'http://www.zotero.org/support/standalone for more details.');
- _incompatibleVersionMessageShown = true;
+ '.\n\nPlease ensure that you have installed the latest version of these components. See '+
+ 'http://www.zotero.org/support/standalone for more details.';
+ Zotero.initialized = false;
+ }
+
+ /**
+ * Called if connector is offline. This should only happen if Zotero is getting a DB busy
+ * message and no connector is open, so use the DB busy error message here.
+ */
+ this.onStateChange = function(isOnline) {
+ if(isOnline) return;
+
+ var msg = Zotero.localeJoin([
+ Zotero.getString('startupError.databaseInUse'),
+ Zotero.getString(Zotero.isStandalone ? 'startupError.closeFirefox' : 'startupError.closeStandalone')
+ ]);
+ Zotero.startupError = msg;
+ Zotero.initialized = false;
}
}
\ No newline at end of file