From 69b1dc156436e025c17040ef485fa8504dc39951 Mon Sep 17 00:00:00 2001 From: "dtownsend@oxymoronical.com" Date: Fri, 7 Mar 2008 03:10:06 -0800 Subject: [PATCH] Bug 414795: Progress text should read "connecting" rather than "installing". r=robstrong, a=beltzner --- .../chrome/mozapps/extensions/extensions.dtd | 1 + .../mozapps/extensions/content/extensions.css | 7 +++- .../mozapps/extensions/content/extensions.js | 42 +++++++++++-------- .../mozapps/extensions/content/extensions.xml | 4 ++ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd index 65591894a480..6f2c9035f122 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd @@ -138,6 +138,7 @@ + diff --git a/toolkit/mozapps/extensions/content/extensions.css b/toolkit/mozapps/extensions/content/extensions.css index 356849ee1826..78dd16a3f7c9 100644 --- a/toolkit/mozapps/extensions/content/extensions.css +++ b/toolkit/mozapps/extensions/content/extensions.css @@ -205,10 +205,15 @@ richlistitem[action] .addonInstallButton { display: none; } -.searchResultInstalling, .searchResultFailed, .searchResultInstalled { +.searchResultInstalling, .searchResultFailed, +.searchResultInstalled, .searchResultConnecting { display: none; } +richlistitem[action="connecting"] .searchResultConnecting { + display: -moz-box; +} + richlistitem[action="installing"] .searchResultInstalling { display: -moz-box; } diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 8a0b78409fae..8eec99a1066e 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -73,7 +73,7 @@ var gShowGetAddonsPane = false; var gRetrievedResults = false; var gRecommendedAddons = null; var gRDF = null; -var gPendingInstalls = []; +var gPendingInstalls = {}; const PREF_EM_CHECK_COMPATIBILITY = "extensions.checkCompatibility"; const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity"; @@ -1222,11 +1222,17 @@ XPInstallDownloadManager.prototype = { var certName = aParams.GetString(i++); // Check whether the install was triggered from the Get Add-ons pane. - var pos = gPendingInstalls.indexOf(url); - if (pos >= 0) - gPendingInstalls.splice(pos, 1); - else + if (url in gPendingInstalls) { + // Update the installation status + gSearchDS.Assert(gRDF.GetResource(gPendingInstalls[url]), + gRDF.GetResource(PREFIX_NS_EM + "action"), + gRDF.GetLiteral("installing"), + true); + delete gPendingInstalls[url]; + } + else { switchPane = true; + } } gExtensionManager.addDownloads(items, items.length, aManager); @@ -2217,31 +2223,33 @@ function confirmOperation(aName, aTitle, aQueryMsg, aAcceptBtn, aCancelBtn, function installCallback(item, status) { var resultNode = gRDF.GetResource(item.id); + var actionArc = gRDF.GetResource(PREFIX_NS_EM + "action"); // Strip out old status - gSearchDS.Unassert(resultNode, - gRDF.GetResource(PREFIX_NS_EM + "action"), - gRDF.GetLiteral("installing"), - true); + var targets = gSearchDS.GetTargets(resultNode, actionArc, true); + while (targets.hasMoreElements()) { + var value = targets.getNext().QueryInterface(Components.interfaces.nsIRDFNode); + if (value) + gSearchDS.Unassert(resultNode, actionArc, value); + } if (status == -210) { // User cancelled - var pos = gPendingInstalls.indexOf(item.getAttribute("xpiURL")); - if (pos >= 0) - gPendingInstalls.splice(pos, 1); + if (item.getAttribute("xpiURL") in gPendingInstalls) + delete gPendingInstalls[item.getAttribute("xpiURL")]; return; } if (status < 0) { // Some other failure gSearchDS.Assert(resultNode, - gRDF.GetResource(PREFIX_NS_EM + "action"), + actionArc, gRDF.GetLiteral("failed"), true); } else { // Success gSearchDS.Assert(resultNode, - gRDF.GetResource(PREFIX_NS_EM + "action"), + actionArc, gRDF.GetLiteral("installed"), true); } @@ -2385,10 +2393,10 @@ var gExtensionsViewController = { gSearchDS.Assert(gRDF.GetResource(aSelectedItem.id), gRDF.GetResource(PREFIX_NS_EM + "action"), - gRDF.GetLiteral("installing"), + gRDF.GetLiteral("connecting"), true); - // Remember that we don't want to change panes for this install - gPendingInstalls.push(details.URL); + // Remember this install so we can update the status when install starts + gPendingInstalls[details.URL] = aSelectedItem.id; InstallTrigger.install(params, function(url, status) { installCallback(aSelectedItem, status); }); }, diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index 0372abc707b1..6648c39ca219 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -506,6 +506,10 @@ + + + +