Closed Bug 64937 Opened 25 years ago Closed 25 years ago

Display number of entries in an address book

Categories

(SeaMonkey :: MailNews: Address Book & Contacts, enhancement, P3)

enhancement

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: scottputterman, Assigned: chuang)

References

Details

(Whiteboard: [nsbeta1+]Have Fix)

Attachments

(7 files)

It would be useful to know how many entries exist in the selected address book. Phil suggested putting it on the status bar like we do in mail and that seems like a good idea to me.
QA Contact: esther → pmock
Sounds like a good idea to me too. Similar to how we show the number of messages in the status bar for mail.
Without this info, it's hard to tell how to use the pref for max # of entries in the collected address book.
Severity: normal → enhancement
Depends on: 26629
OS: Windows NT → All
Hardware: PC → All
Qa-assigned-to myself.
QA Contact: pmock → fenella
Add nsbeta1 keyword. This is useful for helping testing all the problems with collected address book.
Status: NEW → ASSIGNED
Keywords: nsbeta1
Whiteboard: [nsbeta1+]
Priority: -- → P3
Target Milestone: --- → mozilla0.9.1
I have fix for display entries in status bar using a hidden pref "addressbook.showTotalCards" when changing address book and delete card. Display the correct number when adding a card to address book is more difficult to do. Since this bug is a P3 bug. I'll leave the fix as is for now.
Got r=ssu.
this looks wrong. you shouldn't have to force the FE to ask the BE what the total count is. you should be using RDF. we should have a address book listener (in js) that get's notified on count changes and then updates the ui. that will get it work for all cases, including add card. see msgMail3PaneWindow.js for how we do this in the 3 pane.
Well, I'll re-work it after I got the absync to work.
next time, please provide a diff using "cvs diff -uw" to avoid the whitespace diffs. it's good to fix whitespace, but it makes the review harder. comments: seems ok. on any change (item added or deleted) you call UpdateStatusCardCounts() which goes and gets the count from the db and then pokes the UI. you also this at startup to display the proper initial count. I was hoping there was a way to be a nsIAddrDBListener doesn't have something for listening when the count changes, so you could listen right on the db. +NS_IMETHODIMP nsAddressBook::GetTotalCards(const char *URI, PRUint32 *count) +{ + nsresult rv = NS_OK; + *count = 0; + if (PL_strstr(URI, ".mab")) why do you have to do that? (also, that doesn't check if the string ends with .mab, just if it contains a ".mab") if it wasn't a .mab url, won't GetAbDatabaseFromURI() fail? + { + nsCOMPtr<nsIAddrDatabase> database; + rv = GetAbDatabaseFromURI(URI, getter_AddRefs(database)); + if (NS_SUCCEEDED(rv) && database) + { + PRUint32 cardCount = 0; + rv = database->GetCardCount(&cardCount); + if (NS_SUCCEEDED(rv)) + *count = cardCount; you don't need that extra PRUint32. assoming GetAbDatabseFromURI() will return failure properly, how about something like this NS_IMETHODIMP nsAddressBook::GetTotalCards(const char *URI, PRUint32 *count) { nsCOMPtr<nsIAddrDatabase> database; nsresult rv = GetAbDatabaseFromURI(URI, getter_AddRefs(database)); NS_ENSURE_SUCCESS(rv,rv); rv = database->GetCardCount(count); NS_ENSURE_SUCCESS(rv,rv); return rv; }
I'll make a new diff with the change.
The new patch has the change for nsAddressBook::GetTotalCards(). GetAbDatabaseFromURI() used in several places in address book, it should do the right thing so far. I also add address book name in the status string (it will say "Total Cards in Personal Address Book: 10") to reduce the confusion for mailing list since we are not showing card count in a mailing list. It should be a separate bug if we think it's important to have it.
whoops, I missed something: + PRUint32 getTotalCards(in string URI); that should be "unsigned long", since it is in the .idl
can you attach the complete, final patch? once you get a review, I'll be able to give a quick sr=.
Attached patch Final patch — — Splinter Review
few comment: 1) Localization issue: +# status bar stuff +totalCardStatus=Total Cards in %S: %S You should add extra comment for Localization folks to explain them to not translate %S and by what they will be replaced, something like: ## LOCALIZATION NOTE (totalCardStatus): first %S is addressbook name, second %S is is the count. But with this approch, you don't give the flexibility to put the count before the name. Maybe we need that for some language. Look in msgcompose for "SaveDialogMsg" to see how we solve that 2) +NS_IMETHODIMP nsAddressBook::GetTotalCards(const char *URI, PRUint32 *count) in this function, you are not checking if count is non-null! Also, it would be great to initialize count to 0, just in case the rest of the function failed and the caller don't check the returned error.
R=ducarroz
sr=sspitzer + if (!count) + return NS_ERROR_NULL_POINTER; feel free the following macro, to simplify your code: NS_ENSURE_ARG_POINTER(count);
Whiteboard: [nsbeta1+] → [nsbeta1+]Have Fix
Fix checked in. As I mentioned, the fix won't show the card counts for selected mailing list.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Linux (2001-05-09-08 trunk) Win32 (2001-05-09-06 trunk) Mac (2001-05-09-08 trunk) Verified that it is fixed.
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: