Wired up TOTPSetup pop over

This commit is contained in:
Michael Starke
2020-12-23 01:33:53 +01:00
parent 9fe9c6a41d
commit 90a0aef2cc
4 changed files with 23 additions and 2 deletions

View File

@@ -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];
}

View File

@@ -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

View File

@@ -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;

View File

@@ -54,6 +54,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="showOTPSetup:" target="-1" id="mJ4-w0-CGo"/>
</connections>
</button>
</subviews>
<visibilityPriorities>