зеркало из https://github.com/mozilla/gecko-dev.git
Add update history list UI
This commit is contained in:
Родитель
01a323d63b
Коммит
57508d188f
|
@ -112,7 +112,26 @@ var gAdvancedPane = {
|
|||
|
||||
checkForAddonUpdates: function ()
|
||||
{
|
||||
goats
|
||||
var updateTypes =
|
||||
Components.classes["@mozilla.org/supports-PRUint8;1"].
|
||||
createInstance(Components.interfaces.nsISupportsPRUint8);
|
||||
updateTypes.data = Components.interfaces.nsIUpdateItem.TYPE_ADDON;
|
||||
var showMismatch =
|
||||
Components.classes["@mozilla.org/supports-PRBool;1"].
|
||||
createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
showMismatch.data = false;
|
||||
var ary =
|
||||
Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
ary.AppendElement(updateTypes);
|
||||
ary.AppendElement(showMismatch);
|
||||
|
||||
var features = "chrome,centerscreen,dialog,titlebar";
|
||||
const URI_EXTENSION_UPDATE_DIALOG =
|
||||
"chrome://mozapps/content/extensions/update.xul";
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
ww.openWindow(window, URI_EXTENSION_UPDATE_DIALOG, "", features, ary);
|
||||
},
|
||||
|
||||
checkForUpdates: function ()
|
||||
|
@ -126,7 +145,7 @@ var gAdvancedPane = {
|
|||
{
|
||||
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIUpdatePrompt);
|
||||
prompter.showInstalledUpdates();
|
||||
prompter.showUpdateHistory();
|
||||
},
|
||||
|
||||
showLanguages: function ()
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
<!ENTITY history.title "Update History">
|
||||
<!ENTITY history.intro "The following updates have been installed:">
|
||||
<!ENTITY closebutton.label "Close">
|
||||
|
||||
<!ENTITY detailsButton.label "Details">
|
||||
<!ENTITY detailsButton.accesskey "D">
|
||||
|
||||
<!ENTITY noupdates.label "No updates installed yet">
|
||||
|
||||
<!ENTITY name.header "Update Name">
|
||||
<!ENTITY date.header "Install Date">
|
||||
<!ENTITY type.header "Type">
|
||||
<!ENTITY state.header "State">
|
||||
|
|
@ -91,6 +91,7 @@
|
|||
locale/@AB_CD@/mozapps/update/updates.dtd (%chrome/mozapps/update/updates.dtd)
|
||||
locale/@AB_CD@/mozapps/update/updates.properties (%chrome/mozapps/update/updates.properties)
|
||||
locale/@AB_CD@/mozapps/update/incompatible.dtd (%chrome/mozapps/update/incompatible.dtd)
|
||||
locale/@AB_CD@/mozapps/update/history.dtd (%chrome/mozapps/update/history.dtd)
|
||||
locale/@AB_CD@/mozapps/update/errors.dtd (%chrome/mozapps/update/errors.dtd)
|
||||
locale/@AB_CD@/mozapps/xpinstall/xpinstallConfirm.dtd (%chrome/mozapps/xpinstall/xpinstallConfirm.dtd)
|
||||
locale/@AB_CD@/mozapps/xpinstall/xpinstallConfirm.properties (%chrome/mozapps/xpinstall/xpinstallConfirm.properties)
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Update Service.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@mozilla.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
var gUpdateHistory = {
|
||||
_children: null,
|
||||
|
||||
/**
|
||||
* Initialize the User Interface
|
||||
*/
|
||||
onLoad: function() {
|
||||
this._children = document.getElementById("historyChildren");
|
||||
|
||||
var um =
|
||||
Components.classes["@mozilla.org/updates/update-manager;1"].
|
||||
getService(Components.interfaces.nsIUpdateManager);
|
||||
var uc = um.updateCount;
|
||||
if (uc) {
|
||||
while (this._children.hasChildNodes())
|
||||
this._children.removeChild(this._children.firstChild);
|
||||
|
||||
for (var i = 0; i < uc; ++i) {
|
||||
var update = um.getUpdateAt(i);
|
||||
|
||||
var treeitem = document.createElementNS(NS_XUL, "treeitem");
|
||||
var treerow = document.createElementNS(NS_XUL, "treerow");
|
||||
var nameCell = document.createElementNS(NS_XUL, "treecell");
|
||||
nameCell.setAttribute("label", update.name);
|
||||
var dateCell = document.createElementNS(NS_XUL, "treecell");
|
||||
var formattedDate = this._formatDate(update.installDate);
|
||||
dateCell.setAttribute("label", formattedDate);
|
||||
var typeCell = document.createElementNS(NS_XUL, "treecell");
|
||||
typeCell.setAttribute("label", update.type);
|
||||
dump("*** name = " + update.name + ", date = " + update.installDate + ", type = " + update.type + ", state = " + update.state + "\n");
|
||||
var stateCell = document.createElementNS(NS_XUL, "treecell");
|
||||
stateCell.setAttribute("label", update.selectedPatch.state);
|
||||
treerow.appendChild(nameCell);
|
||||
treerow.appendChild(dateCell);
|
||||
treerow.appendChild(typeCell);
|
||||
treerow.appendChild(stateCell);
|
||||
treeitem.appendChild(treerow);
|
||||
|
||||
this._children.appendChild(treeitem);
|
||||
}
|
||||
}
|
||||
|
||||
var closebuttonlabel = document.documentElement.getAttribute("closebuttonlabel");
|
||||
var cancelbutton = document.documentElement.getButton("cancel");
|
||||
cancelbutton.label = closebuttonlabel;
|
||||
cancelbutton.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Formats a date into human readable form
|
||||
* @param seconds
|
||||
* A date in seconds since 1970 epoch
|
||||
* @returns A human readable date string
|
||||
*/
|
||||
_formatDate: function(seconds) {
|
||||
var sdf =
|
||||
Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
|
||||
getService(Components.interfaces.nsIScriptableDateFormat);
|
||||
var date = new Date(seconds);
|
||||
return sdf.FormatDateTime("", sdf.dateFormatLong,
|
||||
sdf.timeFormatSeconds,
|
||||
date.getFullYear(),
|
||||
date.getMonth() + 1,
|
||||
date.getDate(),
|
||||
date.getHours(),
|
||||
date.getMinutes(),
|
||||
date.getSeconds());
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when a tree row is selected
|
||||
*/
|
||||
onTreeSelect: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the Details page for an item
|
||||
*/
|
||||
showDetails: function() {
|
||||
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Update Wizard/Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
%historyDTD;
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/content/update/updates.css"?>
|
||||
|
||||
<dialog id="history"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
style="width: 35em;"
|
||||
buttons="cancel" closebuttonlabel="&closebutton.label;"
|
||||
title="&history.title;"
|
||||
onload="gUpdateHistory.onLoad();">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://mozapps/content/update/history.js"/>
|
||||
|
||||
<stringbundle id="updateBundle"
|
||||
src="chrome://mozapps/locale/update/updates.properties"/>
|
||||
|
||||
<label>&history.intro;</label>
|
||||
<separator/>
|
||||
<tree id="historyItems" rows="10" hidecolumnpicker="true" seltype="single"
|
||||
onselect="gUpdateHistory.onTreeSelect()">
|
||||
<treecols>
|
||||
<treecol id="updateNameCol" flex="1" primary="true" label="&name.header;"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="updateDate" label="&date.header;"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="updateType" label="&type.header;"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="updateState" label="&state.header;"/>
|
||||
</treecols>
|
||||
<treechildren id="historyChildren">
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell>&noupdates.label;</treecell>
|
||||
<treecell/>
|
||||
<treecell/>
|
||||
<treecell/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
<separator/>
|
||||
<hbox>
|
||||
<button id="details"
|
||||
label="&detailsButton.label;" accesskey="&detailsButton.accesskey;"
|
||||
oncommand="gUpdateHistory.showDetails();"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
|
|
@ -1,4 +1,39 @@
|
|||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Update Service.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@mozilla.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function init() {
|
||||
var updateBundle = document.getElementById("updateBundle");
|
||||
|
|
|
@ -1,5 +1,42 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Update Wizard/Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % incompatibleDTD SYSTEM "chrome://mozapps/locale/update/incompatible.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
|
|
|
@ -6,4 +6,6 @@ toolkit.jar:
|
|||
* content/mozapps/update/updates.xml (content/updates.xml)
|
||||
* content/mozapps/update/incompatible.xul (content/incompatible.xul)
|
||||
* content/mozapps/update/incompatible.js (content/incompatible.js)
|
||||
* content/mozapps/update/history.xul (content/history.xul)
|
||||
* content/mozapps/update/history.js (content/history.js)
|
||||
* content/mozapps/update/errors.xul (content/errors.xul)
|
||||
|
|
|
@ -71,7 +71,7 @@ interface nsIUpdatePatch : nsISupports
|
|||
attribute unsigned long size;
|
||||
|
||||
/**
|
||||
* The state of this update
|
||||
* The state of this patch
|
||||
*/
|
||||
attribute AString state;
|
||||
|
||||
|
@ -231,7 +231,7 @@ interface nsIUpdatePrompt : nsISupports
|
|||
/**
|
||||
* Shows a list of all updates installed to date.
|
||||
*/
|
||||
void showInstalledUpdates();
|
||||
void showUpdateHistory();
|
||||
};
|
||||
|
||||
[scriptable, uuid(877ace25-8bc5-452a-8586-9c1cf2871994)]
|
||||
|
|
|
@ -57,7 +57,7 @@ const PREF_UPDATE_LASTUPDATETIME_FMT = "app.update.lastUpdateTime.%ID%";
|
|||
const PREF_APP_EXTENSIONS_VERSION = "app.extensions.version";
|
||||
|
||||
const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
|
||||
const URI_UPDATE_LIST_DIALOG = "chrome://mozapps/content/update/updateHistory.xul";
|
||||
const URI_UPDATE_HISTORY_DIALOG = "chrome://mozapps/content/update/history.xul";
|
||||
const URI_BRAND_PROPERTIES = "chrome://branding/locale/brand.properties";
|
||||
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
|
||||
const URI_UPDATE_NS = "http://www.mozilla.org/2005/app-update";
|
||||
|
@ -337,14 +337,14 @@ UpdatePrompt.prototype = {
|
|||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateAvailable: function(update) {
|
||||
this._showUI(update);
|
||||
this._showUI(URI_UPDATE_PROMPT_DIALOG, "Update:Wizard", update);
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateComplete: function(update) {
|
||||
this._showUI(update);
|
||||
this._showUI(URI_UPDATE_PROMPT_DIALOG, "Update:Wizard", update);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -353,7 +353,7 @@ UpdatePrompt.prototype = {
|
|||
* An update to pass to the UI in the window arguments.
|
||||
* Can be null.
|
||||
*/
|
||||
_showUI: function(update) {
|
||||
_showUI: function(uri, name, update) {
|
||||
var ary = null;
|
||||
if (update) {
|
||||
ary = Components.classes["@mozilla.org/supports-array;1"]
|
||||
|
@ -369,7 +369,7 @@ UpdatePrompt.prototype = {
|
|||
else {
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
ww.openWindow(null, URI_UPDATE_PROMPT_DIALOG,
|
||||
ww.openWindow(null, uri,
|
||||
"", "chrome,centerscreen,dialog,titlebar,dependent", ary);
|
||||
}
|
||||
},
|
||||
|
@ -377,9 +377,8 @@ UpdatePrompt.prototype = {
|
|||
/**
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showInstalledUpdates: function() {
|
||||
// this._showUI(1);
|
||||
// XXXben TODO!
|
||||
showUpdateHistory: function() {
|
||||
this._showUI(URI_UPDATE_HISTORY_DIALOG, "Update:History", null);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -941,6 +940,7 @@ UpdatePatch.prototype = {
|
|||
patch.setAttribute("hashValue", this.hashValue);
|
||||
patch.setAttribute("size", this.size);
|
||||
patch.setAttribute("selected", this.selected);
|
||||
patch.setAttribute("state", this.state);
|
||||
|
||||
for (var p in this._properties) {
|
||||
if (this._properties[p].present)
|
||||
|
@ -1700,6 +1700,7 @@ Downloader.prototype = {
|
|||
this._writeStatusFile(this._updatesDir, state);
|
||||
this._patch.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
|
||||
this._patch.state = state;
|
||||
this._update.installDate = (new Date()).getTime();
|
||||
var um = Components.classes["@mozilla.org/updates/update-manager;1"]
|
||||
.getService(Components.interfaces.nsIUpdateManager);
|
||||
um.activeUpdate = null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче