Adapt wallet's password manager UI (removing the form manager bits). Split into content and locale directories and add contents.rdf files for passwordmgr chrome package.

git-svn-id: svn://10.0.0.236/trunk@145264 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com 2003-07-28 06:06:10 +00:00
parent 2a40dbb3c5
commit 67928a1382
10 changed files with 672 additions and 244 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:passwordmgr"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:passwordmgr"
chrome:displayName="Password Manager"
chrome:author="mozilla.org"
chrome:name="passwordmgr"
chrome:localeVersion="1.5a">
</RDF:Description>
</RDF:RDF>

View File

@ -0,0 +1,511 @@
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released March
# 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Ben "Count XULula" Goodger
# Brian Ryner <bryner@brianryner.com>
/*** =================== INITIALISATION CODE =================== ***/
var kObserverService;
var kSignonBundle;
var gSelectUserInUse = false;
// interface variables
var passwordmanager = null;
// password-manager lists
var signons = [];
var rejects = [];
var deletedSignons = [];
var deletedRejects = [];
function Startup() {
// xpconnect to password manager interfaces
passwordmanager = Components.classes["@mozilla.org/passwordmanager;1"].getService(Components.interfaces.nsIPasswordManager);
kSignonBundle = document.getElementById("signonBundle");
// be prepared to reload the display if anything changes
kObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
kObserverService.addObserver(signonReloadDisplay, "signonChanged", false);
// be prepared to disable the buttons when selectuser dialog is in use
kObserverService.addObserver(signonReloadDisplay, "signonSelectUser", false);
signonsTree = document.getElementById("signonsTree");
rejectsTree = document.getElementById("rejectsTree");
// set initial password-manager tab
var tabBox = document.getElementById("tabbox");
tabBox.selectedTab = document.getElementById("signonsTab");
// load password manager items
if (!LoadSignons()) {
return; /* user failed to unlock the database */
}
LoadRejects();
// label the close button
document.documentElement.getButton("accept").label = kSignonBundle.getString("close");
}
function Shutdown() {
if (isPasswordManager) {
kObserverService.removeObserver(signonReloadDisplay, "signonChanged");
kObserverService.removeObserver(signonReloadDisplay, "signonSelectUser");
}
}
var signonReloadDisplay = {
observe: function(subject, topic, state) {
if (topic == "signonChanged") {
if (state == "signons") {
signons.length = 0;
if (lastSignonSortColumn == "host") {
lastSignonSortAscending = !lastSignonSortAscending; // prevents sort from being reversed
}
LoadSignons();
} else if (state == "rejects") {
rejects.length = 0;
if (lastRejectSortColumn == "host") {
lastRejectSortAscending = !lastRejectSortAscending; // prevents sort from being reversed
}
LoadRejects();
}
} else if (topic == "signonSelectUser") {
if (state == "suspend") {
gSelectUserInUse = true;
document.getElementById("removeSignon").disabled = true;
document.getElementById("removeAllSignons").disabled = true;
} else if (state == "resume") {
gSelectUserInUse = false;
var selections = GetTreeSelections(signonsTree);
if (selections.length > 0) {
document.getElementById("removeSignon").disabled = false;
}
if (signons.length > 0) {
document.getElementById("removeAllSignons").disabled = false;
}
} else if (state == "inUse") {
gSelectUserInUse = true;
}
}
}
}
/*** =================== SAVED SIGNONS CODE =================== ***/
var signonsTreeView = {
rowCount : 0,
setTree : function(tree){},
getImageSrc : function(row,column) {},
getProgressMode : function(row,column) {},
getCellValue : function(row,column) {},
getCellText : function(row,column){
var rv="";
if (column=="siteCol") {
rv = signons[row].host;
} else if (column=="userCol") {
rv = signons[row].user;
}
return rv;
},
isSeparator : function(index) {return false;},
isSorted: function() { return false; },
isContainer : function(index) {return false;},
cycleHeader : function(aColId, aElt) {},
getRowProperties : function(row,column,prop){},
getColumnProperties : function(column,columnElement,prop){},
getCellProperties : function(row,prop){}
};
var signonsTree;
function Signon(number, host, user, rawuser) {
this.number = number;
this.host = host;
this.user = user;
this.rawuser = rawuser;
}
function LoadSignons() {
// loads signons into table
var enumerator = passwordmanager.enumerator;
var count = 0;
while (enumerator.hasMoreElements()) {
var nextPassword;
try {
nextPassword = enumerator.getNext();
} catch(e) {
/* user supplied invalid database key */
window.close();
return false;
}
nextPassword = nextPassword.QueryInterface(Components.interfaces.nsIPassword);
var host = nextPassword.host;
var user = nextPassword.user;
var rawuser = user;
// if no username supplied, try to parse it out of the url
if (user == "") {
var unused = { };
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var username;
try {
username = ioService.newURI(host, null, null).username;
} catch(e) {
username = "";
}
if (username != "") {
user = username;
} else {
user = "<>";
}
}
signons[count] = new Signon(count++, host, user, rawuser);
}
signonsTreeView.rowCount = signons.length;
// sort and display the table
signonsTree.treeBoxObject.view = signonsTreeView;
SignonColumnSort('host');
// disable "remove all signons" button if there are no signons
var element = document.getElementById("removeAllSignons");
if (signons.length == 0 || gSelectUserInUse) {
element.setAttribute("disabled","true");
} else {
element.removeAttribute("disabled");
}
return true;
}
function SignonSelected() {
var selections = GetTreeSelections(signonsTree);
if (selections.length && !gSelectUserInUse) {
document.getElementById("removeSignon").removeAttribute("disabled");
}
}
function DeleteSignon() {
DeleteSelectedItemFromTree(signonsTree, signonsTreeView,
signons, deletedSignons,
"removeSignon", "removeAllSignons");
FinalizeSignonDeletions();
}
function DeleteAllSignons() {
DeleteAllFromTree(signonsTree, signonsTreeView,
signons, deletedSignons,
"removeSignon", "removeAllSignons");
FinalizeSignonDeletions();
}
function FinalizeSignonDeletions() {
for (var s=0; s<deletedSignons.length; s++) {
passwordmanager.removeUser(deletedSignons[s].host, deletedSignons[s].rawuser);
}
deletedSignons.length = 0;
}
function HandleSignonKeyPress(e) {
if (e.keyCode == 46) {
DeleteSignonSelected();
}
}
var lastSignonSortColumn = "";
var lastSignonSortAscending = false;
function SignonColumnSort(column) {
lastSignonSortAscending =
SortTree(signonsTree, signonsTreeView, signons,
column, lastSignonSortColumn, lastSignonSortAscending);
lastSignonSortColumn = column;
}
/*** =================== REJECTED SIGNONS CODE =================== ***/
var rejectsTreeView = {
rowCount : 0,
setTree : function(tree){},
getImageSrc : function(row,column) {},
getProgressMode : function(row,column) {},
getCellValue : function(row,column) {},
getCellText : function(row,column){
var rv="";
if (column=="rejectCol") {
rv = rejects[row].host;
}
return rv;
},
isSeparator : function(index) {return false;},
isSorted: function() { return false; },
isContainer : function(index) {return false;},
cycleHeader : function(aColId, aElt) {},
getRowProperties : function(row,column,prop){},
getColumnProperties : function(column,columnElement,prop){},
getCellProperties : function(row,prop){}
};
var rejectsTree;
function Reject(number, host) {
this.number = number;
this.host = host;
}
function LoadRejects() {
var enumerator = passwordmanager.rejectEnumerator;
var count = 0;
while (enumerator.hasMoreElements()) {
var nextReject = enumerator.getNext();
nextReject = nextReject.QueryInterface(Components.interfaces.nsIPassword);
var host = nextReject.host;
rejects[count] = new Reject(count++, host);
}
rejectsTreeView.rowCount = rejects.length;
// sort and display the table
rejectsTree.treeBoxObject.view = rejectsTreeView;
RejectColumnSort('host');
var element = document.getElementById("removeAllRejects");
if (rejects.length == 0) {
element.setAttribute("disabled","true");
} else {
element.removeAttribute("disabled");
}
}
function RejectSelected() {
var selections = GetTreeSelections(rejectsTree);
if (selections.length) {
document.getElementById("removeReject").removeAttribute("disabled");
}
}
function DeleteReject() {
DeleteSelectedItemFromTree(rejectsTree, rejectsTreeView,
rejects, deletedRejects,
"removeReject", "removeAllRejects");
FinalizeRejectDeletions();
}
function DeleteAllRejects() {
DeleteAllFromTree(rejectsTree, rejectsTreeView,
rejects, deletedRejects,
"removeReject", "removeAllRejects");
FinalizeRejectDeletions();
}
function FinalizeRejectDeletions() {
for (var r=0; r<deletedRejects.length; r++) {
passwordmanager.removeReject(deletedRejects[r].host);
}
deletedRejects.length = 0;
}
function HandleRejectKeyPress(e) {
if (e.keyCode == 46) {
DeleteRejectSelected();
}
}
var lastRejectSortColumn = "";
var lastRejectSortAscending = false;
function RejectColumnSort(column) {
lastRejectSortAscending =
SortTree(rejectsTree, rejectsTreeView, rejects,
column, lastRejectSortColumn, lastRejectSortAscending);
lastRejectSortColumn = column;
}
/*** =================== GENERAL CODE =================== ***/
// Remove whitespace from both ends of a string
function TrimString(string)
{
if (!string) {
return "";
}
return string.replace(/(^\s+)|(\s+$)/g, '')
}
function doHelpButton() {
if (isPasswordManager) {
openHelp("password_mgr");
} else {
openHelp("forms_sites");
}
}
function DeleteAllFromTree
(tree, view, table, deletedTable, removeButton, removeAllButton) {
// remove all items from table and place in deleted table
for (var i=0; i<table.length; i++) {
deletedTable[deletedTable.length] = table[i];
}
table.length = 0;
// clear out selections
tree.treeBoxObject.view.selection.select(-1);
// redisplay
view.rowCount = 0;
tree.treeBoxObject.invalidate();
// disable buttons
document.getElementById(removeButton).setAttribute("disabled", "true")
document.getElementById(removeAllButton).setAttribute("disabled","true");
}
function DeleteSelectedItemFromTree
(tree, view, table, deletedTable, removeButton, removeAllButton) {
// remove selected items from list (by setting them to null) and place in deleted list
var selections = GetTreeSelections(tree);
for (var s=selections.length-1; s>= 0; s--) {
var i = selections[s];
deletedTable[deletedTable.length] = table[i];
table[i] = null;
}
// collapse list by removing all the null entries
for (var j=0; j<table.length; j++) {
if (table[j] == null) {
var k = j;
while ((k < table.length) && (table[k] == null)) {
k++;
}
table.splice(j, k-j);
}
}
// redisplay
var box = tree.treeBoxObject;
var firstRow = box.getFirstVisibleRow();
if (firstRow > (table.length-1) ) {
firstRow = table.length-1;
}
view.rowCount = table.length;
box.rowCountChanged(0, table.length);
box.scrollToRow(firstRow)
// update selection and/or buttons
if (table.length) {
// update selection
// note: we need to deselect before reselecting in order to trigger ...Selected method
var nextSelection = (selections[0] < table.length) ? selections[0] : table.length-1;
tree.treeBoxObject.view.selection.select(-1);
tree.treeBoxObject.view.selection.select(nextSelection);
} else {
// disable buttons
document.getElementById(removeButton).setAttribute("disabled", "true")
document.getElementById(removeAllButton).setAttribute("disabled","true");
// clear out selections
tree.treeBoxObject.view.selection.select(-1);
}
}
function GetTreeSelections(tree) {
var selections = [];
var select = tree.treeBoxObject.selection;
if (select) {
var count = select.getRangeCount();
var min = new Object();
var max = new Object();
for (var i=0; i<count; i++) {
select.getRangeAt(i, min, max);
for (var k=min.value; k<=max.value; k++) {
if (k != -1) {
selections[selections.length] = k;
}
}
}
}
return selections;
}
function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {
// remember which item was selected so we can restore it after the sort
var selections = GetTreeSelections(tree);
var selectedNumber = selections.length ? table[selections[0]].number : -1;
// determine if sort is to be ascending or descending
var ascending = (column == lastSortColumn) ? !lastSortAscending : true;
// do the sort
var compareFunc;
if (ascending) {
compareFunc = function compare(first, second) {
if (first[column] < second[column])
return -1;
if (first[column] > second[column])
return 1;
return 0;
}
} else {
compareFunc = function compare(first, second) {
if (first[column] < second[column])
return 1;
if (first[column] > second[column])
return -1;
return 0;
}
}
table.sort(compareFunc);
// restore the selection
var selectedRow = -1;
if (selectedNumber>=0 && updateSelection) {
for (var s=0; s<table.length; s++) {
if (table[s].number == selectedNumber) {
// update selection
// note: we need to deselect before reselecting in order to trigger ...Selected()
tree.treeBoxObject.view.selection.select(-1);
tree.treeBoxObject.view.selection.select(s);
selectedRow = s;
break;
}
}
}
// display the results
tree.treeBoxObject.invalidate();
if (selectedRow >= 0) {
tree.treeBoxObject.ensureRowIsVisible(selectedRow)
}
return ascending;
}

View File

@ -0,0 +1,99 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil -*- -->
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Ben Goodger
# Brian Ryner <bryner@brianryner.com>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd" >
<dialog id="signonviewer"
title="&windowtitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 30em!important;"
buttons="accept,help"
onload="Startup()"
onunload="Shutdown()"
ondialoghelp="return doHelpButton();">
<script src="chrome://passwordmgr/content/passwordManager.js"/>
<script src="chrome://global/content/strres.js"/>
# <script src="chrome://help/content/contextHelp.js"/>
<stringbundle id="signonBundle"
src="chrome://passwordmgr/locale/passwordmgr.properties"/>
<tabbox id="tabbox" flex="1">
<tabs>
<tab id="signonsTab" label="&tab.signonsstored.label;"/>
<tab id="signonsitesTab" label="&tab.signonsnotstored.label;"/>
</tabs>
<tabpanels id="panel" flex="1">
<!-- saved signons -->
<vbox id="savedsignons" flex="1">
<description>&spiel.signonsstored.label;</description>
<separator class="thin"/>
<tree id="signonsTree" flex="1" style="height: 10em;" hidecolumnpicker="true"
onkeypress="HandleSignonKeyPress(event)"
onselect="SignonSelected();">
<treecols>
<treecol id="siteCol" label="&treehead.site.label;" flex="5"
onclick="SignonColumnSort('host');"/>
<splitter class="tree-splitter"/>
<treecol id="userCol" label="&treehead.username.label;" flex="5"
onclick="SignonColumnSort('user');"/>
</treecols>
<treechildren/>
</tree>
<separator class="thin"/>
<hbox>
<button id="removeSignon" disabled="true"
label="&remove.label;" oncommand="DeleteSignon();"/>
<button id="removeAllSignons"
label="&removeall.label;"
oncommand="DeleteAllSignons();"/>
</hbox>
</vbox>
<!-- rejected signon sites -->
<vbox id="rejectedsites" flex="1">
<description>&spiel.signonsnotstored.label;</description>
<separator class="thin"/>
<tree id="rejectsTree" flex="1" style="height: 10em;" hidecolumnpicker="true"
onkeypress="HandleRejectKeyPress(event)"
onselect="RejectSelected();">
<treecols>
<treecol id="rejectCol" label="&treehead.site.label;" flex="5"
onclick="RejectColumnSort('host');"/>
</treecols>
<treechildren/>
</tree>
<separator class="thin"/>
<hbox>
<button id="removeReject" disabled="true"
label="&remove.label;" oncommand="DeleteReject();"/>
<button id="removeAllRejects"
label="&removeall.label;"
oncommand="DeleteAllRejects();"/>
</hbox>
</vbox>
</tabpanels>
</tabbox>
</dialog>

