Add a button in preferences to enable word plugins if some are disabled
This commit is contained in:
parent
00e52ae62b
commit
628bc536a0
3 changed files with 45 additions and 14 deletions
|
@ -26,24 +26,50 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Zotero_Preferences.Cite = {
|
Zotero_Preferences.Cite = {
|
||||||
|
wordPluginIDs: new Set([
|
||||||
|
'zoteroOpenOfficeIntegration@zotero.org',
|
||||||
|
'zoteroMacWordIntegration@zotero.org',
|
||||||
|
'zoteroWinWordIntegration@zotero.org'
|
||||||
|
]),
|
||||||
|
|
||||||
init: Zotero.Promise.coroutine(function* () {
|
init: Zotero.Promise.coroutine(function* () {
|
||||||
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
this.updateWordProcessorInstructions();
|
this.updateWordProcessorInstructions();
|
||||||
yield this.refreshStylesList();
|
yield this.refreshStylesList();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if there are word processors, and if not, enables no word processor message
|
* Determines if any word processors are disabled and if so, shows a message in the pref pane
|
||||||
*/
|
*/
|
||||||
updateWordProcessorInstructions: function () {
|
updateWordProcessorInstructions: async function () {
|
||||||
if(document.getElementById("wordProcessors").childNodes.length == 2) {
|
var someDisabled = false;
|
||||||
document.getElementById("wordProcessors-noWordProcessorPluginsInstalled").hidden = undefined;
|
await new Promise(function(resolve) {
|
||||||
}
|
AddonManager.getAllAddons(function(addons) {
|
||||||
if(Zotero.isStandalone) {
|
for (let addon of addons) {
|
||||||
document.getElementById("wordProcessors-getWordProcessorPlugins").hidden = true;
|
if (Zotero_Preferences.Cite.wordPluginIDs.has(addon.id) && addon.userDisabled) {
|
||||||
|
someDisabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (someDisabled) {
|
||||||
|
document.getElementById("wordProcessors-somePluginsDisabled").hidden = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
enableWordPlugins: function () {
|
||||||
|
AddonManager.getAllAddons(function(addons) {
|
||||||
|
for (let addon of addons) {
|
||||||
|
if (Zotero_Preferences.Cite.wordPluginIDs.has(addon.id) && addon.userDisabled) {
|
||||||
|
addon.userDisabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Zotero.Utilities.Internal.quit(true);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the list of styles in the styles pane
|
* Refreshes the list of styles in the styles pane
|
||||||
|
|
|
@ -96,11 +96,17 @@
|
||||||
</groupbox>
|
</groupbox>
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
<tabpanel orient="vertical" id="wordProcessors">
|
<tabpanel orient="vertical" id="wordProcessors">
|
||||||
<label id="wordProcessors-noWordProcessorPluginsInstalled" width="45em" hidden="true">
|
<vbox id="wordProcessors-somePluginsDisabled" hidden="true">
|
||||||
&zotero.preferences.cite.wordProcessors.noWordProcessorPluginsInstalled;
|
<label>
|
||||||
</label>
|
&zotero.preferences.cite.wordProcessors.somePluginsDisabled;
|
||||||
|
</label>
|
||||||
|
<hbox pack="center">
|
||||||
|
<button id="wordProcessors-enablePlugins"
|
||||||
|
label="&zotero.preferences.cite.wordProcessors.enablePlugins;"
|
||||||
|
oncommand="Zotero_Preferences.Cite.enableWordPlugins()"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
<checkbox label="&zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog;" preference="pref-cite-useClassicAddCitationDialog"/>
|
<checkbox label="&zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog;" preference="pref-cite-useClassicAddCitationDialog"/>
|
||||||
<label id="wordProcessors-getWordProcessorPlugins" class="zotero-text-link" href="&zotero.preferences.cite.wordProcessors.getPlugins.url;" value="&zotero.preferences.cite.wordProcessors.getPlugins;"/>
|
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
</tabpanels>
|
</tabpanels>
|
||||||
</tabbox>
|
</tabbox>
|
||||||
|
|
|
@ -121,9 +121,8 @@
|
||||||
<!ENTITY zotero.preferences.prefpane.cite "Cite">
|
<!ENTITY zotero.preferences.prefpane.cite "Cite">
|
||||||
<!ENTITY zotero.preferences.cite.styles "Styles">
|
<!ENTITY zotero.preferences.cite.styles "Styles">
|
||||||
<!ENTITY zotero.preferences.cite.wordProcessors "Word Processors">
|
<!ENTITY zotero.preferences.cite.wordProcessors "Word Processors">
|
||||||
<!ENTITY zotero.preferences.cite.wordProcessors.noWordProcessorPluginsInstalled "No word processor plug-ins are currently installed.">
|
<!ENTITY zotero.preferences.cite.wordProcessors.somePluginsDisabled "Some word processor plugins are disabled.">
|
||||||
<!ENTITY zotero.preferences.cite.wordProcessors.getPlugins "Get word processor plug-ins…">
|
<!ENTITY zotero.preferences.cite.wordProcessors.enablePlugins "Enable Plugins and Restart Zotero">
|
||||||
<!ENTITY zotero.preferences.cite.wordProcessors.getPlugins.url "http://www.zotero.org/support/word_processor_plugin_installation_for_zotero_2.1">
|
|
||||||
<!ENTITY zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog "Use classic Add Citation dialog">
|
<!ENTITY zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog "Use classic Add Citation dialog">
|
||||||
<!ENTITY zotero.preferences.styleEditor "Style Editor">
|
<!ENTITY zotero.preferences.styleEditor "Style Editor">
|
||||||
<!ENTITY zotero.preferences.stylePreview "Style Preview">
|
<!ENTITY zotero.preferences.stylePreview "Style Preview">
|
||||||
|
|
Loading…
Reference in a new issue