Closed
Bug 292313
Opened 20 years ago
Closed 20 years ago
Address book listener onItemPropertyChanged() is broken
Categories
(Thunderbird :: Address Book, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: yvan, Assigned: mscott)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050406 Firefox/1.0.2 (Debian package 1.0.2-3)
Build Identifier:
When the onItemPropertyChanged(item, property, oldValue, newValue) function is
called in an nsIAbListener (added to a nsIAddrBookSession), the three last
parameters are always "nsnull", insted of containing the expected informations.
Reproducible: Always
Steps to Reproduce:
Put the following code into a javascript file linked to a XUL file :
// gets the address book session and add a listener
var session =
Commponents.classes["@mozilla.org/addressbook/services/session;1"].getService().QueryInterface(Components.interfaces.nsIAddrBookSession);
// address book listener
var listener =
{
onItemAdded : function(parentDir, item)
{
},
onItemPropertyChanged : function(item, property, oldValue, newValue)
{
alert("onItemPropertyChanged(" + item + ", " + property + ", " + oldValue +
", " + newValue + ")");
},
onItemRemoved : function(parentDir, item)
{
}
};
session.addAddressBookListener(listener, Components.interfaces.nsIAbListener.all);
Actual Results:
When editing a contact in the address book, an alert is shown and the three last
parameters are "nsnull".
Expected Results:
It should have shown the property which was actually changed, along with the old
value and the new one.
Comment 1•20 years ago
|
||
It's not broken, it's just that those three parameters are not used in most cases. See http://lxr.mozilla.org/seamonkey/source/mailnews/addrbook/src/nsAbMDBDirectory.cpp#195 and http://lxr.mozilla.org/seamonkey/source/mailnews/addrbook/src/nsAbMDBDirectory.cpp#894 item may be a list (address book or mailing list) or a card. In the second case where it is a address book we are renaming, we must update our rdf resources and hence sending round the three extra parameters. For cards, we don't have rdf resources, and we would not be able to fit all the properties into parameters, which would mean we would have to send round multiple updates which I assume we don't want to do as we don't need to, hence we just send round the updated card in the item parameter.
Comment 2•20 years ago
|
||
Closing as INVALID based on my previous comments, I've raised bug 292350 to get the documentation for that interface updated.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 3•20 years ago
|
||
Ok, I was looking at the source and wondering if that behavior was voluntary or not. Anyway, thanks for your quick answer. You're right, in most cases, we probably don't want to get multiple events, but it would have been useful to me. Blah, guess I'll have to do it another way.
You need to log in
before you can comment on or make changes to this bug.
Description
•