commit add7bef0be852b545a9ee348ddbef6b786c4451f
parent a50167ac4097b9fb42fcd391d2f285bee57c6848
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 30 Nov 2010 20:34:08 +0000
Show a meaningful error message when multiple instances of Zotero are open simultaneously
Diffstat:
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js
@@ -100,17 +100,15 @@ var Zotero_Browser = new function() {
//////////////////////////////////////////////////////////////////////////////
- /*
- * Initialize some variables and prepare event listeners for when chrome is done
- * loading
+ /**
+ * Initialize some variables and prepare event listeners for when chrome is done loading
*/
function init() {
- if (!Zotero || !Zotero.initialized) {
+ if (!Zotero || !Zotero.initialized || Zotero.isStandalone) {
return;
}
Zotero_Browser.browserData = new Object();
- Zotero_Browser._scrapePopupShowing = false;
window.addEventListener("load",
function(e) { Zotero_Browser.chromeLoad(e) }, false);
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -216,7 +216,7 @@ var ZoteroPane = new function()
}
if(Zotero.isStandalone) {
- this.toggleDisplay();
+ this.toggleDisplay(true);
this.fullScreen(true);
}
}
@@ -313,7 +313,7 @@ var ZoteroPane = new function()
/*
* Hides/displays the Zotero interface
*/
- function toggleDisplay()
+ function toggleDisplay(forceVisible)
{
if (!ZoteroPane.loaded) {
if (Zotero.locked) {
@@ -336,9 +336,7 @@ var ZoteroPane = new function()
var isCollapsed = true;
}
- if (isHidden || isCollapsed) {
- var makeVisible = true;
- }
+ var makeVisible = forceVisible || isHidden || isCollapsed;
// If Zotero not initialized, try to get the error handler
// or load the default error page
@@ -365,6 +363,8 @@ var ZoteroPane = new function()
errFunc();
}
else {
+ if(Zotero.isStandalone) window.close();
+
// TODO: Add a better error page/window here with reporting
// instructions
// window.loadURI('chrome://zotero/content/error.xul');
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -417,6 +417,12 @@ var Zotero = new function(){
Zotero.getString('startupError.checkPermissions')
]);
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);
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
@@ -76,7 +76,10 @@ app.standalone = Zotero Standalone
app.firefox = Zotero for Firefox
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.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.