From 5796b05a364d56695ac9d7f863879846e8205a9b Mon Sep 17 00:00:00 2001 From: "hangas%netscape.com" Date: Sat, 3 Jul 1999 01:39:52 +0000 Subject: [PATCH] Added Code to be able to edit an existing address book card. Only available through the Select Address dialog at this time. --- .../addrbook/resources/content/addressbook.js | 6 +++-- .../addrbook/resources/content/editcard.js | 23 +++++++++++++++++++ .../addrbook/resources/content/editcard.xul | 1 + .../resources/content/selectaddress.js | 17 ++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/mailnews/addrbook/resources/content/addressbook.js b/mailnews/addrbook/resources/content/addressbook.js index 690b5e5d8a70..67beda9aca71 100644 --- a/mailnews/addrbook/resources/content/addressbook.js +++ b/mailnews/addrbook/resources/content/addressbook.js @@ -7,11 +7,13 @@ function AbNewCard() } -function AbEditCard() +function AbEditCard(card) { var dialog = window.openDialog("chrome://addressbook/content/editcardDialog.xul", "abEditCard", - "chrome"); + "chrome", + {card:card}); + return dialog; } diff --git a/mailnews/addrbook/resources/content/editcard.js b/mailnews/addrbook/resources/content/editcard.js index cc8706dc4427..eddb1b4add52 100644 --- a/mailnews/addrbook/resources/content/editcard.js +++ b/mailnews/addrbook/resources/content/editcard.js @@ -1,3 +1,21 @@ +var card; + +function OnLoadEditCard() +{ + // look in arguments[0] for card + if (window.arguments && window.arguments[0]) + { + if ( window.arguments[0].card ) + { + // keep card in global for later + top.card = window.arguments[0].card; + + GetCardValues(top.card, frames["browser.editcard"].document) + } + } +} + + function NewCardOKButton() { var cardproperty = Components.classes["component://netscape/addressbook/cardproperty"].createInstance(); @@ -17,6 +35,11 @@ function NewCardOKButton() function EditCardOKButton() { + SetCardValues(top.card, frames["browser.editcard"].document); + + // Need to commit changes here Candice. + + top.window.close(); } diff --git a/mailnews/addrbook/resources/content/editcard.xul b/mailnews/addrbook/resources/content/editcard.xul index c1c2e0a062b4..009f58dfe1f1 100644 --- a/mailnews/addrbook/resources/content/editcard.xul +++ b/mailnews/addrbook/resources/content/editcard.xul @@ -53,6 +53,7 @@ diff --git a/mailnews/addrbook/resources/content/selectaddress.js b/mailnews/addrbook/resources/content/selectaddress.js index 161f2dec187a..2ae04b085923 100644 --- a/mailnews/addrbook/resources/content/selectaddress.js +++ b/mailnews/addrbook/resources/content/selectaddress.js @@ -44,6 +44,23 @@ function SelectAddressCancelButton() top.window.close(); } +function SelectAddressEditButton() +{ + var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); + rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); + + var resultsDoc = frames["browser.selAddrResultPane"].document; + var selArray = resultsDoc.getElementsByAttribute('selected', 'true'); + + if ( selArray && selArray.length == 1 ) + { + var uri = selArray[0].getAttribute('id'); + var card = rdf.GetResource(uri); + card = card.QueryInterface(Components.interfaces.nsIAbCard); + AbEditCard(card); + } +} + function AddSelectedAddressesIntoBucket(prefix) { var item, uri, rdf, cardResource, card, address;