Files
MacPass/MacPass/KdbGroup+MPAdditions.m
2013-07-09 21:58:28 +02:00

38 lines
809 B
Objective-C

//
// KdbGroup+MPAdditions.m
// MacPass
//
// Created by Michael Starke on 01.07.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KdbGroup+MPAdditions.h"
#import "KdbGroup+KVOAdditions.h"
#import "MPIconHelper.h"
@implementation KdbGroup (MPAdditions)
- (NSImage *)icon {
return [MPIconHelper icon:(MPIconType)self.image];
}
- (KdbGroup *)root {
if(self.parent) {
return [self.parent root];
}
return self;
}
- (void)clear {
for(KdbGroup *group in self.groups) {
[group clear];
NSUInteger index = [self.groups indexOfObject:group];
[self removeObjectFromGroupsAtIndex:index];
}
for(KdbEntry *entry in self.entries) {
NSUInteger index = [self.entries indexOfObject:entry];
[self removeObjectFromEntriesAtIndex:index];
}
}
@end