More transitions to representedObject for ViewController

This commit is contained in:
michael starke
2016-08-23 18:43:13 +02:00
parent b7fe98b410
commit 7755bc9b93
10 changed files with 101 additions and 43 deletions

View File

@@ -219,6 +219,7 @@
4CD78AC016D155FF00768A1D /* 11_CameraTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */; }; 4CD78AC016D155FF00768A1D /* 11_CameraTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */; };
4CD820211A32173100399DBB /* ReferenceBuilderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CD820231A32173100399DBB /* ReferenceBuilderView.xib */; }; 4CD820211A32173100399DBB /* ReferenceBuilderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CD820231A32173100399DBB /* ReferenceBuilderView.xib */; };
4CD884B715BD47080042BBF8 /* DocumentWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CD884B615BD47080042BBF8 /* DocumentWindow.xib */; }; 4CD884B715BD47080042BBF8 /* DocumentWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CD884B615BD47080042BBF8 /* DocumentWindow.xib */; };
4CDE7B161D660983008C4160 /* MPObjectController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE7B151D660983008C4160 /* MPObjectController.m */; };
4CDF01A316D1B76700D0AC08 /* MPEntryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */; }; 4CDF01A316D1B76700D0AC08 /* MPEntryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */; };
4CE2961518429AA5005F01CE /* MPAutotypeKeyPress.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE2961418429AA5005F01CE /* MPAutotypeKeyPress.m */; }; 4CE2961518429AA5005F01CE /* MPAutotypeKeyPress.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE2961418429AA5005F01CE /* MPAutotypeKeyPress.m */; };
4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE296181842A166005F01CE /* MPAutotypePaste.m */; }; 4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE296181842A166005F01CE /* MPAutotypePaste.m */; };
@@ -624,6 +625,8 @@
4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 11_CameraTemplate.pdf; sourceTree = "<group>"; }; 4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 11_CameraTemplate.pdf; sourceTree = "<group>"; };
4CD820221A32173100399DBB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ReferenceBuilderView.xib; sourceTree = "<group>"; }; 4CD820221A32173100399DBB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ReferenceBuilderView.xib; sourceTree = "<group>"; };
4CD884B615BD47080042BBF8 /* DocumentWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DocumentWindow.xib; sourceTree = "<group>"; }; 4CD884B615BD47080042BBF8 /* DocumentWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DocumentWindow.xib; sourceTree = "<group>"; };
4CDE7B141D660983008C4160 /* MPObjectController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPObjectController.h; sourceTree = "<group>"; };
4CDE7B151D660983008C4160 /* MPObjectController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPObjectController.m; sourceTree = "<group>"; };
4CDF01A116D1B76700D0AC08 /* MPEntryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryViewController.h; sourceTree = "<group>"; }; 4CDF01A116D1B76700D0AC08 /* MPEntryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryViewController.h; sourceTree = "<group>"; };
4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryViewController.m; sourceTree = "<group>"; }; 4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryViewController.m; sourceTree = "<group>"; };
4CE2961318429AA5005F01CE /* MPAutotypeKeyPress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeKeyPress.h; sourceTree = "<group>"; }; 4CE2961318429AA5005F01CE /* MPAutotypeKeyPress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeKeyPress.h; sourceTree = "<group>"; };
@@ -1354,6 +1357,8 @@
4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */, 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */,
4C6AEEF71A043E2B00CA2420 /* MPDocumentController.h */, 4C6AEEF71A043E2B00CA2420 /* MPDocumentController.h */,
4C6AEEF81A043E2B00CA2420 /* MPDocumentController.m */, 4C6AEEF81A043E2B00CA2420 /* MPDocumentController.m */,
4CDE7B141D660983008C4160 /* MPObjectController.h */,
4CDE7B151D660983008C4160 /* MPObjectController.m */,
); );
name = "Data Controller"; name = "Data Controller";
sourceTree = "<group>"; sourceTree = "<group>";
@@ -1714,6 +1719,7 @@
4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */, 4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */,
4C569D9E17652B0600595B62 /* MPConstants.m in Sources */, 4C569D9E17652B0600595B62 /* MPConstants.m in Sources */,
4C569DA117652BFE00595B62 /* MPEntryTableDataSource.m in Sources */, 4C569DA117652BFE00595B62 /* MPEntryTableDataSource.m in Sources */,
4CDE7B161D660983008C4160 /* MPObjectController.m in Sources */,
4C7B63711C0CB51F00D7038C /* NSValueTransformer+TransformerKit.m in Sources */, 4C7B63711C0CB51F00D7038C /* NSValueTransformer+TransformerKit.m in Sources */,
4CD034AA1BFE113B003C002C /* MPPlugin.m in Sources */, 4CD034AA1BFE113B003C002C /* MPPlugin.m in Sources */,
4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */, 4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */,

