Interims update

This commit is contained in:
michael starke
2016-06-16 19:22:02 +02:00
parent f3f0d27a3f
commit 7a09cb9588
5 changed files with 31 additions and 77 deletions

View File

@@ -448,7 +448,7 @@
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="82" secondAttribute="trailing" constant="20" symbolic="YES" id="4df-0Y-ggz"/>
<constraint firstItem="82" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="leading" constant="20" symbolic="YES" id="zU6-5h-Swa"/>
</constraints>
<point key="canvasLocation" x="19.5" y="144.5"/>
<point key="canvasLocation" x="494.5" y="-467.5"/>
</view>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="252" height="457"/>
@@ -681,7 +681,7 @@
<constraint firstItem="0U8-TS-giU" firstAttribute="leading" secondItem="4" secondAttribute="leading" constant="20" id="kLH-Bj-C5m"/>
<constraint firstItem="57" firstAttribute="top" secondItem="59" secondAttribute="bottom" constant="8" symbolic="YES" id="lYe-am-xJx"/>
</constraints>
<point key="canvasLocation" x="355" y="-371.5"/>
<point key="canvasLocation" x="142" y="-483.5"/>
</customView>
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="301" height="424"/>
@@ -930,7 +930,7 @@
<constraint firstAttribute="trailing" secondItem="45R-v4-ywl" secondAttribute="trailing" constant="20" symbolic="YES" id="uUm-S5-cxM"/>
<constraint firstAttribute="trailing" secondItem="z03-zW-GN3" secondAttribute="trailing" constant="20" symbolic="YES" id="wiq-pY-TG8"/>
</constraints>
<point key="canvasLocation" x="19.5" y="-388"/>
<point key="canvasLocation" x="-205.5" y="-500"/>
</view>
</objects>
<resources>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPContextBarViewController">
@@ -223,6 +223,7 @@
</connections>
</tabViewItem>
</tabViewItems>
<point key="canvasLocation" x="157" y="476"/>
</tabView>
</objects>
</document>

View File

@@ -438,14 +438,14 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
[self.enableAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(isEnabled))] options:nil];
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))] options:nil];
[self.obfuscateAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(obfuscateDataTransfer))]
options:nil];
[self.customEntrySequenceTextField bind:NSEnabledBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(isEnabled))]
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))]
options:nil];
[self.customEntrySequenceTextField bind:NSValueBinding
toObject:self.entryController

View File

@@ -9,93 +9,36 @@
#import "MPEntryProxy.h"
#import <KeePassKit/KeePassKit.h>
@interface MPSubEntryProxy : NSProxy
@property (weak) MPEntryProxy *entryProxy;
@property (nonatomic, readonly) id target;
- (instancetype)initWithEntryProxy:(MPEntryProxy *)entryProxy;
@end
@implementation MPSubEntryProxy
- (instancetype)initWithEntryProxy:(MPEntryProxy *)entryProxy {
_entryProxy = entryProxy;
return self;
}
- (id)target {
return nil;
}
@end
@interface MPAutotypeProxy : MPSubEntryProxy
@end
@implementation MPAutotypeProxy
- (id)target {
return self.entryProxy.entry.autotype;
}
@end
@interface MPTimeInfoProxy : MPSubEntryProxy
@end
@implementation MPTimeInfoProxy
- (id)target {
return self.entryProxy.entry.timeInfo;
}
@end
#pragma mark -
@interface MPEntryProxy ()
@property (strong) KPKEntry *entry;
@property (strong) KPKEntry *changedEntry;
@property BOOL firstModification;
@end
@implementation MPEntryProxy
- (NSSet *)mutatingSelectors {
static NSSet *set;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
set = [NSSet setWithArray:@[ [NSValue valueWithPointer:@selector(addCustomAttribute:)],
[NSValue valueWithPointer:@selector(removeCustomAttribute:)],
[NSValue valueWithPointer:@selector(addBinary:)],
[NSValue valueWithPointer:@selector(removeBinary:)],
[NSValue valueWithPointer:@selector(addAssociation:)],
[NSValue valueWithPointer:@selector(removeAssociation:)] ]];
});
return set;
}
- (instancetype)initWithEntry:(KPKEntry *)entry {
if(!entry) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:nil userInfo:nil];
}
_entry = entry;
_firstModification = NO;
return self;
}
- (void)forwardInvocation:(NSInvocation *)invocation {
NSString *seletor = NSStringFromSelector(invocation.selector);
if([[self mutatingSelectors] containsObject:[NSValue valueWithPointer:invocation.selector]]) {
NSLog(@"Mutation detected.");
}
if([seletor hasPrefix:@"set"]) {
NSLog(@"forwardInvocation: setter detected");
if(invocation.selector == @selector(touchModified)) {
if(self.firstModification) {
[self.entry pushHistory];
self.firstModification = YES;
}
NSLog(@"Possible mutation detected. Creating backup!");
}
invocation.target = self.entry;
[invocation invoke];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {