commit b590c43edbf1c32d62cf7cdbbb78d0a6817732a6
parent 26145c3892b1c03204fac7040fbdb4454206c7e6
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 19 Jun 2017 00:43:24 -0400
Disable reset translators/styles buttons while in progress
We should have a better progress notification, but this is better than
nothing.
Diffstat:
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero/preferences/preferences_advanced.js b/chrome/content/zotero/preferences/preferences_advanced.js
@@ -206,7 +206,7 @@ Zotero_Preferences.Advanced = {
},
- resetTranslators: function () {
+ resetTranslators: async function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
@@ -221,17 +221,22 @@ Zotero_Preferences.Advanced = {
null, null, null, {});
if (index == 0) {
- Zotero.Schema.resetTranslators()
- .then(function () {
+ let button = document.getElementById('reset-translators-button');
+ button.disabled = true;
+ try {
+ await Zotero.Schema.resetTranslators();
if (Zotero_Preferences.Export) {
Zotero_Preferences.Export.populateQuickCopyList();
}
- });
+ }
+ finally {
+ button.disabled = false;
+ }
}
},
- resetStyles: function () {
+ resetStyles: async function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
@@ -246,12 +251,17 @@ Zotero_Preferences.Advanced = {
null, null, null, {});
if (index == 0) {
- Zotero.Schema.resetStyles()
- .then(function () {
+ let button = document.getElementById('reset-styles-button');
+ button.disabled = true;
+ try {
+ await Zotero.Schema.resetStyles()
if (Zotero_Preferences.Export) {
Zotero_Preferences.Export.populateQuickCopyList();
}
- });
+ }
+ finally {
+ button.disabled = false;
+ }
}
},
diff --git a/chrome/content/zotero/preferences/preferences_advanced.xul b/chrome/content/zotero/preferences/preferences_advanced.xul
@@ -210,9 +210,11 @@
<hbox style="display: block">
<button label="&zotero.preferences.dbMaintenance.integrityCheck;"
oncommand="Zotero_Preferences.Advanced.runIntegrityCheck()"/>
- <button label="&zotero.preferences.dbMaintenance.resetTranslators;"
+ <button id="reset-translators-button"
+ label="&zotero.preferences.dbMaintenance.resetTranslators;"
oncommand="Zotero_Preferences.Advanced.resetTranslators()"/>
- <button label="&zotero.preferences.dbMaintenance.resetStyles;"
+ <button id="reset-styles-button"
+ label="&zotero.preferences.dbMaintenance.resetStyles;"
oncommand="Zotero_Preferences.Advanced.resetStyles()"/>
</hbox>
</groupbox>
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -1148,7 +1148,7 @@ Zotero.Schema = new function(){
this.resetStyles = Zotero.Promise.coroutine(function* () {
- Zotero.debug("Resetting translators and styles");
+ Zotero.debug("Resetting styles");
var sql = "DELETE FROM version WHERE schema IN "
+ "('styles', 'repository', 'lastcheck')";