170006 - more work on mismatch/update checking wizard UI

This commit is contained in:
ben%bengoodger.com 2004-04-23 07:00:57 +00:00
Родитель dbc8d9bf51
Коммит 6d33fec1ab
15 изменённых файлов: 222 добавлений и 215 удалений

Просмотреть файл

@ -378,7 +378,8 @@ var gExtensionsViewController = {
.createInstance(Components.interfaces.nsIExtensionItem);
item.init(aItemID, this.getExtensionProperty(aItemID, "version"),
this.getExtensionProperty(aItemID, "name"),
-1, "", Components.interfaces.nsIExtensionItem.TYPE_EXTENSION); // XXXben
-1, "", "",
Components.interfaces.nsIExtensionItem.TYPE_EXTENSION); // XXXben
items.push(item);
}
else {
@ -394,7 +395,8 @@ var gExtensionsViewController = {
.createInstance(Components.interfaces.nsIExtensionItem);
item.init(id, this.getExtensionProperty(id, "version"),
this.getExtensionProperty(id, "name"),
-1, "", Components.interfaces.nsIExtensionItem.TYPE_EXTENSION); // XXXben
-1, "", "",
Components.interfaces.nsIExtensionItem.TYPE_EXTENSION); // XXXben
items.push(item);
}
}

Просмотреть файл

@ -60,7 +60,7 @@ interface nsIExtensionItem : nsISupports
void init(in string aID, in string aVersion, in wstring aName,
in long aRow, in wstring aXPIURL, in long aType);
nsIVariant toObject();
readonly attribute wstring objectSource;
};
[scriptable, uuid(c3515b0f-99f4-453b-805e-1fdf5724d6d9)]
@ -88,3 +88,9 @@ interface nsIExtensionManager : nsISupports
readonly attribute nsIRDFDataSource datasource;
};
[scriptable, uuid(c0b7517f-0b3a-41a2-bde8-ba3ac8a5af47)]
interface nsIExtensionItemUpdater : nsISupports
{
void checkForUpdates();
};

Просмотреть файл

@ -1,90 +0,0 @@
package org.mozilla.update.extensions;
public class ExtensionItem
{
private int row;
private java.lang.String id;
private java.lang.String version;
private java.lang.String name;
private java.lang.String xpiURL;
private int type;
public ExtensionItem()
{
}
public int getRow()
{
return row;
}
public void setRow(int row)
{
this.row = row;
}
public java.lang.String getId()
{
return id;
}
public void setId(java.lang.String id)
{
this.id = id;
}
public java.lang.String getVersion()
{
return version;
}
public void setVersion(java.lang.String version)
{
this.version = version;
}
public java.lang.String getName()
{
return name;
}
public void setName(java.lang.String name)
{
this.name = name;
}
public java.lang.String getXpiURL()
{
return xpiURL;
}
public void setXpiURL(java.lang.String xpiURL)
{
this.xpiURL = xpiURL;
}
public int getType()
{
return type;
}
public void setType(int type)
{
this.type = type;
}
}
//public class ExtensionType
//{
// public ExtensionType()
// {
// }
//
// public int row;
// public String id;
// public String version;
// public String name;
// public String xpiURL;
// public int type;
//}

Просмотреть файл

@ -70,6 +70,7 @@ public class VersionCheck
e.setName(getProperty(row, "name"));
e.setVersion(getProperty(row, "version"));
e.setXpiURL(getProperty(row, "xpiurl"));
e.setIconURL(getProperty(row, "iconurl"));
results.add(e);
}
}
@ -94,6 +95,7 @@ public class VersionCheck
e.setName(getProperty(row, "name"));
e.setVersion(getProperty(row, "version"));
e.setXpiURL(getProperty(row, "xpiurl"));
e.setIconURL(getProperty(row, "iconurl"));
}
return e;
}

Просмотреть файл

