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.
This commit is contained in:
parent
6d4d953859
commit
112b6d22e8
1 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue