From ae38cdce325ccf75a7784cd64b7adb233454a346 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sat, 22 Feb 2014 11:39:28 +0100 Subject: [PATCH] Minor change to codestyle --- MacPass/MPEntryViewController.m | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index caf2aba4..9eced8e6 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -467,24 +467,23 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell"; return NO; } - // CS: don't know how to iterate through KPKEntry properties to check for blanks so just check the declared properties KPKEntry *targetEntry = [self _clickedOrSelectedEntry]; MPActionType actionType = [MPActionHelper typeForAction:[menuItem action]]; - if (([[targetEntry username] length] == 0) && (actionType == MPActionCopyUsername)) { - return NO; + switch (actionType) { + case MPActionCopyUsername: + return [targetEntry.username length] > 0; + + case MPActionCopyPassword: + return [targetEntry.password length] > 0; + + case MPActionCopyURL: + case MPActionOpenURL: + return [targetEntry.url length] > 0; + + default: + return YES; } - - if (([[targetEntry password] length] == 0) && (actionType == MPActionCopyPassword)) { - return NO; - } - - if (([[targetEntry url] length] == 0) && (actionType == MPActionCopyURL || actionType == MPActionOpenURL)) { - return NO; - } - - return YES; - /* TODO handle _clickedOrSlectedEnty */ } #pragma mark ContextMenu