@ -49,13 +49,14 @@ function ExtensionItem ()
}
ExtensionItem.prototype = {
init: function (aID, aVersion, aName, aRow, aXPIURL, aType)
init: function (aID, aVersion, aName, aRow, aXPIURL, aIconURL, aType)
{
this._id = aID;
this._version = aVersion;
this._name = aName;
this._row = aRow;
this._xpiURL = aXPIURL;
this._iconURL = aIconURL;
this._type = aType;
},
@ -64,12 +65,14 @@ ExtensionItem.prototype = {
get name() { return this._name; },
get row() { return this._row; },
get xpiURL() { return this._xpiURL; },
get iconURL() { return this._iconURL },
get type() { return this._type; },
toObject: function ()
get objectSource()
{
return { id: this._id, version: this._version, name: this._name,
row: this._row, xpiURL: this._xpiURL, type: this._type };
row: this._row, xpiURL: this._xpiURL, iconURL: this._iconURL,
type: this._type }.toSource();
},
/////////////////////////////////////////////////////////////////////////////
@ -251,7 +254,7 @@ nsExtensionManager.prototype = {
var appID = pref.getCharPref(PREF_EM_APP_ID);
var appVersion = pref.getCharPref(PREF_EM_APP_VERSION);
var updater = new nsItemUpdater(aItems, appID, appVersion);
var updater = new nsExtensionItemUpdater(aItems, appID, appVersion);
switch (aUpdateType) {
case Components.interfaces.nsIExtensionManager.UPDATE_TYPE_MISMATCH:
@ -318,7 +321,7 @@ nsExtensionManager.prototype = {
}
};
function nsItemUpdater(aItems, aTargetAppID, aTargetAppVersion)
function nsExtensionItemUpdater(aItems, aTargetAppID, aTargetAppVersion)
{
this._items = aItems;
this._count = aItems.length;
@ -329,9 +332,9 @@ function nsItemUpdater(aItems, aTargetAppID, aTargetAppVersion)
.getService(Components.interfaces.nsIObserverService);
}
nsItemUpdater.prototype = {
nsExtensionItemUpdater.prototype = {
/////////////////////////////////////////////////////////////////////////////
//
// nsIExtensionItemUpdater
checkForUpdates: function ()
{
this._os.notifyObservers(null, "update-started", "");
@ -341,6 +344,8 @@ nsItemUpdater.prototype = {
"VersionCheck", "", true, this);
},
/////////////////////////////////////////////////////////////////////////////
// nsExtensionItemUpdater
_proxy: null,
_checkForUpdates: function ()
@ -348,7 +353,8 @@ nsItemUpdater.prototype = {
for (var i = 0; i < this._items.length; ++i) {
var e = this._items[i];
this._os.notifyObservers(null, "update-item-started", e.name + " " + e.version);
this._proxy.getNewestExtension(e, this._appID, this._appVersion);
dump("*** obj = " + e.objectSource + "\n"); // goats
this._proxy.getNewestExtension(eval(e.objectSource), this._appID, this._appVersion);
}
},
@ -381,7 +387,17 @@ nsItemUpdater.prototype = {
if (--this._count == 0)
this._os.notifyObservers(null, "update-ended", "");
}
},
/////////////////////////////////////////////////////////////////////////////
// nsISupports
QueryInterface: function (aIID)
{
if (!aIID.equals(Components.interfaces.nsIExtensionItemUpdater) &&
!aIID.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
};
@ -432,7 +448,8 @@ nsExtensionsDataSource.prototype = {
.createInstance(Components.interfaces.nsIExtensionItem);
item.init(id, this.getExtensionProperty(id, "version"),
this.getExtensionProperty(id, "name"),
-1, "", Components.interfaces.nsIExtensionItem.TYPE_EXTENSION);
-1, "", "",
Components.interfaces.nsIExtensionItem.TYPE_EXTENSION);
items.push(item);
}
}

Просмотреть файл

@ -21,6 +21,8 @@ toolkit.jar:
* content/mozapps/extensions/about.js (extensions/content/about.js)
* content/mozapps/update/update.xul (update/content/update.xul)
* content/mozapps/update/update.js (update/content/update.js)
* content/mozapps/update/updateItem.xml (update/content/updateItem.xml)
* content/mozapps/update/update.css (update/content/update.css)
* content/mozapps/shared/richview.xml (shared/content/richview.xml)
content/mozapps/contents.rdf (contents-content.rdf)
@ -36,6 +38,7 @@ en-US.jar:
locale/en-US/mozapps/extensions/extensions.properties (extensions/locale/extensions.properties)
locale/en-US/mozapps/extensions/about.dtd (extensions/locale/about.dtd)
locale/en-US/mozapps/update/update.dtd (update/locale/update.dtd)
locale/en-US/mozapps/update/update.properties (update/locale/update.properties)
locale/en-US/mozapps/contents.rdf (contents-locale.rdf)
classic.jar:
@ -43,6 +46,7 @@ classic.jar:
skin/classic/mozapps/extensions/about.css (extensions/skin/about.css)
skin/classic/mozapps/extensions/placeholder.gif (extensions/skin/placeholder.gif)
skin/classic/mozapps/extensions/viewWatermark.png (extensions/skin/viewWatermark.png)
skin/classic/mozapps/update/update.css (update/skin/update.css)
skin/classic/mozapps/shared/richview.xml (shared/skin/richview.xml)
skin/classic/mozapps/shared/richview.css (shared/skin/richview.css)
skin/classic/mozapps/shared/viewFader.png (shared/skin/viewFader.png)

Просмотреть файл

@ -0,0 +1,5 @@
updateitem {
-moz-binding: url("chrome://mozapps/content/update/updateItem.xml#updateItem");
display: -moz-box;
}

Просмотреть файл

@ -47,12 +47,13 @@ var gUpdater = null;
var gUpdateWizard = {
_items: [],
_itemsToUpdate: [],
init: function ()
{
gUpdater = window.arguments[0];
for (var i = 1; i < window.argments.length; ++i)
this._items.push(window.arguments[i].QueryInterface(Components.interfaces.nsIExtensionItem));
gUpdater = window.arguments[0].QueryInterface(Components.interfaces.nsIExtensionItemUpdater);
for (var i = 1; i < window.arguments.length; ++i)
this._items.push(window.arguments[i].QueryInterface(nsIExtensionItem));
gMismatchPage.init();
},
@ -76,7 +77,7 @@ var gMismatchPage = {
incompatible.appendChild(listitem);
}
var strings = document.getElementById("extensionsStrings");
var strings = document.getElementById("updateStrings");
var next = document.documentElement.getButton("next");
next.label = strings.getString("mismatchCheckNow");
var cancel = document.documentElement.getButton("cancel");
@ -90,7 +91,7 @@ var gMismatchPage = {
};
var gUpdatePage = {
_itemsToUpdate: [],
_completeCount: 0,
_messages: ["update-started",
"update-ended",
"update-item-started",
@ -99,31 +100,22 @@ var gUpdatePage = {
onPageShow: function ()
{
var strings = document.getElementById("updateStrings");
var next = document.documentElement.getButton("next");
next.label = strings.getString("nextButtonText");
next.disabled = true;
var cancel = document.documentElement.getButton("cancel");
cancel.label = strings.getString("cancelButtonText");
cancel.disabled = true;
var back = document.documentElement.getButton("back");
back.disabled = true;
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
for (var i = 0; i < this._messages.length; ++i)
os.addObserver(this, this._messages[i], false);
var extensions = [];
var themes = [];
for (i = 0; i < gExtensionItems.length; ++i) {
switch (gExtensionItems[i].type) {
case nsIExtensionItem.TYPE_EXTENSION:
extensions.push(gExtensionItems[i]);
break;
case nsIExtensionItem.TYPE_THEME:
themes.push(gExtensionItems[i]);
break;
}
}
var em = Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
if (this._updateType == "extensions")
em.updateExtensions(extensions);
else if (gUpdateType == "themes")
em.updateTheme(this._extensionID);
gUpdater.checkForUpdates();
},
uninit: function ()
@ -142,23 +134,49 @@ var gUpdatePage = {
case "update-item-started":
break;
case "update-item-ended":
this._extensionsToUpdate.push(aSubject);
dump("*** update-item-ended\n");
gUpdateWizard._itemsToUpdate.push(aSubject);
++this._completeCount;
var progress = document.getElementById("checking.progress");
progress.value = Math.ceil(this._completeCount / gUpdateWizard._itemsToUpdate.length) * 100;
break;
case "update-ended":
var installObj = { };
for (var i = 0; i < this._extensionsToUpdate.length; ++i) {
var e = this._extensionsToUpdate[i];
installObj[e.name + " " + e.version] = e.xpiURL;
}
if (InstallTrigger.updateEnabled())
InstallTrigger.install(installObj);
document.documentElement.acceptDialog();
if (gUpdateWizard._itemsToUpdate.length > 0)
document.getElementById("checking").setAttribute("next", "found");
document.documentElement.advance();
break;
}
}
};
var gFoundPage = {
onPageShow: function ()
{
var strings = document.getElementById("updateStrings");
var next = document.documentElement.getButton("next");
next.label = strings.getString("installButtonText");
next.disabled = false;
var back = document.documentElement.getButton("back");
back.disabled = true;
var list = document.getElementById("foundList");
for (var i = 0; i < gUpdateWizard._itemsToUpdate.length; ++i) {
var updateitem = document.createElement("updateitem");
list.appendChild(updateitem);
var item = gUpdateWizard._itemsToUpdate[i];
updateitem.name = item.name + " " + item.version;
updateitem.url = item.xpiURL;
if (item.iconURL != "")
updateitem.icon = item.iconURL;
}
},
};
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-

Просмотреть файл

@ -37,6 +37,8 @@
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mozapps/content/update/update.css" type="text/css"?>
<?xml-stylesheet href="chrome://mozapps/skin/update/update.css" type="text/css"?>
<!DOCTYPE wizard [
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/update/update.dtd">
@ -57,10 +59,10 @@
<stringbundleset id="updateSet">
<stringbundle id="brandStrings" src="chrome://global/locale/brand.properties"/>
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
<stringbundle id="updateStrings" src="chrome://mozapps/locale/update/update.properties"/>
</stringbundleset>
<wizardpage id="mismatch" pageid="mismatch" next="checkingForUpdates"
<wizardpage id="mismatch" pageid="mismatch" next="checking"
label="&mismatch.title;"
onpageadvanced="gMismatchPage.onPageAdvanced();">
@ -79,29 +81,38 @@
</wizardpage>
<wizardpage id="checkingForUpdates" pageid="checkingForUpdates" next="updatesNotFound"
<wizardpage id="checking" pageid="checking" next="noupdates"
label="&checking.title;"
onpageshow="gUpdatePage.onPageShow();">
<label>&checking.intro.label;</label>
<progressmeter id="progress"/>
<separator/>
<progressmeter id="checking.progress"/>
</wizardpage>
<wizardpage id="updatesNotFound" pageid="updatesNotFound" next="finished"
label="&updatesNotFound.title;"
onpageshow="UpdateWizard.onUpdatesNotFoundPageShow();"
onpageadvanced="UpdateWizard.onUpdatesNotFoundPageAdvanced();">
<wizardpage id="noupdates" pageid="noupdates" next="finished"
label="&noupdates.title;"
onpageshow="gNoUpdatesPage.onPageShow();"
onpageadvanced="gNoUpdatesPage.onPageAdvanced();">
</wizardpage>
<wizardpage id="updatesFound" pageid="updatesFound" next="finished"
label="&updatesFound.title;"
onpageshow="UpdateWizard.onUpdatesFoundPageShow();"
onpageadvanced="UpdateWizard.onUpdatesFoundPageAdvanced();">
<wizardpage id="found" pageid="found" next="installing"
label="&found.title;"
onpageshow="gFoundPage.onPageShow();"
onpageadvanced="gFoundPage.onPageAdvanced();">
<label>&found.intro.label;</label>
<vbox id="foundList" flex="1" style="height: 16em; overflow: auto;"/>
<label>&found.instructions.label;</label>
</wizardpage>
<wizardpage id="installing" pageid="installing"
<wizardpage id="installing" pageid="installing" next="finished"
label="&installing.title;"
onpageshow="UpdateWizard.onFinishedPageShow();"
onpageadvanced="UpdateWizard.onFinishedPageAdvanced();">

Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/update.dtd">
<bindings id="updateItemBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="updateItem">
<resources>
<stylesheet src="chrome://mozapps/skin/update/update.css"/>
</resources>
<content>
<xul:hbox flex="1">
<xul:vbox align="center" pack="center">
<xul:image class="installItemIcon" xbl:inherits="src=icon"/>
</xul:vbox>
<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="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"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
<implementation>
<property name="name" onset="this.setAttribute('name', val); return val;"
onget="return this.getAttribute('name');"/>
<property name="url" onset="this.setAttribute('url', val); return val;"
onget="return this.getAttribute('url');"/>
<property name="icon" onset="this.setAttribute('icon', val); return val;"
onget="return this.getAttribute('icon');"/>
</implementation>
</binding>
</bindings>

Просмотреть файл

@ -2,20 +2,24 @@
<!ENTITY mismatch.title "Incompatible Extensions">
<!ENTITY mismatch.intro1.label "The following extensions are not compatible with the new version
of &brandShortName; you have just installed.">
of &brandShortName; you have just installed:">
<!ENTITY mismatch.intro2.label "They have been disabled until compatible versions are
installed.">
<!ENTITY mismatch.intro3.label "&brandShortName; can check for and install newer, compatible
versions of these extensions.">
<!ENTITY checking.title "Checking for Updates">
<!ENTITY checking.intro.label "&brandShortName; is now checking for updates to your extensions...">
<!ENTITY checking.intro.label "&brandShortName; is now checking for available updates...">
<!ENTITY updatesNotFound.title "No Updates Found">
<!ENTITY noupdates.title "No Updates Found">
<!ENTITY found.title "Updates Found">
<!ENTITY found.intro.label "&brandShortName; found the following available updates:">
<!ENTITY found.instructions.label "Choose the ones you want to install and click Install Now to install them.">
<!ENTITY updatesFound.title "Updates Found">
<!ENTITY installing.title "Installing Updates">
<!ENTITY finished.title "Done">
<!ENTITY from.label "from: ">

Просмотреть файл

@ -0,0 +1,5 @@
mismatchCheckNow=Check Now
mismatchDontCheck=Don't Check
installButtonText=Install Now
nextButtonText=Next >
cancelButtonText=Cancel

Просмотреть файл

@ -0,0 +1,41 @@
#foundList {
-moz-appearance: listbox;
margin: 10px 4px 10px 4px;
}
updateitem {
padding: 5px 0px 5px 5px;
border-bottom: 1px dotted #C0C0C0;
margin-bottom: 5px;
}
.warning {
font-weight: bold;
}
.updateItemIcon {
width: 32px;
height: 32px;
max-width: 32px !important;
max-height: 32px !important;
margin-right: 5px;
}
.updateItemName {
font-weight: bold;
}
.updateItemNameRow {
padding-bottom: 3px;
}
.updateItemURL {
-moz-appearance: none;
border: none;
background-color: Window;
}
.updateItemIcon {
list-style-image: url("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png");
}

Просмотреть файл

@ -57,7 +57,7 @@
<vbox flex="1" id="dialogContentBox">
<description id="itemWarningIntro"/>
<vbox id="itemList" flex="1" style="height: 16em; overflow: auto;"/>
<vbox id="itemList" class="listbox" flex="1" style="height: 16em; overflow: auto;"/>
<description>&warningText2.label;</description>
<description class="warning">&warningText3.label;</description>

Просмотреть файл

@ -1,59 +0,0 @@
#xpinstallIcon {
list-style-image: url("chrome://mozapps/skin/xpinstall/xpinstallIcon.png");
}
#itemList {
-moz-appearance: listbox;
margin: 10px 4px 10px 4px;
}
#dialogContentBox {
padding: 5px;
}
installitem {
padding: 5px 0px 5px 5px;
border-bottom: 1px dotted #C0C0C0;
margin-bottom: 5px;
}
.warning {
font-weight: bold;
}
.xpinstallItemIcon {
width: 32px;
height: 32px;
max-width: 32px !important;
max-height: 32px !important;
margin-right: 5px;
}
.xpinstallItemName {
font-weight: bold;
}
.xpinstallItemSigned {
font-style: italic;
}
.xpinstallItemSigned[signed=false] {
color: #ED1C24;
font-style: normal;
font-weight: bold;
}
.xpinstallItemNameRow {
padding-bottom: 3px;
}
.xpinstallItemURL {
-moz-appearance: none;
border: none;
background-color: Window;
}
.xpinstallItemIcon {
list-style-image: url("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png");
}