View File

@ -1,8 +1,9 @@
toolkit.jar:
* content/passwordmgr/passwordManager.xul
* content/passwordmgr/passwordManager.js
* content/passwordmgr/passwordManager.css
content/passwordmgr/contents.rdf (content/contents.rdf)
* content/passwordmgr/passwordManager.xul (content/passwordManager.xul)
* content/passwordmgr/passwordManager.js (content/passwordManager.js)
en-US.jar:
* locale/en-US/passwordmgr/passwordmgr.properties
* locale/en-US/passwordmgr/passwordManager.dtd
locale/en-US/passwordmgr/contents.rdf (locale/contents.rdf)
* locale/en-US/passwordmgr/passwordmgr.properties (locale/passwordmgr.properties)
* locale/en-US/passwordmgr/passwordManager.dtd (locale/passwordManager.dtd)

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:locale:root">
<RDF:li resource="urn:mozilla:locale:en-US"/>
</RDF:Seq>
<!-- locale information -->
<RDF:Description about="urn:mozilla:locale:en-US"
chrome:displayName="English (US)"
chrome:author="mozilla.org"
chrome:name="en-US">
<chrome:packages>
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
<RDF:li resource="urn:mozilla:locale:en-US:passwordmgr"/>
</RDF:Seq>
</chrome:packages>
</RDF:Description>
<!-- Version Information. State that we work only with major version of this
package. -->
<RDF:Description about="urn:mozilla:locale:en-US:passwordmgr"
chrome:localeVersion="1.5a"/>
</RDF:RDF>

