Show a meaningful error message when multiple instances of Zotero are open simultaneously

This commit is contained in:
Simon Kornblith 2010-11-30 20:34:08 +00:00
parent a50167ac40
commit add7bef0be
4 changed files with 18 additions and 11 deletions

View file

@ -100,17 +100,15 @@ var Zotero_Browser = new function() {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/* /**
* Initialize some variables and prepare event listeners for when chrome is done * Initialize some variables and prepare event listeners for when chrome is done loading
* loading
*/ */
function init() { function init() {
if (!Zotero || !Zotero.initialized) { if (!Zotero || !Zotero.initialized || Zotero.isStandalone) {
return; return;
} }
Zotero_Browser.browserData = new Object(); Zotero_Browser.browserData = new Object();
Zotero_Browser._scrapePopupShowing = false;
window.addEventListener("load", window.addEventListener("load",
function(e) { Zotero_Browser.chromeLoad(e) }, false); function(e) { Zotero_Browser.chromeLoad(e) }, false);

View file

@ -216,7 +216,7 @@ var ZoteroPane = new function()
} }
if(Zotero.isStandalone) { if(Zotero.isStandalone) {
this.toggleDisplay(); this.toggleDisplay(true);
this.fullScreen(true); this.fullScreen(true);
} }
} }
@ -313,7 +313,7 @@ var ZoteroPane = new function()
/* /*
* Hides/displays the Zotero interface * Hides/displays the Zotero interface
*/ */
function toggleDisplay() function toggleDisplay(forceVisible)
{ {
if (!ZoteroPane.loaded) { if (!ZoteroPane.loaded) {
if (Zotero.locked) { if (Zotero.locked) {
@ -336,9 +336,7 @@ var ZoteroPane = new function()
var isCollapsed = true; var isCollapsed = true;
} }
if (isHidden || isCollapsed) { var makeVisible = forceVisible || isHidden || isCollapsed;
var makeVisible = true;
}
// If Zotero not initialized, try to get the error handler // If Zotero not initialized, try to get the error handler
// or load the default error page // or load the default error page
@ -365,6 +363,8 @@ var ZoteroPane = new function()
errFunc(); errFunc();
} }
else { else {
if(Zotero.isStandalone) window.close();
// TODO: Add a better error page/window here with reporting // TODO: Add a better error page/window here with reporting
// instructions // instructions
// window.loadURI('chrome://zotero/content/error.xul'); // window.loadURI('chrome://zotero/content/error.xul');

View file

@ -417,6 +417,12 @@ var Zotero = new function(){
Zotero.getString('startupError.checkPermissions') Zotero.getString('startupError.checkPermissions')
]); ]);
this.startupError = msg; this.startupError = msg;
} else if(e.name == "NS_ERROR_STORAGE_BUSY") {
var msg = Zotero.localeJoin([
Zotero.getString('startupError.databaseInUse'),
Zotero.getString(Zotero.isStandalone ? 'startupError.closeFirefox' : 'startupError.closeStandalone')
]);
this.startupError = msg;
} }
Components.utils.reportError(e); Components.utils.reportError(e);

View file

@ -76,7 +76,10 @@ app.standalone = Zotero Standalone
app.firefox = Zotero for Firefox app.firefox = Zotero for Firefox
startupError = There was an error starting Zotero. startupError = There was an error starting Zotero.
startupError.databaseCannotBeOpened = The Zotero database cannot be opened. startupError.databaseInUse = Your Zotero database is currently in use. Only one instance of Zotero using the same database may be opened simultaneously at this time.
startupError.closeStandalone = If Zotero Standalone is open, please close it and restart Firefox.
startupError.closeFirefox = If Firefox with the Zotero extension is open, please close it and restart Zotero Standalone.
startupError.databaseCannotBeOpened = The Zotero database cannot be opened.
startupError.checkPermissions = Make sure you have read and write permissions to all files in the Zotero data directory. startupError.checkPermissions = Make sure you have read and write permissions to all files in the Zotero data directory.
startupError.zoteroVersionIsOlder = This version of Zotero is older than the version last used with your database. startupError.zoteroVersionIsOlder = This version of Zotero is older than the version last used with your database.
startupError.zoteroVersionIsOlder.upgrade = Please upgrade to the latest version from zotero.org. startupError.zoteroVersionIsOlder.upgrade = Please upgrade to the latest version from zotero.org.