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.
This commit is contained in:
Simon Kornblith 2011-07-20 03:48:17 +00:00
parent c24aad3af4
commit 3e26c36b69
2 changed files with 25 additions and 19 deletions

View file

@ -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);

View file

@ -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;
}
}