Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(694)

Unified Diff: Source/OutlineViewItem.m

Issue 166069: Fix assumption that mailboxes have either child directories or messages but not both. Base URL: http://google-email-uploader-mac.googlecode.com/svn/trunk/
Patch Set: Created 15 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/OutlineViewItem.m
===================================================================
--- Source/OutlineViewItem.m (revision 8)
+++ Source/OutlineViewItem.m (working copy)
@@ -53,6 +53,10 @@
str = [str stringByAppendingFormat:@" (%u child items)", [children_ count]];
}
+ if (numberOfMessages_ > 0) {
+ str = [str stringByAppendingFormat:@" (%u msgs)", numberOfMessages_];
+ }
+
return str;
}
@@ -148,14 +152,15 @@
}
- (unsigned int)recursiveNumberOfMessages {
-
+ unsigned int numberOfOwnMessages = [self numberOfMessages];
if ([children_ count] == 0) {
// we have no children
- return [self numberOfMessages];
+ return numberOfOwnMessages;
}
NSNumber *sum = [children_ valueForKeyPath:@"@sum.recursiveNumberOfMessages"];
- return [sum unsignedIntValue];
+ unsigned int totalMessages = [sum unsignedIntValue] + numberOfOwnMessages;
+ return totalMessages;
}
- (unsigned int)recursiveNumberOfCheckedMessages {
@@ -165,14 +170,16 @@
return 0;
}
+ unsigned int numberOfOwnMessages = [self numberOfMessages];
if ([children_ count] == 0) {
- // we have no children, so we may contain messages ourself
- return [self numberOfMessages];
+ // we have no children; we may contain messages ourself
+ return numberOfOwnMessages;
}
// add up the checked messages in the children
NSNumber *sum = [children_ valueForKeyPath:@"@sum.recursiveNumberOfCheckedMessages"];
- return [sum unsignedIntValue];
+ unsigned int totalMessages = [sum unsignedIntValue] + numberOfOwnMessages;
+ return totalMessages;
}
@end
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b