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)
SeaMonkey
MailNews: Address Book & Contacts
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: scottputterman, Assigned: chuang)
References
Details
(Whiteboard: [nsbeta1+]Have Fix)
Attachments
(7 files)
|
5.38 KB,
patch
|
Details | Diff | Splinter Review | |
|
536 bytes,
patch
|
Details | Diff | Splinter Review | |
|
11.40 KB,
patch
|
Details | Diff | Splinter Review | |
|
9.31 KB,
patch
|
Details | Diff | Splinter Review | |
|
598 bytes,
patch
|
Details | Diff | Splinter Review | |
|
9.32 KB,
patch
|
Details | Diff | Splinter Review | |
|
9.37 KB,
patch
|
Details | Diff | Splinter Review |
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.
Sounds like a good idea to me too. Similar to how we show the number of messages
in the status bar for mail.
Comment 2•25 years ago
|
||
Without this info, it's hard to tell how to use the pref for max # of entries in
the collected address book.
Updated•25 years ago
|
Add nsbeta1 keyword. This is useful for helping testing all the problems with
collected address book.
Status: NEW → ASSIGNED
Keywords: nsbeta1
| Reporter | ||
Updated•25 years ago
|
Whiteboard: [nsbeta1+]
| Reporter | ||
Updated•25 years ago
|
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.
Comment 9•25 years ago
|
||
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.
| Assignee | ||
Comment 10•25 years ago
|
||
Well, I'll re-work it after I got the absync to work.
| Assignee | ||
Comment 11•25 years ago
|
||
Comment 12•25 years ago
|
||
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;
}
| Assignee | ||
Comment 13•25 years ago
|
||
I'll make a new diff with the change.
| Assignee | ||
Comment 14•25 years ago
|
||
| Assignee | ||
Comment 15•25 years ago
|
||
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.
Comment 16•25 years ago
|
||
whoops, I missed something:
+
PRUint32 getTotalCards(in string URI);
that should be "unsigned long", since it is in the .idl
| Assignee | ||
Comment 17•25 years ago
|
||
Comment 18•25 years ago
|
||
can you attach the complete, final patch?
once you get a review, I'll be able to give a quick sr=.
| Assignee | ||
Comment 19•25 years ago
|
||
Comment 20•25 years ago
|
||
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.
| Assignee | ||
Comment 21•25 years ago
|
||
Comment 22•25 years ago
|
||
R=ducarroz
Comment 23•25 years ago
|
||
sr=sspitzer
+ if (!count)
+ return NS_ERROR_NULL_POINTER;
feel free the following macro, to simplify your code:
NS_ENSURE_ARG_POINTER(count);
| Reporter | ||
Updated•25 years ago
|
Whiteboard: [nsbeta1+] → [nsbeta1+]Have Fix
| Assignee | ||
Comment 24•25 years ago
|
||
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
Comment 25•25 years ago
|
||
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
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•