Update word plugin status after installation. Closes #1200
This commit is contained in:
parent
2d93b07220
commit
8bc5d37dd1
1 changed files with 22 additions and 2 deletions
|
@ -60,6 +60,8 @@ var ZoteroPluginInstaller = function(addon, failSilently, force) {
|
||||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"].
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"].
|
||||||
getService(Components.interfaces.nsIPrefService);
|
getService(Components.interfaces.nsIPrefService);
|
||||||
this.prefBranch = prefService.getBranch(this._addon.EXTENSION_PREF_BRANCH);
|
this.prefBranch = prefService.getBranch(this._addon.EXTENSION_PREF_BRANCH);
|
||||||
|
|
||||||
|
this.prefPaneDoc = null;
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
var extensionIDs = [this._addon.EXTENSION_ID].concat(this._addon.REQUIRED_ADDONS.map(req => req.id));
|
var extensionIDs = [this._addon.EXTENSION_ID].concat(this._addon.REQUIRED_ADDONS.map(req => req.id));
|
||||||
|
@ -145,7 +147,7 @@ ZoteroPluginInstaller.prototype = {
|
||||||
installationInProgress = false;
|
installationInProgress = false;
|
||||||
this.closeProgressWindow();
|
this.closeProgressWindow();
|
||||||
this.prefBranch.setCharPref("version", this._version);
|
this.prefBranch.setCharPref("version", this._version);
|
||||||
this.prefBranch.setBoolPref("installed", true);
|
this.updateInstallStatus(true);
|
||||||
this.prefBranch.setBoolPref("skipInstallation", false);
|
this.prefBranch.setBoolPref("skipInstallation", false);
|
||||||
if(this.force && !this._addon.DISABLE_PROGRESS_WINDOW) {
|
if(this.force && !this._addon.DISABLE_PROGRESS_WINDOW) {
|
||||||
var addon = this._addon;
|
var addon = this._addon;
|
||||||
|
@ -163,7 +165,7 @@ ZoteroPluginInstaller.prototype = {
|
||||||
this.closeProgressWindow();
|
this.closeProgressWindow();
|
||||||
if(!notFailure) {
|
if(!notFailure) {
|
||||||
this.prefBranch.setCharPref("version", this._version);
|
this.prefBranch.setCharPref("version", this._version);
|
||||||
this.prefBranch.setBoolPref("installed", false);
|
this.updateInstallStatus(false);
|
||||||
}
|
}
|
||||||
if(this.failSilently) return;
|
if(this.failSilently) return;
|
||||||
if(this._errorDisplayed) return;
|
if(this._errorDisplayed) return;
|
||||||
|
@ -184,6 +186,7 @@ ZoteroPluginInstaller.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
showPreferences: function(document) {
|
showPreferences: function(document) {
|
||||||
|
this.prefPaneDoc = document;
|
||||||
var isInstalled = this.isInstalled(),
|
var isInstalled = this.isInstalled(),
|
||||||
groupbox = document.createElement("groupbox");
|
groupbox = document.createElement("groupbox");
|
||||||
groupbox.id = this._addon.EXTENSION_DIR;
|
groupbox.id = this._addon.EXTENSION_DIR;
|
||||||
|
@ -224,6 +227,23 @@ ZoteroPluginInstaller.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateInstallStatus: function(status) {
|
||||||
|
this.prefBranch.setBoolPref("installed", status);
|
||||||
|
if (! this.prefPaneDoc) return;
|
||||||
|
var isInstalled = this.isInstalled();
|
||||||
|
var description = this.prefPaneDoc.querySelector(`#${this._addon.EXTENSION_DIR} description`);
|
||||||
|
description.replaceChild(this.prefPaneDoc.createTextNode(
|
||||||
|
isInstalled ?
|
||||||
|
Zotero.getString('zotero.preferences.wordProcessors.installed', this._addon.APP) :
|
||||||
|
Zotero.getString('zotero.preferences.wordProcessors.notInstalled', this._addon.APP)
|
||||||
|
), description.childNodes[0]);
|
||||||
|
var button = this.prefPaneDoc.querySelector(`#${this._addon.EXTENSION_DIR} button`);
|
||||||
|
button.setAttribute("label",
|
||||||
|
(isInstalled ?
|
||||||
|
Zotero.getString('zotero.preferences.wordProcessors.reinstall', this._addon.APP) :
|
||||||
|
Zotero.getString('zotero.preferences.wordProcessors.install', this._addon.APP)));
|
||||||
|
},
|
||||||
|
|
||||||
_firstRunListener: function() {
|
_firstRunListener: function() {
|
||||||
this._progressWindowLabel = this._progressWindow.document.getElementById("progress-label");
|
this._progressWindowLabel = this._progressWindow.document.getElementById("progress-label");
|
||||||
this._progressWindowLabel.value = Zotero.getString('zotero.preferences.wordProcessors.installing', this._addon.EXTENSION_STRING);
|
this._progressWindowLabel.value = Zotero.getString('zotero.preferences.wordProcessors.installing', this._addon.EXTENSION_STRING);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue