More use of properties. Fixed wrongfull controller bindings

This commit is contained in:
michael starke
2015-04-05 21:15:48 +02:00
parent 6c4daebb33
commit 580787353e
5 changed files with 26 additions and 29 deletions

View File

@@ -368,8 +368,8 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
if(!document.selectedGroup && !document.hasSearch) {
/* no group selection out of search is wrong */
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController setContent:nil];
//[self.entryArrayController unbind:NSContentArrayBinding];
self.entryArrayController.content = nil;
return;
}
/*
@@ -387,7 +387,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
return; // we are showing the correct object right now.
}
}
[self.entryArrayController bind:NSContentArrayBinding toObject:document.selectedGroup withKeyPath:NSStringFromSelector(@selector(entries)) options:nil];
self.entryArrayController.content = document.selectedGroup.entries;
}
[self _updateContextBar];
}
@@ -422,8 +422,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
NSArray *result = [notification userInfo][kMPDocumentSearchResultsKey];
NSAssert(result != nil, @"Resutls should never be nil");
self.filteredEntries = result;
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController setContent:self.filteredEntries];
self.entryArrayController.content = self.filteredEntries;
[[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier] setHidden:NO];
}
@@ -433,8 +432,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
MPDocument *document = [[self windowController] document];
document.selectedItem = document.selectedGroup;
if( nil == document.selectedItem && nil == document.selectedGroup ) {
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController setContent:nil];
self.entryArrayController.content = nil;
}
[self _updateContextBar];
}
@@ -456,7 +454,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
[self _showContextBar];
/* TODO: Show modification date column if not present? */
MPDocument *document = [[self windowController] document];
[self.entryArrayController bind:NSContentArrayBinding toObject:document.selectedEntry withKeyPath:NSStringFromSelector(@selector(history)) options:nil];
self.entryArrayController.content = document.selectedEntry.history;
}
- (void)_didExitHistory:(NSNotification *)notification {