using property syntax

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-10-07 15:54:17 +02:00
parent 1f18b2c03d
commit cd925a81f3
2 changed files with 15 additions and 15 deletions

View File

@@ -494,11 +494,11 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
}
- (void)deleteNode:(KPKNode *)node {
if([node asGroup]) {
[self deleteGroup:[node asGroup]];
if(node.asGroup) {
[self deleteGroup:node.asGroup];
}
else if([node asEntry]) {
[self deleteEntry:[node asEntry]];
else if(node.asEntry) {
[self deleteEntry:node.asEntry];
}
}
@@ -554,7 +554,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
}
- (void)_presentTrashAlertForItem:(KPKNode *)node {
KPKEntry *entry = [node asEntry];
KPKEntry *entry = node.asEntry;
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSWarningAlertStyle];
@@ -574,10 +574,10 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
if(returnCode == NSAlertFirstButtonReturn) {
KPKNode *node = (__bridge KPKNode *)(contextInfo);
/* No undo on this operation */
for( KPKEntry *entry in [[node asGroup] childEntries]) {
for( KPKEntry *entry in node.asGroup.childEntries) {
[node.undoManager removeAllActionsWithTarget:entry];
}
for(KPKGroup *group in [[node asGroup] childGroups]) {
for(KPKGroup *group in node.asGroup.childGroups) {
[node.undoManager removeAllActionsWithTarget:group];
}
[node remove];
@@ -640,10 +640,10 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
KPKGroup *targetGroup = [groupResolver currentTargetGroup];
/*
if([targetNode asGroup]) {
if(targetNode.asGroup) {
NSLog(@"targetNode:%@", ((KPKGroup *)targetNode).name);
}
else if([targetNode asEntry]) {
else if(targetNode.asEntry) {
NSLog(@"targetNode:%@", ((KPKEntry *)targetNode).title);
}

View File

@@ -650,21 +650,21 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
#pragma mark Actions
- (void)copyPassword:(id)sender {
KPKEntry *selectedEntry = [[self currentTargetNode] asEntry];
KPKEntry *selectedEntry = [self currentTargetNode].asEntry;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.password finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoPassword name:nil];
}
}
- (void)copyUsername:(id)sender {
KPKEntry *selectedEntry = [[self currentTargetNode] asEntry];
KPKEntry *selectedEntry = [self currentTargetNode].asEntry;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.username finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoUsername name:nil];
}
}
- (void)copyCustomAttribute:(id)sender {
KPKEntry *selectedEntry = [[self currentTargetNode] asEntry];
KPKEntry *selectedEntry = [self currentTargetNode].asEntry;
if(selectedEntry && [selectedEntry isKindOfClass:[KPKEntry class]]) {
NSUInteger index = [sender tag];
NSAssert((index >= 0) && (index < [selectedEntry.customAttributes count]), @"Index for custom field needs to be valid");
@@ -674,14 +674,14 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
}
- (void)copyURL:(id)sender {
KPKEntry *selectedEntry = [[self currentTargetNode] asEntry];
KPKEntry *selectedEntry = [self currentTargetNode].asEntry;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.url finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoURL name:nil];
}
}
- (void)openURL:(id)sender {
KPKEntry *selectedEntry = [[self currentTargetNode] asEntry];
KPKEntry *selectedEntry = [self currentTargetNode].asEntry;
NSString *expandedURL = [selectedEntry.url finalValueForEntry:selectedEntry];
if(expandedURL.length > 0) {
NSURL *webURL = [NSURL URLWithString:[expandedURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
@@ -707,7 +707,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
}
- (void)delete:(id)sender {
KPKEntry *entry = [[self currentTargetNode] asEntry];
KPKEntry *entry = [self currentTargetNode].asEntry;
if(!entry) {
return;
}