214360 - make app update entries look a bit nicer

This commit is contained in:
ben%bengoodger.com 2004-04-25 10:36:41 +00:00
parent 9070803570
commit ee40f4cf9b
6 changed files with 104 additions and 50 deletions

View File

@ -95,26 +95,29 @@ var gUpdateWizard = {
}
},
_setUpButton: function (aButtonID, aButtonKey, aDisabled)
{
var strings = document.getElementById("updateStrings");
var button = document.documentElement.getButton(aButtonID);
if (aButtonKey) {
button.label = strings.getString(aButtonKey);
try {
button.accesskey = strings.getString(aButtonKey + "Accesskey");
}
catch (e) {
}
}
button.disabled = aDisabled;
},
setButtonLabels: function (aBackButton, aBackButtonIsDisabled,
aNextButton, aNextButtonIsDisabled,
aCancelButton, aCancelButtonIsDisabled)
{
var strings = document.getElementById("updateStrings");
var back = document.documentElement.getButton("back");
if (aBackButton)
back.label = strings.getString(aBackButton);
back.disabled = aBackButtonIsDisabled;
var next = document.documentElement.getButton("next");
if (aNextButton)
next.label = strings.getString(aNextButton);
next.disabled = aNextButtonIsDisabled;
var cancel = document.documentElement.getButton("cancel");
if (aCancelButton)
cancel.label = strings.getString(aCancelButton);
cancel.disabled = aCancelButtonIsDisabled;
this._setUpButton("back", aBackButton, aBackButtonIsDisabled);
this._setUpButton("next", aNextButton, aNextButtonIsDisabled);
this._setUpButton("cancel", aCancelButton, aCancelButtonIsDisabled);
}
};
@ -227,7 +230,7 @@ var gUpdatePage = {
item.init(appID, updates.appUpdateVersion,
brandShortName, -1, updates.appUpdateURL,
"chrome://mozapps/skin/update/icon32.png",
Components.interfaces.nsIUpdateItem.TYPE_APP);
nsIUpdateItem.TYPE_APP);
gUpdateWizard.itemsToUpdate.splice(0, 0, item);
}
break;
@ -242,6 +245,10 @@ var gUpdatePage = {
};
var gFoundPage = {
_appUpdateExists: false,
_appSelected: false,
_appItem: null,
_nonAppItems: [],
onPageShow: function ()
{
gUpdateWizard.setButtonLabels(null, true,
@ -257,10 +264,51 @@ var gFoundPage = {
var item = gUpdateWizard.itemsToUpdate[i];
updateitem.name = item.name + " " + item.version;
updateitem.url = item.updateURL;
updateitem.checked = true;
// If we have an App entry in the list, check it and uncheck
// the others since the two are mutually exclusive installs.
updateitem.type = item.type;
if (item.type == nsIUpdateItem.TYPE_APP) {
updateitem.checked = true;
this._appUpdateExists = true;
this._appSelected = true;
this._appItem = updateitem;
}
else {
updateitem.checked = !this._appUpdateExists;
this._nonAppItems.push(updateitem);
}
if (item.iconURL != "")
updateitem.icon = item.iconURL;
}
},
onCommand: function (aEvent)
{
var i;
if (this._appUpdateExists) {
if (aEvent.target.type == nsIUpdateItem.TYPE_APP) {
for (i = 0; i < this._nonAppItems.length; ++i) {
var nonAppItem = this._nonAppItems[i];
nonAppItem.checked = !aEvent.target.checked;
}
}
else {
this._appItem.checked = false;
}
}
var next = document.documentElement.getButton("next");
next.disabled = true;
var foundList = document.getElementById("foundList");
for (i = 0; i < foundList.childNodes.length; ++i) {
var listitem = foundList.childNodes[i];
if (listitem.checked) {
next.disabled = false;
break;
}
}
}
};
@ -307,7 +355,7 @@ var gFinishedPage = {
fEC.hidden = true;
}
if (gUpdater.updateType == nsIUpdateService.SOURCE_EVENT_MISMATCH) {
if (gSourceEvent == nsIUpdateService.SOURCE_EVENT_MISMATCH) {
document.getElementById("finishedMismatch").hidden = false;
document.getElementById("incompatibleAlert").hidden = false;
}

View File

@ -106,7 +106,8 @@
<label>&found.intro.label;</label>
<vbox id="foundList" flex="1" style="height: 16em; overflow: auto;"/>
<vbox id="foundList" flex="1" style="height: 16em; overflow: auto;"
oncommand="gFoundPage.onCommand(event);"/>
<label>&found.instructions.label;</label>

View File

@ -17,15 +17,6 @@
<xul:image xbl:inherits="severity" class="updateIcon"/>
<xul:label xbl:inherits="value=updateCount" flex="1" crop="right"/>
</xul:hbox>
<xul:popupset>
<xul:popup anonid="infoPopup" class="infoPopup">
<xul:hbox>
<xul:label flex="1" crop="right" class="infoPopupTitle">&updatesAvailable.title;</xul:label>
<xul:button class="popupCloseBox"/>
</xul:hbox>
<xul:description anonid="infoPopupDetails"/>
</xul:popup>
</xul:popupset>
</content>
<implementation implements="nsIObserver, nsIAlertListener">
<constructor>
@ -134,17 +125,20 @@
<content>
<xul:hbox flex="1">
<xul:stack>
<xul:vbox align="center" pack="center">
<xul:vbox align="center">
<xul:image class="updateItemIcon" xbl:inherits="src=icon"/>
</xul:vbox>
<xul:vbox align="right" pack="end">
<xul:checkbox class="updateItemChecked" xbl:inherits="checked"/>
<xul:vbox align="right">
<xul:checkbox class="updateItemChecked" anonid="updateItemChecked" xbl:inherits="checked"/>
</xul:vbox>
</xul:stack>
<xul:vbox flex="1">
<xul:hbox class="updateItemNameRow" align="center">
<xul:label class="updateItemName" xbl:inherits="value=name" flex="1" crop="right"/>
</xul:hbox>
<xul:hbox class="updateItemInfoRow" anonid="updateItemInfoRow" align="center" hidden="true">
<xul:label class="updateItemInfo" anonid="updateItemText" flex="1" crop="right">&appInfo.label;</xul:label>
</xul:hbox>
<xul:hbox class="updateItemDetailsRow" align="center">
<xul:label class="updateItemFromLabel">&from.label;</xul:label>
<xul:textbox class="updateItemURL" xbl:inherits="value=url" flex="1" readonly="true" crop="right"/>
@ -159,8 +153,30 @@
onget="return this.getAttribute('url');"/>
<property name="icon" onset="this.setAttribute('icon', val); return val;"
onget="return this.getAttribute('icon');"/>
<property name="checked" onset="this.setAttribute('checked', val); return val;"
onget="return this.getAttribute('checked');"/>
<property name="type" onget="return parseInt(this.getAttribute('type'));">
<setter>
<![CDATA[
this.setAttribute("type", val);
if (val == Components.interfaces.nsIUpdateItem.TYPE_APP) {
var infoRow = document.getAnonymousElementByAttribute(this, "anonid", "updateItemInfoRow");
infoRow.removeAttribute("hidden");
}
return val;
]]>
</setter>
</property>
<property name="checked">
<setter>
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
checkbox.checked = val;
return val;
</setter>
<getter>
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
return checkbox.checked;
</getter>
</property>
</implementation>
</binding>

View File

@ -48,5 +48,4 @@
<!ENTITY finished.enableChecking.label "Allow &brandShortName; to check for updates.">
<!ENTITY finished.mismatch.label "Click Finish to continue starting &brandShortName;.">
<!ENTITY updatesAvailable.title "Updates Are Available">
<!ENTITY appInfo.label "This update must be installed separately from any others.">

View File

@ -1,9 +1,12 @@
mismatchCheckNow=Check Now
mismatchCheckNowAccesskey=C
mismatchDontCheck=Don't Check
mismatchDontCheckAccesskey=D
installButtonText=Install Now
installButtonTextAccesskey=I
nextButtonText=Next >
cancelButtonText=Cancel
update.app.url=http://localhost/update.rdf
updatesAvailableTitle=New Updates Available
updatesAvailableText=Click Here to View
updatesAvailableText=Click Here to View

View File

@ -46,7 +46,7 @@ updateitem {
}
.updateItemChecked {
margin: 0px 0px 3px 0px;
margin: 20px 0px 3px 0px;
padding: 0px;
}
@ -77,16 +77,3 @@ updateitem {
.updateIcon[severity="2"] {
background-color: #FF0000;
}
.infoPopup {
border: 1px solid ThreeDDarkShadow;
background-color: InfoBackground;
width: 200px;
height: 85px;
padding: 5px;
}
.infoPopupTitle {
font-weight: bold;
}