diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 0b7ae516..768319be 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -191,6 +191,8 @@ 4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */; }; 4CA334CA18AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA334C918AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m */; }; 4CA3530B18A53CB800839B0F /* MPKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA3530A18A53CB800839B0F /* MPKeyMapper.m */; }; + 4CAAA8271D787B8B00CDE977 /* MPAutotypeBuilderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAAA8251D787B8B00CDE977 /* MPAutotypeBuilderViewController.m */; }; + 4CAAA8281D787B8B00CDE977 /* AutotypeBuilderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CAAA8261D787B8B00CDE977 /* AutotypeBuilderView.xib */; }; 4CAD748C15B889B700104512 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748B15B889B700104512 /* Security.framework */; }; 4CAD748E15B88AC100104512 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748D15B88AC100104512 /* libz.dylib */; }; 4CB915941A0159A20089CE5B /* DuplicateEntryOptionsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CB915931A0159A20089CE5B /* DuplicateEntryOptionsWindow.xib */; }; @@ -602,6 +604,9 @@ 4CA334C918AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWindowAssociationsTableViewDelegate.m; sourceTree = ""; }; 4CA3530918A53CB800839B0F /* MPKeyMapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKeyMapper.h; sourceTree = ""; }; 4CA3530A18A53CB800839B0F /* MPKeyMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKeyMapper.m; sourceTree = ""; }; + 4CAAA8241D787B8B00CDE977 /* MPAutotypeBuilderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeBuilderViewController.h; sourceTree = ""; }; + 4CAAA8251D787B8B00CDE977 /* MPAutotypeBuilderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeBuilderViewController.m; sourceTree = ""; }; + 4CAAA8261D787B8B00CDE977 /* AutotypeBuilderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AutotypeBuilderView.xib; sourceTree = ""; }; 4CAD748B15B889B700104512 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 4CAD748D15B88AC100104512 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 4CB63A6018986530002DEC4C /* MPFlagsHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPFlagsHelper.h; sourceTree = ""; }; @@ -844,6 +849,7 @@ 6021FE7918E15FF300C3BC51 /* DatePickingView.xib */, 4C26C34A18D8D5A300CF1A1C /* PreviewView.xib */, 4CD820231A32173100399DBB /* ReferenceBuilderView.xib */, + 4CAAA8261D787B8B00CDE977 /* AutotypeBuilderView.xib */, 4CE8247316E2F2B900573141 /* MPOverlayView.h */, 4CE8247416E2F2B900573141 /* MPOverlayView.m */, 4CFC53BD16E94729007396BE /* MPShadowBox.h */, @@ -1305,6 +1311,8 @@ 4C26C34918D8D5A300CF1A1C /* MPPreviewViewController.m */, 4CE30ACA1A312B7F0063FCC6 /* MPReferenceBuilderViewController.h */, 4CE30ACB1A312B7F0063FCC6 /* MPReferenceBuilderViewController.m */, + 4CAAA8241D787B8B00CDE977 /* MPAutotypeBuilderViewController.h */, + 4CAAA8251D787B8B00CDE977 /* MPAutotypeBuilderViewController.m */, ); name = "View Controller"; sourceTree = ""; @@ -1539,6 +1547,7 @@ files = ( 4C3826AE1AD04D8E007D7D67 /* 33_RunTemplate.pdf in Resources */, 4C3826A51AD04D8E007D7D67 /* 21_OrganizerTemplate.pdf in Resources */, + 4CAAA8281D787B8B00CDE977 /* AutotypeBuilderView.xib in Resources */, 4C17F108184E6B6C00E85625 /* 31_PrintTemplate.pdf in Resources */, 4C77E37115B84A240093A587 /* InfoPlist.strings in Resources */, 4C3826781AD04C8A007D7D67 /* createdTemplate.pdf in Resources */, @@ -1791,6 +1800,7 @@ 4CE2961518429AA5005F01CE /* MPAutotypeKeyPress.m in Sources */, 4C32B0E71A1D4436007E12F1 /* KPKFormat+MPUTIDetection.m in Sources */, 4C5807781C64F67000E7171F /* NSString+MPHash.m in Sources */, + 4CAAA8271D787B8B00CDE977 /* MPAutotypeBuilderViewController.m in Sources */, 4CE501341BBC47F500FB819D /* MPTagsTokenFieldDelegate.m in Sources */, 4CC6DB7A17D23719002C6091 /* KPKNode+IconImage.m in Sources */, 4C15B74618BCA3B1003F8008 /* MPDocument+Search.m in Sources */, diff --git a/MacPass/AutotypeBuilderView.xib b/MacPass/AutotypeBuilderView.xib index d7c83700..3217cb6a 100644 --- a/MacPass/AutotypeBuilderView.xib +++ b/MacPass/AutotypeBuilderView.xib @@ -7,31 +7,26 @@ + - + - - - + + + - - - - - - - + diff --git a/MacPass/Base.lproj/EntryInspectorView.xib b/MacPass/Base.lproj/EntryInspectorView.xib index e6f2750a..f7c45f81 100644 --- a/MacPass/Base.lproj/EntryInspectorView.xib +++ b/MacPass/Base.lproj/EntryInspectorView.xib @@ -15,8 +15,6 @@ - - @@ -24,6 +22,8 @@ + + @@ -534,7 +534,7 @@ - + @@ -874,9 +874,12 @@ - + + + + diff --git a/MacPass/Base.lproj/ReferenceBuilderView.xib b/MacPass/Base.lproj/ReferenceBuilderView.xib index 6e9383d9..bb7e0925 100644 --- a/MacPass/Base.lproj/ReferenceBuilderView.xib +++ b/MacPass/Base.lproj/ReferenceBuilderView.xib @@ -1,8 +1,8 @@ - + - + @@ -22,7 +22,6 @@ - @@ -41,7 +40,6 @@ - @@ -50,7 +48,6 @@ - @@ -67,7 +63,6 @@ - @@ -76,7 +71,6 @@ - @@ -94,7 +88,6 @@ - @@ -103,7 +96,6 @@ - @@ -112,7 +104,6 @@ - @@ -146,7 +137,6 @@ - diff --git a/MacPass/MPAutotypeBuilderViewController.m b/MacPass/MPAutotypeBuilderViewController.m index 8d0c6fde..b00a6785 100644 --- a/MacPass/MPAutotypeBuilderViewController.m +++ b/MacPass/MPAutotypeBuilderViewController.m @@ -7,16 +7,45 @@ // #import "MPAutotypeBuilderViewController.h" +#import @interface MPAutotypeBuilderViewController () +@property (weak) IBOutlet NSTokenField *tokenField; +@property (nonatomic, readonly, strong) NSArray *tokens; + @end @implementation MPAutotypeBuilderViewController +#define _MPToken(short,long) [NSString stringWithFormat:@"%@ %@", short, long] + +- (NSArray *)tokens { + static NSArray *_tokens; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSMutableArray *fields = [[NSMutableArray alloc] init]; + for(NSString *attribute in [KPKFormat sharedFormat].entryDefaultKeys) { + [fields addObject:[NSString stringWithFormat:@"{%@}", attribute]]; + } + + _tokens = [fields arrayByAddingObjectsFromArray:@[ _MPToken(kKPKAutotypeShortEnter, kKPKAutotypeEnter), + _MPToken(kKPKAutotypeShortAlt, kKPKAutotypeAlt), + _MPToken(kKPKAutotypeShortControl, kKPKAutotypeControl), + ]]; + }); + return _tokens; +} + + +- (NSString *)nibName { + return @"AutotypeBuilderView"; +} + - (void)viewDidLoad { - [super viewDidLoad]; - // Do view setup here. + [super viewDidLoad]; + self.tokenField.editable = NO; + self.tokenField.objectValue = self.tokens; } @end diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index 3010b84c..5b5a6ea8 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -42,18 +42,20 @@ @property (weak) IBOutlet NSButton *enableAutotypeCheckButton; @property (weak) IBOutlet NSButton *obfuscateAutotypeCheckButton; @property (weak) IBOutlet NSTableView *windowAssociationsTableView; -@property (weak) IBOutlet NSButton *enableCustomEntrySequenceButton; +@property (weak) IBOutlet NSButton *showCustomEntrySequenceAutotypeBuilderButton; @property (weak) IBOutlet NSTextField *customEntrySequenceTextField; @property (weak) IBOutlet NSComboBox *windowTitleComboBox; @property (weak) IBOutlet NSButton *removeAssociationButton; @property (weak) IBOutlet NSButton *addAssociationButton; -@property (weak) IBOutlet NSButton *enableCustomAssociationSequenceButton; +@property (weak) IBOutlet NSButton *showCustomAssociationSequenceAutotypeBuilderButton; @property (weak) IBOutlet NSTextField *associationSequenceTextField; - (void)registerNotificationsForDocument:(MPDocument *)document; +- (IBAction)showPasswordGenerator:(id)sender; + - (IBAction)saveAttachment:(id)sender; - (IBAction)addAttachment:(id)sender; - (IBAction)removeAttachment:(id)sender; diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 9456fadc..9167a99a 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -13,6 +13,7 @@ #import "MPPasswordCreatorViewController.h" #import "MPWindowAssociationsTableViewDelegate.h" #import "MPWindowTitleComboBoxDelegate.h" +#import "MPAutotypeBuilderViewController.h" #import "NSString+MPPasswordCreation.h" @@ -275,13 +276,19 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { #pragma mark - #pragma mark Popovers -- (IBAction)_popUpPasswordGenerator:(id)sender { +- (IBAction)showAutotypeBuilder:(id)sender { + [sender setEnabled:NO]; + MPAutotypeBuilderViewController *autotypeBuilder = [[MPAutotypeBuilderViewController alloc] init]; + [self _showPopopver:autotypeBuilder atView:sender onEdge:NSMinYEdge]; +} + +- (IBAction)showPasswordGenerator:(id)sender { self.generatePasswordButton.enabled = NO; MPPasswordCreatorViewController *viewController = [[MPPasswordCreatorViewController alloc] init]; viewController.allowsEntryDefaults = YES; viewController.representedObject = self.representedObject; viewController.observer = self.windowController.document; - [self _showPopopver:viewController atView:self.passwordTextField onEdge:NSMinYEdge]; + [self _showPopopver:viewController atView:sender onEdge:NSMinYEdge]; } - (void)_showPopopver:(NSViewController *)viewController atView:(NSView *)view onEdge:(NSRectEdge)edge { @@ -299,6 +306,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { - (void)popoverDidClose:(NSNotification *)notification { self.generatePasswordButton.enabled = YES; + self.showCustomEntrySequenceAutotypeBuilderButton.enabled = YES; + self.showCustomAssociationSequenceAutotypeBuilderButton.enabled = YES; self.activePopover = nil; }