зеркало из https://github.com/mozilla/gecko-dev.git
Bug 408116: Move restart button to notification bar. r=robstrong, ui-r=madhava
This commit is contained in:
Родитель
5429017c83
Коммит
5eaba11f6a
|
@ -64,6 +64,7 @@ var gAppID = "";
|
||||||
var gPref = null;
|
var gPref = null;
|
||||||
var gPriorityCount = 0;
|
var gPriorityCount = 0;
|
||||||
var gInstallCount = 0;
|
var gInstallCount = 0;
|
||||||
|
var gPendingActions = false;
|
||||||
var gPlugins = null;
|
var gPlugins = null;
|
||||||
var gPluginsDS = null;
|
var gPluginsDS = null;
|
||||||
|
|
||||||
|
@ -289,7 +290,6 @@ function showView(aView) {
|
||||||
catch (e) { }
|
catch (e) { }
|
||||||
var showCheckUpdatesAll = true;
|
var showCheckUpdatesAll = true;
|
||||||
var showInstallUpdatesAll = false;
|
var showInstallUpdatesAll = false;
|
||||||
var showRestartApp = true;
|
|
||||||
var showSkip = false;
|
var showSkip = false;
|
||||||
var showContinue = false;
|
var showContinue = false;
|
||||||
switch (aView) {
|
switch (aView) {
|
||||||
|
@ -313,10 +313,8 @@ function showView(aView) {
|
||||||
showInstallFile = false;
|
showInstallFile = false;
|
||||||
showCheckUpdatesAll = false;
|
showCheckUpdatesAll = false;
|
||||||
showInstallUpdatesAll = true;
|
showInstallUpdatesAll = true;
|
||||||
if (gUpdatesOnly) {
|
if (gUpdatesOnly)
|
||||||
showSkip = true;
|
showSkip = true;
|
||||||
showRestartApp = false;
|
|
||||||
}
|
|
||||||
bindingList = [ ["aboutURL", "?aboutURL"],
|
bindingList = [ ["aboutURL", "?aboutURL"],
|
||||||
["availableUpdateURL", "?availableUpdateURL"],
|
["availableUpdateURL", "?availableUpdateURL"],
|
||||||
["availableUpdateVersion", "?availableUpdateVersion"],
|
["availableUpdateVersion", "?availableUpdateVersion"],
|
||||||
|
@ -343,10 +341,8 @@ function showView(aView) {
|
||||||
showInstallFile = false;
|
showInstallFile = false;
|
||||||
showCheckUpdatesAll = false;
|
showCheckUpdatesAll = false;
|
||||||
showInstallUpdatesAll = false;
|
showInstallUpdatesAll = false;
|
||||||
if (gUpdatesOnly) {
|
if (gUpdatesOnly)
|
||||||
showContinue = true;
|
showContinue = true;
|
||||||
showRestartApp = false;
|
|
||||||
}
|
|
||||||
bindingList = [ ["aboutURL", "?aboutURL"],
|
bindingList = [ ["aboutURL", "?aboutURL"],
|
||||||
["addonID", "?addonID"],
|
["addonID", "?addonID"],
|
||||||
["availableUpdateURL", "?availableUpdateURL"],
|
["availableUpdateURL", "?availableUpdateURL"],
|
||||||
|
@ -407,7 +403,6 @@ function showView(aView) {
|
||||||
document.getElementById("installFileButton").hidden = !showInstallFile;
|
document.getElementById("installFileButton").hidden = !showInstallFile;
|
||||||
document.getElementById("checkUpdatesAllButton").hidden = !showCheckUpdatesAll;
|
document.getElementById("checkUpdatesAllButton").hidden = !showCheckUpdatesAll;
|
||||||
document.getElementById("installUpdatesAllButton").hidden = !showInstallUpdatesAll;
|
document.getElementById("installUpdatesAllButton").hidden = !showInstallUpdatesAll;
|
||||||
document.getElementById("restartAppButton").hidden = !showRestartApp;
|
|
||||||
document.getElementById("skipDialogButton").hidden = !showSkip;
|
document.getElementById("skipDialogButton").hidden = !showSkip;
|
||||||
document.getElementById("continueDialogButton").hidden = !showContinue;
|
document.getElementById("continueDialogButton").hidden = !showContinue;
|
||||||
document.getElementById("themePreviewArea").hidden = !isThemes;
|
document.getElementById("themePreviewArea").hidden = !isThemes;
|
||||||
|
@ -932,8 +927,10 @@ XPInstallDownloadManager.prototype = {
|
||||||
setElementDisabledByID("cmd_continue", false);
|
setElementDisabledByID("cmd_continue", false);
|
||||||
document.getElementById("continueDialogButton").focus();
|
document.getElementById("continueDialogButton").focus();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
updateOptionalViews();
|
||||||
updateGlobalCommands();
|
updateGlobalCommands();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1037,6 +1034,7 @@ UpdateCheckListener.prototype = {
|
||||||
viewGroup.hidden = false;
|
viewGroup.hidden = false;
|
||||||
gExtensionsView.removeAttribute("update-operation");
|
gExtensionsView.removeAttribute("update-operation");
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
|
updateOptionalViews();
|
||||||
updateGlobalCommands();
|
updateGlobalCommands();
|
||||||
if (this._updateFound)
|
if (this._updateFound)
|
||||||
showView("updates");
|
showView("updates");
|
||||||
|
@ -1557,6 +1555,9 @@ const gAddonsMsgObserver = {
|
||||||
break;
|
break;
|
||||||
case "addons-message-dismiss":
|
case "addons-message-dismiss":
|
||||||
break;
|
break;
|
||||||
|
case "addons-restart-app":
|
||||||
|
restartApp();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (gExtensionsView.selectedItem)
|
if (gExtensionsView.selectedItem)
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
|
@ -1618,6 +1619,28 @@ function canWriteToLocation(element)
|
||||||
return installLocation ? installLocation.canAccess : false;
|
return installLocation ? installLocation.canAccess : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enableRestartButton() {
|
||||||
|
var addonsMsg = document.getElementById("addonsMsg");
|
||||||
|
var notification = addonsMsg.getNotificationWithValue("restart-app");
|
||||||
|
if (!notification) {
|
||||||
|
var appname = getBrandShortName();
|
||||||
|
var message = getExtensionString("restartMessage", [appname]);
|
||||||
|
var buttons = [ new MessageButton(getExtensionString("restartButton", [appname]),
|
||||||
|
getExtensionString("restartAccessKey"),
|
||||||
|
"addons-restart-app") ];
|
||||||
|
addonsMsg.appendNotification(message, "restart-app",
|
||||||
|
"chrome://mozapps/skin/extensions/question.png",
|
||||||
|
addonsMsg.PRIORITY_WARNING_HIGH, buttons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableRestartButton() {
|
||||||
|
var addonsMsg = document.getElementById("addonsMsg");
|
||||||
|
var notification = addonsMsg.getNotificationWithValue("restart-app");
|
||||||
|
if (notification)
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
|
||||||
function updateOptionalViews() {
|
function updateOptionalViews() {
|
||||||
var ds = gExtensionsView.database;
|
var ds = gExtensionsView.database;
|
||||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||||
|
@ -1630,6 +1653,11 @@ function updateOptionalViews() {
|
||||||
var showUpdates = false;
|
var showUpdates = false;
|
||||||
var showInstalls = false;
|
var showInstalls = false;
|
||||||
gInstallCount = 0;
|
gInstallCount = 0;
|
||||||
|
gPendingActions = false;
|
||||||
|
|
||||||
|
var stateArc = rdfs.GetResource(PREFIX_NS_EM + "state");
|
||||||
|
var opTypeArc = rdfs.GetResource(PREFIX_NS_EM + "opType");
|
||||||
|
|
||||||
while (elements.hasMoreElements()) {
|
while (elements.hasMoreElements()) {
|
||||||
var e = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
var e = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||||
if (!showLocales) {
|
if (!showLocales) {
|
||||||
|
@ -1641,7 +1669,6 @@ function updateOptionalViews() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var stateArc = rdfs.GetResource(PREFIX_NS_EM + "state");
|
|
||||||
var state = ds.GetTarget(e, stateArc, true);
|
var state = ds.GetTarget(e, stateArc, true);
|
||||||
if (state) {
|
if (state) {
|
||||||
showInstalls = true;
|
showInstalls = true;
|
||||||
|
@ -1650,6 +1677,15 @@ function updateOptionalViews() {
|
||||||
gInstallCount++;
|
gInstallCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gPendingActions) {
|
||||||
|
var opType = ds.GetTarget(e, opTypeArc, true);
|
||||||
|
if (opType) {
|
||||||
|
if (opType instanceof Components.interfaces.nsIRDFLiteral &&
|
||||||
|
opType.Value != OP_NONE)
|
||||||
|
gPendingActions = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!showUpdates) {
|
if (!showUpdates) {
|
||||||
var updateURLArc = rdfs.GetResource(PREFIX_NS_EM + "availableUpdateURL");
|
var updateURLArc = rdfs.GetResource(PREFIX_NS_EM + "availableUpdateURL");
|
||||||
var updateURL = ds.GetTarget(e, updateURLArc, true);
|
var updateURL = ds.GetTarget(e, updateURLArc, true);
|
||||||
|
@ -1671,14 +1707,14 @@ function updateGlobalCommands() {
|
||||||
var disableInstallFile = false;
|
var disableInstallFile = false;
|
||||||
var disableUpdateCheck = true;
|
var disableUpdateCheck = true;
|
||||||
var disableInstallUpdate = true;
|
var disableInstallUpdate = true;
|
||||||
var disableAppRestart = (gInstallCount > 0);
|
|
||||||
if (gExtensionsView.hasAttribute("update-operation")) {
|
if (gExtensionsView.hasAttribute("update-operation")) {
|
||||||
disableInstallFile = true;
|
disableInstallFile = true;
|
||||||
disableAppRestart = true;
|
disableRestartButton();
|
||||||
}
|
}
|
||||||
else if (gView == "updates") {
|
else if (gView == "updates") {
|
||||||
disableInstallUpdate = false;
|
disableInstallUpdate = false;
|
||||||
disableAppRestart = true;
|
disableRestartButton();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var children = gExtensionsView.children;
|
var children = gExtensionsView.children;
|
||||||
|
@ -1688,10 +1724,16 @@ function updateGlobalCommands() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gInstallCount == 0 &&
|
||||||
|
(gPendingActions || gPref.getBoolPref(PREF_EXTENSIONS_DSS_SWITCHPENDING)))
|
||||||
|
enableRestartButton();
|
||||||
|
else
|
||||||
|
disableRestartButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
setElementDisabledByID("cmd_checkUpdatesAll", disableUpdateCheck);
|
setElementDisabledByID("cmd_checkUpdatesAll", disableUpdateCheck);
|
||||||
setElementDisabledByID("cmd_installUpdatesAll", disableInstallUpdate);
|
setElementDisabledByID("cmd_installUpdatesAll", disableInstallUpdate);
|
||||||
setElementDisabledByID("cmd_restartApp", disableAppRestart);
|
|
||||||
setElementDisabledByID("cmd_installFile", disableInstallFile);
|
setElementDisabledByID("cmd_installFile", disableInstallFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2073,19 +2115,19 @@ var gExtensionsViewController = {
|
||||||
}
|
}
|
||||||
gExtensionManager.uninstallItem(getIDFromResourceURI(aSelectedItem.id));
|
gExtensionManager.uninstallItem(getIDFromResourceURI(aSelectedItem.id));
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
updateGlobalCommands();
|
|
||||||
if (gExtensionsView.selectedItem)
|
if (gExtensionsView.selectedItem)
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
updateOptionalViews();
|
updateOptionalViews();
|
||||||
|
updateGlobalCommands();
|
||||||
},
|
},
|
||||||
|
|
||||||
cmd_cancelUninstall: function (aSelectedItem)
|
cmd_cancelUninstall: function (aSelectedItem)
|
||||||
{
|
{
|
||||||
gExtensionManager.cancelUninstallItem(getIDFromResourceURI(aSelectedItem.id));
|
gExtensionManager.cancelUninstallItem(getIDFromResourceURI(aSelectedItem.id));
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
updateGlobalCommands();
|
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
updateOptionalViews();
|
updateOptionalViews();
|
||||||
|
updateGlobalCommands();
|
||||||
},
|
},
|
||||||
|
|
||||||
cmd_cancelInstall: function (aSelectedItem)
|
cmd_cancelInstall: function (aSelectedItem)
|
||||||
|
@ -2111,9 +2153,9 @@ var gExtensionsViewController = {
|
||||||
|
|
||||||
gExtensionManager.cancelInstallItem(getIDFromResourceURI(aSelectedItem.id));
|
gExtensionManager.cancelInstallItem(getIDFromResourceURI(aSelectedItem.id));
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
updateGlobalCommands();
|
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
updateOptionalViews();
|
updateOptionalViews();
|
||||||
|
updateGlobalCommands();
|
||||||
},
|
},
|
||||||
|
|
||||||
cmd_cancelUpgrade: function (aSelectedItem)
|
cmd_cancelUpgrade: function (aSelectedItem)
|
||||||
|
@ -2145,6 +2187,7 @@ var gExtensionsViewController = {
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
updateOptionalViews();
|
updateOptionalViews();
|
||||||
|
updateGlobalCommands();
|
||||||
},
|
},
|
||||||
|
|
||||||
cmd_enable: function (aSelectedItem)
|
cmd_enable: function (aSelectedItem)
|
||||||
|
@ -2160,6 +2203,7 @@ var gExtensionsViewController = {
|
||||||
gExtensionsViewController.onCommandUpdate();
|
gExtensionsViewController.onCommandUpdate();
|
||||||
gExtensionsView.selectedItem.focus();
|
gExtensionsView.selectedItem.focus();
|
||||||
updateOptionalViews();
|
updateOptionalViews();
|
||||||
|
updateGlobalCommands();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -110,7 +110,6 @@
|
||||||
<command id="cmd_installFile" oncommand="installWithFilePicker();"/>
|
<command id="cmd_installFile" oncommand="installWithFilePicker();"/>
|
||||||
<command id="cmd_checkUpdatesAll" oncommand="checkUpdatesAll();"/>
|
<command id="cmd_checkUpdatesAll" oncommand="checkUpdatesAll();"/>
|
||||||
<command id="cmd_installUpdatesAll" oncommand="installUpdatesAll();"/>
|
<command id="cmd_installUpdatesAll" oncommand="installUpdatesAll();"/>
|
||||||
<command id="cmd_restartApp" oncommand="restartApp();"/>
|
|
||||||
<command id="cmd_continue" oncommand="closeEM();" disabled="true"/>
|
<command id="cmd_continue" oncommand="closeEM();" disabled="true"/>
|
||||||
<command id="cmd_close" oncommand="closeEM();"/>
|
<command id="cmd_close" oncommand="closeEM();"/>
|
||||||
<command id="cmd_showUpdateInfo" oncommand="showUpdateInfo();"/>
|
<command id="cmd_showUpdateInfo" oncommand="showUpdateInfo();"/>
|
||||||
|
@ -246,11 +245,6 @@
|
||||||
valuethemes="&getThemes.label;"
|
valuethemes="&getThemes.label;"
|
||||||
valueplugins="&getPlugins.label;"
|
valueplugins="&getPlugins.label;"
|
||||||
valueextensions="&getExtensions.label;"/>
|
valueextensions="&getExtensions.label;"/>
|
||||||
<spacer flex="1"/>
|
|
||||||
<button id="restartAppButton" label="&cmd.restartApp2.label;"
|
|
||||||
accesskey="&cmd.restartApp2.accesskey;"
|
|
||||||
tooltiptext="&cmd.restartApp2.tooltip;"
|
|
||||||
command="cmd_restartApp"/>
|
|
||||||
<button id="continueDialogButton" label="&cmd.continue.label;"
|
<button id="continueDialogButton" label="&cmd.continue.label;"
|
||||||
accesskey="&cmd.continue.accesskey;"
|
accesskey="&cmd.continue.accesskey;"
|
||||||
tooltiptext="&cmd.continue.tooltip;"
|
tooltiptext="&cmd.continue.tooltip;"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче