diff --git a/MacPass/MPAddCustomFieldContextMenuDelegate.m b/MacPass/MPAddCustomFieldContextMenuDelegate.m index ddf96f3d..3a5db57d 100644 --- a/MacPass/MPAddCustomFieldContextMenuDelegate.m +++ b/MacPass/MPAddCustomFieldContextMenuDelegate.m @@ -23,6 +23,7 @@ #import "MPAddCustomFieldContextMenuDelegate.h" #import "KeePassKit/KeePassKit.h" +#import "MPEntryInspectorViewController.h" /* HmacOtp-Secret (the UTF-8 representation of the value is the secret), @@ -66,8 +67,8 @@ /* Time OPT*/ - (void)_setupTOTPMenuItemsToMenu:(NSMenu *)menu { - NSMenuItem *setupItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"SETUP_TOTP_SETTINGS", @"Menu item title editing TOTP settings") action:@selector(_setupTOTPSettings:) keyEquivalent:@""]; - setupItem.target = self; + NSMenuItem *setupItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"SETUP_TOTP_SETTINGS", @"Menu item title editing TOTP settings") action:@selector(showOTPSetup:) keyEquivalent:@""]; + setupItem.target = self.viewController; [menu addItem:setupItem]; } diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index e8e0918d..b9854ce5 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -84,6 +84,7 @@ - (IBAction)showPasswordGenerator:(id)sender; - (IBAction)showReferenceBuilder:(id)sender; - (IBAction)showAutotypeBuilder:(id)sender; +- (IBAction)showOTPSetup:(id)sender; - (IBAction)saveAttachment:(id)sender; - (IBAction)addAttachment:(id)sender; @@ -97,4 +98,5 @@ - (IBAction)toggleQuicklookPreview:(id)sender; - (IBAction)toggleExpire:(NSButton*)sender; + @end diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index c68240fe..376037be 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -32,6 +32,7 @@ #import "MPAutotypeBuilderViewController.h" #import "MPReferenceBuilderViewController.h" #import "MPTOTPViewController.h" +#import "MPTOTPSetupViewController.h" #import "MPPrettyPasswordTransformer.h" #import "NSString+MPPasswordCreation.h" @@ -381,6 +382,20 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self _showPopopver:viewController atView:sender onEdge:NSMinYEdge]; } +- (IBAction)showOTPSetup:(id)sender { + NSView *location; + if([sender isKindOfClass:NSView.class]) { + location = sender; + } + else { + // we do not have anything to do! + } + MPTOTPSetupViewController *vc = [[MPTOTPSetupViewController alloc] init]; + vc.representedObject = self.representedObject; + + [self _showPopopver:vc atView:location onEdge:NSMinYEdge]; +} + - (void)dismissViewController:(NSViewController *)viewController { if([viewController isKindOfClass:MPAutotypeBuilderViewController.class]) { self.showCustomAssociationSequenceAutotypeBuilderButton.enabled = YES; diff --git a/MacPass/MPTOTPViewController.xib b/MacPass/MPTOTPViewController.xib index ced632ec..e475dcc6 100644 --- a/MacPass/MPTOTPViewController.xib +++ b/MacPass/MPTOTPViewController.xib @@ -54,6 +54,9 @@ + + +