Extracted context bar for trash, history and filter browsing. Some regressions in focus handling were introduced. History tab will go away as this will be incorporated in the entry comparable to searching. Code cleanup. Moved copying to KeePassKit

This commit is contained in:
michael starke
2013-12-18 02:29:25 +01:00
parent 21355101ed
commit 92d963a9ef
27 changed files with 800 additions and 577 deletions

View File

@@ -24,13 +24,15 @@
typedef NS_ENUM(NSUInteger, MPEntryTab) {
MPEntryTabGeneral,
MPEntryTabFiles,
MPEntryTabCustomFields
MPEntryTabCustomFields,
MPEntryTabHistory
};
@interface MPEntryInspectorViewController () {
@private
NSArrayController *_attachmentsController;
NSArrayController *_customFieldsController;
NSArrayController *_historyController;
MPAttachmentTableViewDelegate *_attachmentTableDelegate;
MPCustomFieldTableViewDelegate *_customFieldTableDelegate;
MPAttachmentTableDataSource *_attachmentDataSource;
@@ -57,6 +59,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
_showPassword = NO;
_attachmentsController = [[NSArrayController alloc] init];
_customFieldsController = [[NSArrayController alloc] init];
_historyController = [[NSArrayController alloc] init];
_attachmentTableDelegate = [[MPAttachmentTableViewDelegate alloc] init];
_customFieldTableDelegate = [[MPCustomFieldTableViewDelegate alloc] init];
_attachmentDataSource = [[MPAttachmentTableDataSource alloc] init];
@@ -105,7 +108,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[[self view] layoutSubtreeIfNeeded];
[_infoTabControl bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil];
[_tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil];
[_tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil];
/* Set background to clearcolor so we can draw in the scrollview */
[_attachmentTableView setBackgroundColor:[NSColor clearColor]];
@@ -118,6 +121,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[_customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:@"arrangedObjects" options:nil];
[_customFieldsTableView setDelegate:_customFieldTableDelegate];
[_historyTableView bind:NSContentBinding toObject:_historyController withKeyPath:@"arrangedObjects" options:nil];
[self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil];
[self.togglePassword bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil];
@@ -224,6 +228,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[self _bindEntry];
[self _bindAttachments];
[self _bindCustomFields];
[self _bindHistory];
}
- (void)_bindEntry {
@@ -261,4 +266,14 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"customAttributes" options:nil];
}
- (void)_bindHistory {
if(self.entry) {
[_historyController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"history" options:nil];
}
else if([_historyController content] != nil) {
[_historyController unbind:NSContentArrayBinding];
[_historyController setContent:nil];
}
}
@end