Closed Bug 455240 Opened 11 years ago Closed 11 years ago

Address book card preview pane doesn't update for card changes via external interfaces (where notifications exist, e.g. OS X)

Categories

(MailNews Core :: Address Book, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0a3

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file, 2 obsolete files)

1) Select a card in Thunderbird's Address Book which is in an OS X address book.
2) Go into the OS X address book and update the card.
3) Notice that the card preview pane doesn't update.

The problem is the way we're doing the notifications. Should be very simple to fix.

At the moment when we call the edit card or edit list dialogs, they are called with a callback which equates to UpdateCardView, which is why this works internally.

We have proper methods for doing this, in particular we already have a listener in addressbook.js which listens for some events.

We should just drop the edit card/list callbacks and update the card view in the listener in addressbook.js if the card matches the selected card.
Attached patch The fix (obsolete) — Splinter Review
This patch means we update the card view pane whenever the changed card matches the one selected, hence we can drop the "manual" callbacks that are used to update the cards.
Attachment #338550 - Flags: superreview?(bienvenu)
Attachment #338550 - Flags: review?(neil)
I'm tempted to suggest that this should be done in nsAbView - it already has to update its internal state for card edits and it should be trivial to check that the card it updated was the single selection and if so poke the UI.
(In reply to comment #2)
> I'm tempted to suggest that this should be done in nsAbView - it already has to
> update its internal state for card edits and it should be trivial to check that
> the card it updated was the single selection and if so poke the UI.

How would you be thinking of poking the UI? Not everything that uses nsAbView needs an update, so the only way I can think of is to use a listener/callback combination which is what I'm effectively doing here anyway.
We already have an nsIAbViewListener. For instance, when you change the first/last name pref then the nsAbView calls its onSelectionChanged method.
Attached patch The fix v2 (obsolete) — Splinter Review
Better patch, based on Neil's comments, this patch simply notifies the nsIAbViewListener of a selection changed update (when OnItemPropertyChanged is called) and that refreshes the display.
Attachment #338550 - Attachment is obsolete: true
Attachment #339059 - Flags: superreview?(bienvenu)
Attachment #339059 - Flags: review?(neil)
Attachment #338550 - Flags: superreview?(bienvenu)
Attachment #338550 - Flags: review?(neil)
Attached patch The fix v3Splinter Review
Limit updates to only when the card was/is selected.
Attachment #339059 - Attachment is obsolete: true
Attachment #339063 - Flags: superreview?(bienvenu)
Attachment #339063 - Flags: review?(neil)
Attachment #339059 - Flags: superreview?(bienvenu)
Attachment #339059 - Flags: review?(neil)
Comment on attachment 339063 [details] [diff] [review]
The fix v3

This also works when editing the contact from the address book sidebar of course :-)
Attachment #339063 - Flags: review?(neil) → review+
Attachment #339063 - Flags: superreview?(bienvenu) → superreview+
Checked in, changeset id: 360:6fb2a576f786
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 456415
You need to log in before you can comment on or make changes to this bug.