diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index ceb437fe..6b11a823 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -204,6 +204,7 @@ 4CA0B2FC15BCAF8600654E32 /* MPSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0B2FB15BCAF8600654E32 /* MPSettingsWindowController.m */; }; 4CA0E3A7176FAF99004D18CB /* MPDocumentQueryService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */; }; 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 */; }; 4CA3531218A5577300839B0F /* dsa_sparkle_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 4CA3531118A5577300839B0F /* dsa_sparkle_pub.pem */; }; 4CAC614317AD319200023F9E /* KPKTestXmlParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */; }; @@ -704,6 +705,8 @@ 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentQueryService.m; sourceTree = ""; }; 4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLockDaemon.h; sourceTree = ""; }; 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLockDaemon.m; sourceTree = ""; }; + 4CA334C818AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWindowAssociationsTableViewDelegate.h; sourceTree = ""; }; + 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 = ""; }; 4CA3531118A5577300839B0F /* dsa_sparkle_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_sparkle_pub.pem; sourceTree = ""; }; @@ -1195,6 +1198,8 @@ 4C17D8E417A1C780006C8C1E /* MPDocumentWindowDelegate.m */, 4C8B36A917A6ED4B005E1FF1 /* MPOutlineContextMenuDelegate.h */, 4C8B36AA17A6ED4B005E1FF1 /* MPOutlineContextMenuDelegate.m */, + 4CA334C818AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.h */, + 4CA334C918AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m */, ); name = Delegates; sourceTree = ""; @@ -2125,6 +2130,7 @@ 4C9D6AA917615199001C660C /* HNHRoundedSecureTextFieldCell.m in Sources */, 4C4A100F176286FD00BBF2CA /* MPTableView.m in Sources */, 4CAF62FC1763604000CD7084 /* HNHBadgedTextFieldCell.m in Sources */, + 4CA334CA18AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m in Sources */, 4C58BD4F176370B100B8178C /* HNHBadgedTextField.m in Sources */, 4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */, 4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */, diff --git a/MacPass/EntryInspectorView.xib b/MacPass/EntryInspectorView.xib index d35913bf..93f6db70 100644 --- a/MacPass/EntryInspectorView.xib +++ b/MacPass/EntryInspectorView.xib @@ -8,15 +8,20 @@ + + + + + @@ -24,6 +29,7 @@ + @@ -700,11 +706,11 @@ - + - + @@ -724,7 +730,7 @@ - + @@ -733,14 +739,14 @@ - + - + - - + + @@ -758,6 +764,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -765,7 +791,7 @@ - + - + @@ -821,41 +847,53 @@ - + + - + + - - - + - + + + - + diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index a98d589a..bfacf73f 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -24,7 +24,6 @@ @property (weak) IBOutlet NSSegmentedControl *infoTabControl; @property (weak) IBOutlet NSTableView *attachmentTableView; @property (weak) IBOutlet NSTableView *customFieldsTableView; -@property (weak) IBOutlet NSTableView *windowAssociationsTableView; @property (unsafe_unretained) IBOutlet NSTextView *notesTextView; @property (weak) IBOutlet NSButton *generatePasswordButton; @property (weak) IBOutlet NSButton *togglePassword; @@ -36,6 +35,17 @@ @property (weak) IBOutlet NSButton *expiresCheckButton; @property (weak) IBOutlet NSTokenField *tagsTokenField; +/* Autotype */ +@property (weak) IBOutlet NSButton *enableAutotypeCheckButton; +@property (weak) IBOutlet NSTableView *windowAssociationsTableView; +@property (weak) IBOutlet NSTextField *customEntrySequenceTextField; +@property (weak) IBOutlet NSComboBox *windowTitleComboBox; + +@property (weak) IBOutlet NSButton *removeAssociationButton; +@property (weak) IBOutlet NSButton *addAssociationButton; + +@property (weak) IBOutlet NSTextField *associationSequenceTextField; + - (void)setupBindings:(MPDocument *)document; - (IBAction)saveAttachment:(id)sender; diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 4e80bf61..685b754d 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -11,12 +11,15 @@ #import "MPCustomFieldTableViewDelegate.h" #import "MPPasswordCreatorViewController.h" #import "MPAttachmentTableDataSource.h" +#import "MPWindowAssociationsTableViewDelegate.h" #import "MPDocument.h" #import "MPIconHelper.h" #import "KPKEntry.h" #import "KPKBinary.h" +#import "KPKAutotype.h" +#import "KPKWindowAssociation.h" #import "HNHScrollView.h" #import "HNHRoundedSecureTextField.h" @@ -32,10 +35,11 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { @private NSArrayController *_attachmentsController; NSArrayController *_customFieldsController; + NSArrayController *_windowAssociationsController; MPAttachmentTableViewDelegate *_attachmentTableDelegate; MPCustomFieldTableViewDelegate *_customFieldTableDelegate; MPAttachmentTableDataSource *_attachmentDataSource; - + MPWindowAssociationsTableViewDelegate *_windowAssociationsTableDelegate; } @property (nonatomic, assign) BOOL showPassword; @@ -58,9 +62,11 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { _showPassword = NO; _attachmentsController = [[NSArrayController alloc] init]; _customFieldsController = [[NSArrayController alloc] init]; + _windowAssociationsController = [[NSArrayController alloc] init]; _attachmentTableDelegate = [[MPAttachmentTableViewDelegate alloc] init]; _customFieldTableDelegate = [[MPCustomFieldTableViewDelegate alloc] init]; _attachmentDataSource = [[MPAttachmentTableDataSource alloc] init]; + _windowAssociationsTableDelegate = [[MPWindowAssociationsTableViewDelegate alloc] init]; _attachmentTableDelegate.viewController = self; _customFieldTableDelegate.viewController = self; _activeTab = MPEntryTabGeneral; @@ -88,6 +94,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.customFieldsTableView setDelegate:_customFieldTableDelegate]; [self.windowAssociationsTableView setBackgroundColor:[NSColor clearColor]]; + [self.windowAssociationsTableView setDelegate:_windowAssociationsTableDelegate]; + [self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:@"arrangedObjects" options:nil]; [self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil]; [self.togglePassword bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil]; @@ -242,6 +250,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self _bindEntry]; [self _bindAttachments]; [self _bindCustomFields]; + [self _bindAutotype]; } - (void)_bindEntry { @@ -279,6 +288,13 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"customAttributes" options:nil]; } +- (void)_bindAutotype { + [self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" options:nil]; + [self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" options:nil]; + [self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:@"defaultSequence" options:nil]; + [_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:@"associations" options:nil]; +} + - (void)_toggleEditing:(BOOL)edit { /* TODO: not fully working right now */ diff --git a/MacPass/MPWindowAssociationsTableViewDelegate.h b/MacPass/MPWindowAssociationsTableViewDelegate.h new file mode 100644 index 00000000..e0025063 --- /dev/null +++ b/MacPass/MPWindowAssociationsTableViewDelegate.h @@ -0,0 +1,13 @@ +// +// MPWindowAssociationsTableViewDelegate.h +// MacPass +// +// Created by Michael Starke on 13.02.14. +// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface MPWindowAssociationsTableViewDelegate : NSObject + +@end diff --git a/MacPass/MPWindowAssociationsTableViewDelegate.m b/MacPass/MPWindowAssociationsTableViewDelegate.m new file mode 100644 index 00000000..eb696041 --- /dev/null +++ b/MacPass/MPWindowAssociationsTableViewDelegate.m @@ -0,0 +1,31 @@ +// +// MPWindowAssociationsTableViewDelegate.m +// MacPass +// +// Created by Michael Starke on 13.02.14. +// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved. +// + +#import "MPWindowAssociationsTableViewDelegate.h" + +#import "MPDocument.h" +#import "KPKEntry.h" +#import "KPKAutotype.h" +#import "KPKWindowAssociation.h" + +@implementation MPWindowAssociationsTableViewDelegate + +- (void)tableViewSelectionDidChange:(NSNotification *)notification { + // update add/remove buttons? +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + MPDocument *document = [[[tableView window] windowController] document]; + NSTableCellView *view = [tableView makeViewWithIdentifier:@"WindowAssociationCell" owner:tableView]; + KPKEntry *entry = document.selectedEntry; + KPKWindowAssociation *association = entry.autotype.associations[row]; + [[view textField] bind:NSValueBinding toObject:association withKeyPath:@"windowTitle" options:nil]; + return view; +} + +@end