diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 6b54122f..66664c71 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -302,8 +302,6 @@ 4CE5B54B173AFBA700207B39 /* MPDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE5B549173AFBA700207B39 /* MPDocument.m */; }; 4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; }; 4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; }; - 4CE84903271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE84901271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.m */; }; - 4CE84904271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CE84902271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.xib */; }; 4CE88B9717BA651C0042E078 /* contextTriangleTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */; }; 4CEE46DD181C301D006BF1E5 /* MPAutotypeDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEE46DC181C301D006BF1E5 /* MPAutotypeDaemon.m */; }; 4CEED1C617D7BD0E007180F1 /* NSError+Messages.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEED1C517D7BD0E007180F1 /* NSError+Messages.m */; }; @@ -931,9 +929,6 @@ 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayWindowController.m; sourceTree = ""; }; 4CE8247316E2F2B900573141 /* MPOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOverlayView.h; sourceTree = ""; }; 4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = ""; }; - 4CE84900271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPEntryPasswordAttributeViewController.h; sourceTree = ""; }; - 4CE84901271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPEntryPasswordAttributeViewController.m; sourceTree = ""; }; - 4CE84902271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MPEntryPasswordAttributeViewController.xib; sourceTree = ""; }; 4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = contextTriangleTemplate.pdf; sourceTree = ""; }; 4CE88C2417C163FE00BFD195 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 4CE88C3317C1647400BFD195 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -1543,9 +1538,6 @@ 4CC0192B271836CD00459789 /* MPEntryAttributeViewController.h */, 4CC0192C271836CD00459789 /* MPEntryAttributeViewController.m */, 4CC0192D271836CD00459789 /* MPEntryAttributeViewController.xib */, - 4CE84900271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.h */, - 4CE84901271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.m */, - 4CE84902271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.xib */, 4C59AC9A2722C12200F54B20 /* MPNodeExpirationViewController.h */, 4C59AC9B2722C12200F54B20 /* MPNodeExpirationViewController.m */, 4C59AC9C2722C12200F54B20 /* MPNodeExpirationViewController.xib */, @@ -2256,7 +2248,6 @@ 4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */, 4CF29BF417879D0000851B60 /* 26_FileSaveTemplate.pdf in Resources */, 4C7BD07619FE94C900C7AA5C /* Assets.xcassets in Resources */, - 4CE84904271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.xib in Resources */, 4CA182781F96523600DD4A4A /* DuplicateEntryOptionsWindow.xib in Resources */, 4C52A88E1788628B00868229 /* 06_BlockDeviceTemplate.pdf in Resources */, 4C52A88F1788628B00868229 /* 13_KeysTemplate.pdf in Resources */, @@ -2468,7 +2459,6 @@ 4CCEDE2A179F203B008402BE /* MPOutlineView.m in Sources */, 4CB33F861EAF54A000C9341E /* KPKNode+MPIsHistory.m in Sources */, 4CCEDE2E179F213B008402BE /* MPNotifications.m in Sources */, - 4CE84903271E10AC00EBAB0C /* MPEntryPasswordAttributeViewController.m in Sources */, 4C17D8E517A1C780006C8C1E /* MPDocumentWindowDelegate.m in Sources */, 4C63B8FB17A3154D0091BD72 /* MPContextButton.m in Sources */, 4C1E9885185F71A800943563 /* MPContextBarViewController.m in Sources */, diff --git a/MacPass/Base.lproj/EntryInspectorView.xib b/MacPass/Base.lproj/EntryInspectorView.xib index 2958b354..c2efe67c 100644 --- a/MacPass/Base.lproj/EntryInspectorView.xib +++ b/MacPass/Base.lproj/EntryInspectorView.xib @@ -89,7 +89,7 @@ - + @@ -251,7 +251,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -583,13 +583,13 @@ - + - + @@ -611,7 +611,7 @@ - + diff --git a/MacPass/MPEntryAttributeViewController.h b/MacPass/MPEntryAttributeViewController.h index 27d8fe5f..c152dcd7 100644 --- a/MacPass/MPEntryAttributeViewController.h +++ b/MacPass/MPEntryAttributeViewController.h @@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong) IBOutlet NSTextField *keyTextField; @property (strong) IBOutlet HNHUISecureTextField *valueTextField; +@property (strong) IBOutlet NSButton *generatePasswordButton; @property (strong) IBOutlet NSButton *toggleProtectedButton; @property (strong) IBOutlet NSButton *removeButton; @property (strong) IBOutlet NSButton *actionButton; diff --git a/MacPass/MPEntryAttributeViewController.m b/MacPass/MPEntryAttributeViewController.m index b7242116..1c8eb7b0 100644 --- a/MacPass/MPEntryAttributeViewController.m +++ b/MacPass/MPEntryAttributeViewController.m @@ -18,7 +18,7 @@ NSString *nameForDefaultKey(NSString *key) { dispatch_once(&onceToken, ^{ mapping = @{ kKPKTitleKey: NSLocalizedString(@"TITTLE_ATTRIBUTE_KEY", @"Localized name for title attribute"), kKPKUsernameKey: NSLocalizedString(@"USERNAME_ATTRIBUTE_KEY", @"Localized name for username attribute"), - kKPKPasswordKey: NSLocalizedString(@"PASSEORD_ATTRIBUTE_KEY", @"Localized name for password attribute"), + kKPKPasswordKey: NSLocalizedString(@"PASSWORD_ATTRIBUTE_KEY", @"Localized name for password attribute"), kKPKURLKey: NSLocalizedString(@"URL_ATTRIBUTE_KEY", @"Localized name for URL attribute") }; }); return mapping[key]; @@ -26,7 +26,9 @@ NSString *nameForDefaultKey(NSString *key) { @interface MPEntryAttributeViewController () + @property (nonatomic, readonly, getter=isDefaultAttributeEditor) BOOL defaultAttributeEditor; +@property (nonatomic, readonly, getter=isPasswordAttributeEditor) BOOL passwordAttributeEditor; @end @@ -94,7 +96,11 @@ NSString *nameForDefaultKey(NSString *key) { withKeyPath:keyKeyPath options:bindingOptions]; } - + if(self.isPasswordAttributeEditor) { + self.toggleProtectedButton.image = [NSImage imageNamed:NSImageNameQuickLookTemplate]; + // TODO: setup pretty password value transformer + // TODO: setup Monospaced Font + } [self updateValuesAndEditing]; } @@ -109,6 +115,10 @@ NSString *nameForDefaultKey(NSString *key) { return (self.attributeSelector != NULL); } +- (BOOL)isPasswordAttributeEditor { + return self.attributeSelector == @selector(password); +} + - (void)setIsEditor:(BOOL)isEditor { _isEditor = isEditor; [self updateValuesAndEditing]; @@ -195,7 +205,7 @@ NSString *nameForDefaultKey(NSString *key) { - (void)updateValuesAndEditing { // values self.view.hidden = self.isEditor ? NO : self.representedAttribute.value.length == 0; - + self.valueTextField.showPassword = !self.representedAttribute.protect; // editor @@ -203,7 +213,8 @@ NSString *nameForDefaultKey(NSString *key) { self.valueTextField.editable = self.isEditor; self.keyTextField.selectable = YES; self.valueTextField.selectable = YES; - self.toggleProtectedButton.hidden = self.isDefaultAttributeEditor; + self.toggleProtectedButton.hidden = self.isDefaultAttributeEditor ? !self.isPasswordAttributeEditor : NO; + self.generatePasswordButton.hidden = self.isEditor ? !self.isPasswordAttributeEditor : YES; self.removeButton.hidden = !self.isEditor ? YES : self.isDefaultAttributeEditor; diff --git a/MacPass/MPEntryAttributeViewController.xib b/MacPass/MPEntryAttributeViewController.xib index ef87ef05..c02d636a 100644 --- a/MacPass/MPEntryAttributeViewController.xib +++ b/MacPass/MPEntryAttributeViewController.xib @@ -9,6 +9,7 @@ + @@ -19,14 +20,14 @@ - + - + - + @@ -34,11 +35,11 @@ - + - - + + @@ -48,21 +49,31 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MacPass/MPInspectorEditorView.m b/MacPass/MPInspectorEditorView.m index 848bcb57..0d30b89b 100644 --- a/MacPass/MPInspectorEditorView.m +++ b/MacPass/MPInspectorEditorView.m @@ -27,11 +27,24 @@ NSString *const MPInspectorEditorViewMouseExitedNotification = @"com.hicknhackso [NSNotificationCenter.defaultCenter postNotificationName:MPInspectorEditorViewMouseExitedNotification object:self]; } -- (void)updateTrackingAreas { - [super updateTrackingAreas]; - [self removeTrackingArea:self.trackingArea]; +- (void)createTrackingArea { self.trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingActiveAlways|NSTrackingMouseEnteredAndExited owner:self userInfo:nil]; [self addTrackingArea:self.trackingArea]; + + NSPoint mouseLocation = self.window.mouseLocationOutsideOfEventStream; + mouseLocation = [self convertPoint:mouseLocation fromView:nil]; + if(NSPointInRect(mouseLocation, self.bounds)) { + [self mouseEntered:NSApp.currentEvent]; + } + else { + [self mouseExited:NSApp.currentEvent]; + } +} + +- (void)updateTrackingAreas { + [self removeTrackingArea:self.trackingArea]; + [self createTrackingArea]; + [super updateTrackingAreas]; } @end diff --git a/MacPass/MPNodeIconViewController.xib b/MacPass/MPNodeIconViewController.xib index 5f5f01df..34bd93f1 100644 --- a/MacPass/MPNodeIconViewController.xib +++ b/MacPass/MPNodeIconViewController.xib @@ -28,7 +28,7 @@ - + diff --git a/MacPass/MPNodeTagViewController.xib b/MacPass/MPNodeTagViewController.xib index e32840e3..38fe2204 100644 --- a/MacPass/MPNodeTagViewController.xib +++ b/MacPass/MPNodeTagViewController.xib @@ -1,7 +1,9 @@ - - + + - + + + @@ -14,6 +16,7 @@ +