www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 112b6d22e8349f720a6f7c6904313969dfe31aa2
parent 6d4d95385920dde78e66604782dc33995bb7df49
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 17 Jun 2010 06:38:03 +0000

closes #1598, Possible to click Insert Citation twice

When the user attempts to access Integration functionality while a request is still in progress, we now bring Firefox/Zotero to the foreground.


Diffstat:
Mchrome/content/zotero/xpcom/integration.js | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -31,6 +31,7 @@ const DATA_VERSION = 3; Zotero.Integration = new function() { var _fifoFile = null; var _osascriptFile; + var _inProgress = false; this.sessions = {}; @@ -156,6 +157,13 @@ Zotero.Integration = new function() { * Executes an integration command. */ this.execCommand = function execCommand(agent, command) { + if(_inProgress) { + Zotero.Integration.activate(); + Zotero.debug("Integration: Request already in progress; not executing "+agent+" "+command); + return; + } + _inProgress = true; + // Try to load the appropriate Zotero component; otherwise display an error using the alert // service try { @@ -164,6 +172,7 @@ Zotero.Integration = new function() { var application = Components.classes[componentClass] .getService(Components.interfaces.zoteroIntegrationApplication); } catch(e) { + _inProgress = false; Zotero.Integration.activate(); Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService) @@ -176,6 +185,7 @@ Zotero.Integration = new function() { try { var integration = new Zotero.Integration.Document(application); } catch(e) { + _inProgress = false; Zotero.Integration.activate(); Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService) @@ -228,6 +238,7 @@ Zotero.Integration = new function() { } } } finally { + _inProgress = false; integration.cleanup(); } }