View File

@ -35,4 +35,14 @@
#
# ***** END LICENSE BLOCK *****
@import url("chrome://global/skin");
<!ENTITY windowtitle.label "Password Manager">
<!ENTITY tab.signonsstored.label "Passwords Saved">
<!ENTITY tab.signonsnotstored.label "Passwords Never Saved">
<!ENTITY spiel.signonsstored.label "Password Manager has saved login information for the following sites:">
<!ENTITY spiel.signonsnotstored.label "Password Manager will never save login information for the following sites:">
<!ENTITY treehead.site.label "Site">
<!ENTITY treehead.username.label "Username">
<!ENTITY remove.label "Remove">
<!ENTITY removeall.label "Remove All">

View File

@ -40,3 +40,4 @@ rememberPassword = Use Password Manager to remember this password.
savePasswordTitle = Confirm
savePasswordText = Password Manager can remember this logon and enter it automatically the next time you return to this website.\nDo you want Password Manager to remember this logon?
neverForSite = Never for this site
close = Close

View File

@ -1,46 +0,0 @@
# ***** 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 Mozilla Password Manager.
#
# The Initial Developer of the Original Code is
# Brian Ryner.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# 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 LGPL or the GPL. 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 *****
<!ENTITY windowtitle.label "Password Manager">
<!ENTITY storedLogins.label "Passwords Saved">
<!ENTITY rejectedLogins.label "Passwords Never Saved">
<!ENTITY storedLoginsDescription.label "Password Manager has saved login information for the following sites:">
<!ENTITY site.label "Site">
<!ENTITY username.label "Username">
<!ENTITY remove.label "Remove">
<!ENTITY removeAll.label "Remove All">
<!ENTITY rejectedLoginsDescription.label "Password Manager will never save login information for the following sites:">