View File

@@ -85,6 +85,10 @@
argument = "-NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints YES" argument = "-NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints YES"
isEnabled = "NO"> isEnabled = "NO">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument
argument = "-NSBindingDebugLogLevel YES"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments> </CommandLineArguments>
<EnvironmentVariables> <EnvironmentVariables>
<EnvironmentVariable <EnvironmentVariable

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
@@ -49,6 +49,11 @@
<imageCell key="cell" alignment="left" imageScaling="proportionallyUpOrDown" image="NSActionTemplate" id="2999"/> <imageCell key="cell" alignment="left" imageScaling="proportionallyUpOrDown" image="NSActionTemplate" id="2999"/>
<connections> <connections>
<action selector="pickIcon:" target="-2" id="6wh-Ka-Thl"/> <action selector="pickIcon:" target="-2" id="6wh-Ka-Thl"/>
<binding destination="-2" name="value" keyPath="representedObject.iconImage" id="agf-eg-okr">
<dictionary key="options">
<bool key="NSConditionallySetsEnabled" value="NO"/>
</dictionary>
</binding>
</connections> </connections>
</imageView> </imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="3013"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="3013">
@@ -58,6 +63,9 @@
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="representedObject.title" id="2ek-Ns-ybY"/>
</connections>
</textField> </textField>
<splitView autosaveName="InspectorNotesSplitView" dividerStyle="thin" translatesAutoresizingMaskIntoConstraints="NO" id="3145"> <splitView autosaveName="InspectorNotesSplitView" dividerStyle="thin" translatesAutoresizingMaskIntoConstraints="NO" id="3145">
<rect key="frame" x="0.0" y="30" width="278" height="582"/> <rect key="frame" x="0.0" y="30" width="278" height="582"/>
@@ -140,6 +148,14 @@
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> <color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="236" height="177"/> <size key="minSize" width="236" height="177"/>
<size key="maxSize" width="463" height="10000000"/> <size key="maxSize" width="463" height="10000000"/>
<connections>
<binding destination="-2" name="value" keyPath="representedObject.notes" id="E0d-ZH-Wbc">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="NO"/>
<string key="NSNoSelectionPlaceholder">No Selection</string>
</dictionary>
</binding>
</connections>
</textView> </textView>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -189,6 +205,7 @@
</constraints> </constraints>
<point key="canvasLocation" x="268" y="-437"/> <point key="canvasLocation" x="268" y="-437"/>
</customView> </customView>
<userDefaultsController representsSharedInstance="YES" id="U5N-S2-0zc"/>
</objects> </objects>
<resources> <resources>
<image name="NSActionTemplate" width="14" height="14"/> <image name="NSActionTemplate" width="14" height="14"/>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>

View File

