Exired entries and groups now get updates at runtime

This commit is contained in:
michael starke
2014-08-26 18:58:27 +02:00
parent 9e2345bcd7
commit f322c44fdf
5 changed files with 27 additions and 15 deletions

View File

@@ -18,6 +18,8 @@
#import "MPOutlineContextMenuDelegate.h"
#import "KPKTree.h"
#import "KPKNode.h"
#import "KPKTimeInfo.h"
#import "KPKGroup.h"
#import "KPKNode+IconImage.h"
#import "KPKMetaData.h"
@@ -25,6 +27,8 @@
#import "HNHGradientView.h"
#define EXPIRED_GROUP_REFRESH_SECONDS 60
NSString *const MPOutlineViewDidChangeGroupSelection = @"com.macpass.MPOutlineViewDidChangeGroupSelection";
NSString *const _MPOutlineViewDataViewIdentifier = @"DataCell";
@@ -104,6 +108,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
[self bind:NSStringFromSelector(@selector(databaseNameWrapper)) toObject:document.tree.metaData withKeyPath:NSStringFromSelector(@selector(databaseName)) options:nil];
[_outlineView setDataSource:self.datasource];
_bindingEstablished = YES;
[self _updateExpirationDisplay];
}
NSTreeNode *node = [_outlineView itemAtRow:0];
[self _expandItems:node];
@@ -301,4 +307,13 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
return [node isKindOfClass:[KPKTree class]];
}
- (void)_updateExpirationDisplay {
MPDocument *document = [[self windowController] document];
[document.root.timeInfo isExpired];
[[document.tree allGroups] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[[obj timeInfo] isExpired];
}];
[self performSelector:@selector(_updateExpirationDisplay) withObject:nil afterDelay:EXPIRED_GROUP_REFRESH_SECONDS];
}
@end