View File

@ -1,91 +0,0 @@
# -*- Mode: Java; 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 Mozilla Password Manager.
#
# The Initial Developer of the Original Code is
# Brian Ryner.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# 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 *****
var passwordManager;
const nsIPasswordManager = Components.interfaces.nsIPasswordManager;
const nsPasswordManager_CONTRACTID = "@mozilla.org/passwordmanager;1";
const nsIPassword = Components.interfaces.nsIPassword;
function Startup()
{
passwordManager = Components.classes[nsPasswordManager_CONTRACTID].getService(nsIPasswordManager);
updateSignonList();
updateButtons();
}
function updateSignonList()
{
var signonTree = document.getElementById('signonsTree');
// xxx quick hack: insert rows one at a time
var treeChildren = signonTree.getElementsByTagName('treechildren')[0];
var enumerator = passwordManager.enumerator;
while (enumerator.hasMoreElements()) {
var nextPassword = enumerator.getNext().QueryInterface(nsIPassword);
var treeItem = document.createElement('treeitem');
var treeRow = document.createElement('treerow');
var hostCell = document.createElement('treecell');
var userCell = document.createElement('treecell');
hostCell.setAttribute('label', nextPassword.host);
userCell.setAttribute('label', nextPassword.user);
treeRow.appendChild(hostCell);
treeRow.appendChild(userCell);
treeItem.appendChild(treeRow);
treeChildren.appendChild(treeItem);
}
}
function updateButtons()
{
// update remove signon button enabled state
}
function deleteSignon()
{
var tree = document.getElementById('signonsTree');
var index = tree.currentIndex;
var host = tree.boxObject.view.getCellText(index, 'hostColumn');
var user = tree.boxObject.view.getCellText(index, 'userColumn');
passwordManager.removeUser(host, user);
}

