From 18c2c1871f78d5bdada425d38bce546578b2d75f Mon Sep 17 00:00:00 2001 From: michael starke Date: Wed, 27 Sep 2017 16:32:44 +0200 Subject: [PATCH] code style --- MacPass/MPOutlineViewController.m | 14 +++++++------- MacPass/MPSavePanelAccessoryViewController.m | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/MacPass/MPOutlineViewController.m b/MacPass/MPOutlineViewController.m index a51b4cc4..7e2f4ee1 100644 --- a/MacPass/MPOutlineViewController.m +++ b/MacPass/MPOutlineViewController.m @@ -269,12 +269,12 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; NSString *iconImageKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(iconImage))]; NSString *titleKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(title))]; - [[view imageView] bind:NSValueBinding toObject:item withKeyPath:iconImageKeyPath options:nil]; - [[view textField] bind:NSValueBinding toObject:item withKeyPath:titleKeyPath options:nil]; + [view.imageView bind:NSValueBinding toObject:item withKeyPath:iconImageKeyPath options:nil]; + [view.textField bind:NSValueBinding toObject:item withKeyPath:titleKeyPath options:nil]; - NSString *entriesCountKeyPath = [[NSString alloc] initWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(entries)), @"@count"]; - [[view textField] bind:NSStringFromSelector(@selector(count)) toObject:item withKeyPath:entriesCountKeyPath options:nil]; + NSString *entriesCountKeyPath = [[NSString alloc] initWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(mutableEntries)), @"@count"]; + [view.textField bind:NSStringFromSelector(@selector(count)) toObject:item withKeyPath:entriesCountKeyPath options:nil]; } return view; @@ -309,7 +309,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; } } - (void)outlineViewItemDidCollapse:(NSNotification *)notification { - NSDictionary *userInfo = [notification userInfo]; + NSDictionary *userInfo = notification.userInfo; id item = userInfo[NSStringFromClass([NSObject class])]; id representedObject = [item representedObject]; if([representedObject isKindOfClass:[KPKGroup class]]) { @@ -328,7 +328,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; #pragma mark Validation - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - MPDocument *document = [[self windowController] document]; + MPDocument *document = self.windowController.document; if(![document validateUserInterfaceItem:menuItem]) { return NO; } @@ -338,7 +338,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; - (NSMenu *)_contextMenu { NSMenu *menu = [[NSMenu alloc] init]; - [menu setDelegate:_menuDelegate]; + menu.delegate = _menuDelegate; return menu; } diff --git a/MacPass/MPSavePanelAccessoryViewController.m b/MacPass/MPSavePanelAccessoryViewController.m index 30102b32..2f4835c0 100644 --- a/MacPass/MPSavePanelAccessoryViewController.m +++ b/MacPass/MPSavePanelAccessoryViewController.m @@ -96,7 +96,9 @@ - (void)_updateNote { NSString *uti = self.fileTypePopupButton.selectedItem.representedObject; - BOOL showInfoText = [uti isEqualToString:MPKdbDocumentUTI] && (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx) && [self.document.fileType isEqualToString:MPKdbxDocumentUTI]; + BOOL showInfoText = ([uti isEqualToString:MPKdbDocumentUTI] && + (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx) && + [self.document.fileType isEqualToString:MPKdbxDocumentUTI]); self.infoTextField.hidden = !showInfoText; }