Closed
Bug 432142
Opened 17 years ago
Closed 17 years ago
addCard followed by setCardValue appears to be broken (on restart)
Categories
(Thunderbird :: Address Book, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: mozilla.org, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Build Identifier: version 3.0a1pre (2008050103)
A card is created, then setCardValue() is called to set it's properties.
The card appears to be correct in the addressbook UI.
Restart thunderbird, open the addressbook and all the fields of your new card are empty.
This shouldn't happen - if a card appears in the UI, restarting Thunderbird shouldn't make it's fields go away.
Reproducible: Always
Steps to Reproduce:
var uri = "moz-abmdbdirectory://abook.mab";
var properties = { "DisplayName": "BlahDisplayName",
"PrimaryEmail": "BlahPrimarEmail@example.com" };
var dir = Components.classes["@mozilla.org/abmanager;1"].
getService(Components.interfaces.nsIAbManager).
getDirectory(uri);
var abCard;
abCard = Components.classes["@mozilla.org/addressbook/cardproperty;1"].
createInstance(Components.interfaces.nsIAbCard);
abCard = dir.addCard(abCard);
for (key in properties)
abCard.setCardValue(key, properties[key]);
Actual Results:
In the addressbook UI, DisplayName and PrimaryEmail of the new card have the values you'd expect.
Restarting Thunderbird, an opening the addressbook UI, there's a completely empty card.
Expected Results:
Expected the card to be as it was before the restart.
If in the code above, the order of addCard() and setCardValue() is reversed, the problem doesn't show up, ie the card appears as you'd expect after restart.
Comment 1•17 years ago
|
||
I think you'll find that what you need to do is after you've called setCardValue that you then call nsIAbDirectory::modifyCard - that will actually do the updates to the database.
So I think this is invalid, but we need to add some documentation somewhere to document this process.
Yep, modifyCard() does make the abCard.setValueValue() calls persist across restarts - thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•