View File

@ -1,101 +0,0 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil -*- -->
# ***** 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 Mozilla Password Manager.
#
# The Initial Developer of the Original Code is
# Brian Ryner.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# 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 *****
<?xml-stylesheet href="chrome://passwordmgr/content/passwordManager.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
<dialog id="signonviewer"
title="&windowtitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept"
onload="Startup();">
<script src="chrome://passwordmgr/content/passwordManager.js"/>
<tabbox id="tabBox" flex="1">
<tabs>
<tab label="&storedLogins.label;"/>
<tab label="&rejectedLogins.label;"/>
</tabs>
<tabpanels flex="1">
<vbox flex="1">
<description>&storedLoginsDescription.label;</description>
<separator class="thin"/>
<tree flex="1" id="signonsTree" hidecolumnpicker="true" rows="10"
onselect="SignonSelected();">
<treecols>
<treecol id="hostColumn" label="&site.label;" flex="1"
onclick="SignonColumnSort(this);"/>
<splitter class="tree-splitter"/>
<treecol id="userColumn" label="&username.label;" flex="1"
onclick="SignonColumnSort(this);"/>
</treecols>
<treechildren/>
</tree>
<separator class="thin"/>
<hbox>
<button id="removeSignon"
label="&remove.label;" oncommand="deleteSignon();"/>
<button id="removeAllSignons"
label="&removeAll.label;" oncommand="deleteAllSignons();"/>
</hbox>
</vbox>
<vbox flex="1">
<description>&rejectedLoginsDescription.label;</description>
<separator class="thin"/>
<tree id="rejectsTree" flex="1" hidecolumnpicker="true"
onselect="RejectSelected();">
<treecols>
<treecol label="&site.label;" flex="1"
onclick="RejectColumnSort(this);"/>
</treecols>
<treechildren/>
</tree>
<separator class="thin"/>
<hbox>
<button id="removeReject" label="&remove.label;"
oncommand="DeleteReject();"/>
<button id="removeAllRejects" label="&removeAll.label;"
oncommand="DeleteAllRejects();"/>
</hbox>
</vbox>
</tabpanels>
</tabbox>
</dialog>