@@ -60,7 +60,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
@implementation MPEntryInspectorViewController @implementation MPEntryInspectorViewController
static NSString *kMPContentBindingString1 = @"content.%@";
static NSString *kMPContentBindingString2 = @"content.%@.%@"; static NSString *kMPContentBindingString2 = @"content.%@.%@";
static NSString *kMPContentBindingString3 = @"content.%@.%@.%@"; static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
@@ -194,7 +193,7 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
if(row < 0) { if(row < 0) {
return; // no selection return; // no selection
} }
KPKBinary *binary = self.contentEntry.binaries[row]; KPKBinary *binary = self.representedEntry.binaries[row];
[self.representedEntry removeBinary:binary]; [self.representedEntry removeBinary:binary];
} }
@@ -205,8 +204,8 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
- (void)removeWindowAssociation:(id)sender { - (void)removeWindowAssociation:(id)sender {
NSInteger row = self.windowAssociationsTableView.selectedRow; NSInteger row = self.windowAssociationsTableView.selectedRow;
if(row > - 1 && row < [self.contentEntry.autotype.associations count]) { if(row > - 1 && row < [self.representedEntry.autotype.associations count]) {
[self.representedEntry.autotype removeAssociation:self.contentEntry.autotype.associations[row]]; [self.representedEntry.autotype removeAssociation:self.representedEntry.autotype.associations[row]];
} }
} }
@@ -313,7 +312,7 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
NSString *password = [controller generatedPassword]; NSString *password = [controller generatedPassword];
/* We should only use the password if there is actually one */ /* We should only use the password if there is actually one */
if(password.length > 0) { if(password.length > 0) {
self.contentEntry.password = [controller generatedPassword]; self.representedEntry.password = [controller generatedPassword];
} }
} }
/* TODO: Check for Icon wizard */ /* TODO: Check for Icon wizard */
@@ -371,39 +370,39 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
- (void)_bindEntry { - (void)_bindEntry {
[self.titleTextField bind:NSValueBinding [self.titleTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(title))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(title))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")} ]; options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")} ];
[self.passwordTextField bind:NSValueBinding [self.passwordTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(password))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(password))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }]; options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }];
[self.usernameTextField bind:NSValueBinding [self.usernameTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(username))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(username))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }]; options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }];
[self.URLTextField bind:NSValueBinding [self.URLTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(url))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(url))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")}]; options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")}];
[self.expiresCheckButton bind:NSTitleBinding [self.expiresCheckButton bind:NSTitleBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expirationDate))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expirationDate))]
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }]; options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
[self.expiresCheckButton bind:NSValueBinding [self.expiresCheckButton bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expires))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expires))]
options:nil]; options:nil];
[self.tagsTokenField bind:NSValueBinding [self.tagsTokenField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(tags))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(tags))]
options:nil]; options:nil];
[self.uuidTextField bind:NSValueBinding [self.uuidTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(uuid)), NSStringFromSelector(@selector(UUIDString))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(uuid)), NSStringFromSelector(@selector(UUIDString))]
options:@{ NSConditionallySetsEditableBindingOption: @NO }]; options:@{ NSConditionallySetsEditableBindingOption: @NO }];
self.uuidTextField.editable = NO; self.uuidTextField.editable = NO;
@@ -414,37 +413,37 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
- (void)_bindAttachments { - (void)_bindAttachments {
[_attachmentsController bind:NSContentArrayBinding [_attachmentsController bind:NSContentArrayBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(binaries))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(binaries))]
options:nil]; options:nil];
} }
- (void)_bindCustomFields { - (void)_bindCustomFields {
[_customFieldsController bind:NSContentArrayBinding [_customFieldsController bind:NSContentArrayBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(customAttributes))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(customAttributes))]
options:nil]; options:nil];
} }
- (void)_bindAutotype { - (void)_bindAutotype {
[self.enableAutotypeCheckButton bind:NSValueBinding [self.enableAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))] options:nil]; withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))] options:nil];
[self.obfuscateAutotypeCheckButton bind:NSValueBinding [self.obfuscateAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(obfuscateDataTransfer))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(obfuscateDataTransfer))]
options:nil]; options:nil];
[self.customEntrySequenceTextField bind:NSEnabledBinding [self.customEntrySequenceTextField bind:NSEnabledBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))]
options:nil]; options:nil];
[self.customEntrySequenceTextField bind:NSValueBinding [self.customEntrySequenceTextField bind:NSValueBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(defaultKeystrokeSequence))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(defaultKeystrokeSequence))]
options:@{ NSValidatesImmediatelyBindingOption: @YES }]; options:@{ NSValidatesImmediatelyBindingOption: @YES }];
[_windowAssociationsController bind:NSContentArrayBinding [_windowAssociationsController bind:NSContentArrayBinding
toObject:self.entryController toObject:self
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(associations))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(associations))]
options:@{ NSSelectsAllWhenSettingContentBindingOption: @NO }]; options:@{ NSSelectsAllWhenSettingContentBindingOption: @NO }];
[self.windowTitleComboBox setStringValue:@""]; [self.windowTitleComboBox setStringValue:@""];
[self.windowTitleComboBox bind:NSValueBinding [self.windowTitleComboBox bind:NSValueBinding

View File

@@ -10,6 +10,7 @@
#import "MPDocument.h" #import "MPDocument.h"
#import "MPPasteBoardController.h" #import "MPPasteBoardController.h"
#import "MPValueTransformerHelper.h" #import "MPValueTransformerHelper.h"
#import "MPObjectController.h"
#import "KeePassKit/KeePassKit.h" #import "KeePassKit/KeePassKit.h"
@@ -19,7 +20,7 @@
//@property (nonatomic, weak) KPKGroup *group; //@property (nonatomic, weak) KPKGroup *group;
@property (strong) NSPopover *popover; @property (strong) NSPopover *popover;
@property (strong) NSObjectController *groupController; @property (strong) MPObjectController *groupController;
@end @end
@@ -32,7 +33,7 @@
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) { if (self) {
_groupController = [[NSObjectController alloc] init]; _groupController = [[MPObjectController alloc] init];
} }
return self; return self;
} }
@@ -85,7 +86,6 @@
- (void)setupBindings:(MPDocument *)document { - (void)setupBindings:(MPDocument *)document {
[self.groupController bind:NSContentObjectBinding toObject:self withKeyPath:NSStringFromSelector(@selector(representedObject)) options:nil]; [self.groupController bind:NSContentObjectBinding toObject:self withKeyPath:NSStringFromSelector(@selector(representedObject)) options:nil];
//[self.groupController bind:NSContentObjectBinding toObject:document withKeyPath:NSStringFromSelector(@selector(selectedGroup)) options:nil];
} }
- (void)_establishBindings { - (void)_establishBindings {

View File

@@ -10,4 +10,6 @@
@interface MPObjectController : NSObjectController @interface MPObjectController : NSObjectController
@property (weak) NSDocument *document;
@end @end

View File

@@ -10,4 +10,34 @@
@implementation MPObjectController @implementation MPObjectController
//- (void)objectDidBeginEditing:(id)editor {
// NSLog(@"objectDidBeginEditing:%@", editor);
// [super objectDidBeginEditing:editor];
//}
//- (void)objectDidEndEditing:(id)editor {
// NSLog(@"objectDidEndEditing:%@", editor);
// [super objectDidEndEditing:editor];
//}
- (void)discardEditing {
[super discardEditing];
}
- (BOOL)commitEditing {
return [super commitEditing];
}
//- (BOOL)commitEditing {
// return [super commitEditing];
//}
//
//- (BOOL)commitEditingAndReturnError:(NSError * _Nullable __autoreleasing *)error {
// return [super commitEditingAndReturnError:error];
//}
//
//- (void)commitEditingWithDelegate:(id)delegate didCommitSelector:(SEL)didCommitSelector contextInfo:(void *)contextInfo {
// [super commitEditingWithDelegate:delegate didCommitSelector:didCommitSelector contextInfo:contextInfo];
//}
@end @end

View File

@@ -196,7 +196,7 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
if(!availableDefaults) { if(!availableDefaults) {
availableDefaults = [[NSMutableDictionary alloc] initWithCapacity:1]; availableDefaults = [[NSMutableDictionary alloc] initWithCapacity:1];
} }
availableDefaults[[self.entry.uuid UUIDString]] = entryDefaults; availableDefaults[[self.representedObject uuid].UUIDString] = entryDefaults;
[[NSUserDefaults standardUserDefaults] setObject:availableDefaults forKey:kMPSettingsKeyPasswordDefaultsForEntry]; [[NSUserDefaults standardUserDefaults] setObject:availableDefaults forKey:kMPSettingsKeyPasswordDefaultsForEntry];
} }
else if(!self.useEntryDefaults) { else if(!self.useEntryDefaults) {
@@ -218,7 +218,7 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
} }
NSMutableDictionary *availableDefaults = [[self _availableEntryDefaults] mutableCopy]; NSMutableDictionary *availableDefaults = [[self _availableEntryDefaults] mutableCopy];
NSAssert(availableDefaults, @"Password generator defaults for should be present!"); NSAssert(availableDefaults, @"Password generator defaults for should be present!");
[availableDefaults removeObjectForKey:[self.entry.uuid UUIDString]]; [availableDefaults removeObjectForKey:[self.representedObject uuid].UUIDString];
[[NSUserDefaults standardUserDefaults] setObject:availableDefaults forKey:kMPSettingsKeyPasswordDefaultsForEntry]; [[NSUserDefaults standardUserDefaults] setObject:availableDefaults forKey:kMPSettingsKeyPasswordDefaultsForEntry];
self.useEntryDefaults = NO; /* Resetting the UI and Defaults is handled via the setter */ self.useEntryDefaults = NO; /* Resetting the UI and Defaults is handled via the setter */
[self _updateSetDefaultsButton:NO]; [self _updateSetDefaultsButton:NO];