use isEqualToString instead of ==

This commit is contained in:
Michael Starke
2019-07-12 11:26:11 +02:00
parent 52720a79d4
commit 02840548ba

View File

@@ -686,7 +686,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
customizationLabel:NSLocalizedString(@"TOUCHBAR_SEARCH","Touchbar button label for searching the database")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_SEARCH","Touchbar button label for searching the database")];
} }
if(identifier == touchBarEditPopoverIdentifier) { if([identifier isEqualToString:touchBarEditPopoverIdentifier]) {
NSTouchBar *secondaryTouchBar = [[NSTouchBar alloc] init]; NSTouchBar *secondaryTouchBar = [[NSTouchBar alloc] init];
secondaryTouchBar.delegate = self; secondaryTouchBar.delegate = self;
secondaryTouchBar.defaultItemIdentifiers = @[secondaryTouchBarNewEntryIdentifier, secondaryTouchBarNewGroupIdentifier, secondaryTouchBarDeleteIdentifier]; secondaryTouchBar.defaultItemIdentifiers = @[secondaryTouchBarNewEntryIdentifier, secondaryTouchBarNewGroupIdentifier, secondaryTouchBarDeleteIdentifier];
@@ -696,7 +696,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
customizationLabel:NSLocalizedString(@"TOUCHBAR_EDIT","Touchbar button label for opening the popover to edit")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_EDIT","Touchbar button label for opening the popover to edit")];
} }
if(identifier == touchBarCopyUsernameIdentifier) { if([identifier isEqualToString:touchBarCopyUsernameIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_COPY_USERNAME","Touchbar button label for copying the username") return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_COPY_USERNAME","Touchbar button label for copying the username")
identifier:touchBarCopyUsernameIdentifier identifier:touchBarCopyUsernameIdentifier
target:self target:self
@@ -704,7 +704,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
customizationLabel:NSLocalizedString(@"TOUCHBAR_COPY_USERNAME","Touchbar button label for copying the username")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_COPY_USERNAME","Touchbar button label for copying the username")];
} }
if (identifier == touchBarCopyPasswordIdentifier) { if([identifier isEqualToString:touchBarCopyPasswordIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_COPY_PASSWORD","Touchbar button label for copying the password") return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_COPY_PASSWORD","Touchbar button label for copying the password")
identifier:touchBarCopyPasswordIdentifier identifier:touchBarCopyPasswordIdentifier
target:self target:self
@@ -712,14 +712,14 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
customizationLabel:NSLocalizedString(@"TOUCHBAR_COPY_PASSWORD","Touchbar button label for copying the password")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_COPY_PASSWORD","Touchbar button label for copying the password")];
} }
if (identifier == touchBarPerformAutotypeIdentifier) { if([identifier isEqualToString:touchBarPerformAutotypeIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_PERFORM_AUTOTYPE","Touchbar button label for performing autotype") return [MPTouchBarButtonCreator touchBarButtonWithTitle:NSLocalizedString(@"TOUCHBAR_PERFORM_AUTOTYPE","Touchbar button label for performing autotype")
identifier:touchBarPerformAutotypeIdentifier identifier:touchBarPerformAutotypeIdentifier
target:self target:self
selector:@selector(performAutotypeForEntry:) selector:@selector(performAutotypeForEntry:)
customizationLabel:NSLocalizedString(@"TOUCHBAR_PERFORM_AUTOTYPE","Touchbar button label for performing autotype")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_PERFORM_AUTOTYPE","Touchbar button label for performing autotype")];
} }
else if (identifier == touchBarLockIdentifier) { if([identifier isEqualToString:touchBarLockIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithImage:[NSImage imageNamed:NSImageNameLockUnlockedTemplate] return [MPTouchBarButtonCreator touchBarButtonWithImage:[NSImage imageNamed:NSImageNameLockUnlockedTemplate]
identifier:touchBarLockIdentifier identifier:touchBarLockIdentifier
target:self target:self
@@ -727,7 +727,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
customizationLabel:NSLocalizedString(@"TOUCHBAR_LOCK_DATABASE","Touchbar button label for locking the database")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_LOCK_DATABASE","Touchbar button label for locking the database")];
} }
#pragma mark secondary/popover touchbar elements #pragma mark secondary/popover touchbar elements
else if(identifier == secondaryTouchBarNewEntryIdentifier) { if([identifier isEqualToString:secondaryTouchBarNewEntryIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImage:NSLocalizedString(@"TOUCHBAR_NEW_ENTRY","Touchbar button label for creating a new item") return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImage:NSLocalizedString(@"TOUCHBAR_NEW_ENTRY","Touchbar button label for creating a new item")
identifier:secondaryTouchBarNewEntryIdentifier identifier:secondaryTouchBarNewEntryIdentifier
image:[MPIconHelper icon:MPIconAddEntry] image:[MPIconHelper icon:MPIconAddEntry]
@@ -735,7 +735,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
selector:@selector(createEntry:) selector:@selector(createEntry:)
customizationLabel:NSLocalizedString(@"TOUCHBAR_NEW_ENTRY","Touchbar button label for creating a new item")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_NEW_ENTRY","Touchbar button label for creating a new item")];
} }
else if (identifier == secondaryTouchBarNewGroupIdentifier) { if([identifier isEqualToString:secondaryTouchBarNewGroupIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImage:NSLocalizedString(@"TOUCHBAR_NEW_GROUP","Touchbar button label for creating a new group") return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImage:NSLocalizedString(@"TOUCHBAR_NEW_GROUP","Touchbar button label for creating a new group")
identifier:secondaryTouchBarNewGroupIdentifier identifier:secondaryTouchBarNewGroupIdentifier
image:[MPIconHelper icon:MPIconAddFolder] image:[MPIconHelper icon:MPIconAddFolder]
@@ -743,7 +743,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
selector:@selector(createGroup:) selector:@selector(createGroup:)
customizationLabel:NSLocalizedString(@"TOUCHBAR_NEW_GROUP","Touchbar button label for creating a new group")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_NEW_GROUP","Touchbar button label for creating a new group")];
} }
else if (identifier == secondaryTouchBarDeleteIdentifier) { if([identifier isEqualToString:secondaryTouchBarDeleteIdentifier]) {
return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImageAndColor:NSLocalizedString(@"TOUCHBAR_DELETE","Touchbar button label for deleting elements") return [MPTouchBarButtonCreator touchBarButtonWithTitleAndImageAndColor:NSLocalizedString(@"TOUCHBAR_DELETE","Touchbar button label for deleting elements")
identifier:secondaryTouchBarDeleteIdentifier identifier:secondaryTouchBarDeleteIdentifier
image:[MPIconHelper icon:MPIconTrash] image:[MPIconHelper icon:MPIconTrash]
@@ -752,9 +752,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
selector:@selector(delete:) selector:@selector(delete:)
customizationLabel:NSLocalizedString(@"TOUCHBAR_DELETE","Touchbar button label for deleting elements")]; customizationLabel:NSLocalizedString(@"TOUCHBAR_DELETE","Touchbar button label for deleting elements")];
} }
else { return nil;
return nil;
}
} }
- (void)focusSearchField { - (void)focusSearchField {