disabled more actions and controls in history view

This commit is contained in:
michael starke
2017-06-08 15:39:29 +02:00
parent 68ed110c4c
commit 6771d68454
4 changed files with 47 additions and 30 deletions

View File

@@ -24,6 +24,7 @@
<outlet property="obfuscateAutotypeCheckButton" destination="I7L-Am-Qpa" id="hwa-zl-24W"/> <outlet property="obfuscateAutotypeCheckButton" destination="I7L-Am-Qpa" id="hwa-zl-24W"/>
<outlet property="passwordTextField" destination="60" id="263"/> <outlet property="passwordTextField" destination="60" id="263"/>
<outlet property="pickExpireDateButton" destination="8" id="cJg-5V-AL6"/> <outlet property="pickExpireDateButton" destination="8" id="cJg-5V-AL6"/>
<outlet property="removeWindowAssociationButton" destination="AAj-Ak-z46" id="KJD-It-16t"/>
<outlet property="showCustomAssociationSequenceAutotypeBuilderButton" destination="m1C-m8-BKR" id="B3I-AG-TCJ"/> <outlet property="showCustomAssociationSequenceAutotypeBuilderButton" destination="m1C-m8-BKR" id="B3I-AG-TCJ"/>
<outlet property="showCustomEntrySequenceAutotypeBuilderButton" destination="HDS-Bz-jrr" id="7u1-17-oMK"/> <outlet property="showCustomEntrySequenceAutotypeBuilderButton" destination="HDS-Bz-jrr" id="7u1-17-oMK"/>
<outlet property="tabView" destination="83" id="269"/> <outlet property="tabView" destination="83" id="269"/>
@@ -97,7 +98,7 @@
<rect key="frame" x="20" y="26" width="253" height="396"/> <rect key="frame" x="20" y="26" width="253" height="396"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="F3N-QI-Di5"> <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="F3N-QI-Di5">
<rect key="frame" x="1" y="1" width="251" height="394"/> <rect key="frame" x="1" y="1" width="251" height="394"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="36" rowSizeStyle="automatic" viewBased="YES" id="137"> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="36" rowSizeStyle="automatic" viewBased="YES" id="137">
<rect key="frame" x="0.0" y="0.0" width="251" height="394"/> <rect key="frame" x="0.0" y="0.0" width="251" height="394"/>
@@ -274,7 +275,7 @@
<rect key="frame" x="16" y="50" width="261" height="372"/> <rect key="frame" x="16" y="50" width="261" height="372"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="k8G-zp-BXZ"> <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="k8G-zp-BXZ">
<rect key="frame" x="1" y="1" width="259" height="370"/> <rect key="frame" x="1" y="1" width="259" height="370"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" rowSizeStyle="automatic" viewBased="YES" id="193"> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" rowSizeStyle="automatic" viewBased="YES" id="193">
<rect key="frame" x="0.0" y="0.0" width="259" height="370"/> <rect key="frame" x="0.0" y="0.0" width="259" height="370"/>
@@ -463,7 +464,7 @@
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="82" secondAttribute="trailing" constant="20" symbolic="YES" id="4df-0Y-ggz"/> <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"/> <constraint firstItem="82" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="leading" constant="20" symbolic="YES" id="zU6-5h-Swa"/>
</constraints> </constraints>
<point key="canvasLocation" x="954.5" y="-506.5"/> <point key="canvasLocation" x="229" y="-549"/>
</view> </view>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="291" height="457"/> <rect key="frame" x="0.0" y="0.0" width="291" height="457"/>
@@ -696,7 +697,7 @@
<constraint firstItem="57" firstAttribute="top" secondItem="59" secondAttribute="bottom" constant="8" symbolic="YES" id="lYe-am-xJx"/> <constraint firstItem="57" firstAttribute="top" secondItem="59" secondAttribute="bottom" constant="8" symbolic="YES" id="lYe-am-xJx"/>
<constraint firstAttribute="bottom" secondItem="IpW-b2-jWu" secondAttribute="bottom" constant="20" symbolic="YES" id="w8h-As-nba"/> <constraint firstAttribute="bottom" secondItem="IpW-b2-jWu" secondAttribute="bottom" constant="20" symbolic="YES" id="w8h-As-nba"/>
</constraints> </constraints>
<point key="canvasLocation" x="595" y="-523"/> <point key="canvasLocation" x="-132" y="-219"/>
</customView> </customView>
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter"> <view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="301" height="424"/> <rect key="frame" x="0.0" y="0.0" width="301" height="424"/>
@@ -951,7 +952,7 @@
<constraint firstAttribute="trailing" secondItem="45R-v4-ywl" secondAttribute="trailing" constant="20" symbolic="YES" id="uUm-S5-cxM"/> <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"/> <constraint firstAttribute="trailing" secondItem="z03-zW-GN3" secondAttribute="trailing" constant="20" symbolic="YES" id="wiq-pY-TG8"/>
</constraints> </constraints>
<point key="canvasLocation" x="-153" y="-727"/> <point key="canvasLocation" x="-315" y="-755"/>
</view> </view>
</objects> </objects>
<resources> <resources>

View File

@@ -743,11 +743,13 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
valid &= (nil != targetGroup); valid &= (nil != targetGroup);
valid &= !targetGroup.isTrash; valid &= !targetGroup.isTrash;
valid &= !targetGroup.isTrashed; valid &= !targetGroup.isTrashed;
valid &= !self.historyEntry;
break; break;
case MPActionAddEntry: case MPActionAddEntry:
valid &= (nil != targetGroup); valid &= (nil != targetGroup);
valid &= !targetGroup.isTrash; valid &= !targetGroup.isTrash;
valid &= !targetGroup.isTrashed; valid &= !targetGroup.isTrashed;
valid &= !self.historyEntry;
break; break;
case MPActionDelete: case MPActionDelete:
valid &= targetNodes.count > 0; valid &= targetNodes.count > 0;
@@ -760,7 +762,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
} }
break; break;
case MPActionDuplicateEntry: case MPActionDuplicateEntry:
case MPActionDuplicateEntryWithOptions:
valid &= targetEntries.count > 0; valid &= targetEntries.count > 0;
valid &= !self.historyEntry;
break; break;
case MPActionEmptyTrash: case MPActionEmptyTrash:
valid &= (self.trash.groups.count + self.trash.entries.count) > 0; valid &= (self.trash.groups.count + self.trash.entries.count) > 0;
@@ -775,6 +779,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
case MPActionShowEntryHistory: case MPActionShowEntryHistory:
valid &= (nil != targetEntry); valid &= (nil != targetEntry);
valid &= targetEntry.history.count > 0; valid &= targetEntry.history.count > 0;
valid &= !self.historyEntry;
break; break;
/* Entry View Actions */ /* Entry View Actions */
case MPActionCopyUsername: case MPActionCopyUsername:

View File

@@ -55,6 +55,7 @@
@property (weak) IBOutlet NSTextField *associationSequenceTextField; @property (weak) IBOutlet NSTextField *associationSequenceTextField;
@property (weak) IBOutlet NSButton *addWindowAssociationButton; @property (weak) IBOutlet NSButton *addWindowAssociationButton;
@property (weak) IBOutlet NSButton *removeWindowAssociationButton;
- (void)registerNotificationsForDocument:(MPDocument *)document; - (void)registerNotificationsForDocument:(MPDocument *)document;

View File

@@ -362,6 +362,31 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
#pragma mark - #pragma mark -
#pragma mark Entry Selection #pragma mark Entry Selection
- (void)_setupViewBindings { - (void)_setupViewBindings {
/* Disable for history view */
NSArray *inputs = @[self.titleTextField,
self.passwordTextField,
self.usernameTextField,
self.URLTextField,
self.expiresCheckButton,
self.tagsTokenField,
self.generatePasswordButton,
self.addAttachmentButton,
self.addCustomFieldButton,
self.addWindowAssociationButton,
self.removeWindowAssociationButton,
self.enableAutotypeCheckButton,
self.obfuscateAutotypeCheckButton,
self.customEntrySequenceTextField,
self.windowTitleComboBox,
self.associationSequenceTextField];
for(NSControl *control in inputs) {
[control bind:NSEnabledBinding
toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(isHistory))]
options:@{NSConditionallySetsEditableBindingOption: @NO, NSValueTransformerNameBindingOption: NSNegateBooleanTransformerName}];
}
/* general */ /* general */
[self.titleTextField bind:NSValueBinding [self.titleTextField bind:NSValueBinding
toObject:self toObject:self
@@ -419,10 +444,14 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
toObject:self toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), 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
/* Use enabled2 since NSEnabledBinding is already bound! */
[self.customEntrySequenceTextField bind:@"enabled2"
toObject:self toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), 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 toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(defaultKeystrokeSequence))] withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(defaultKeystrokeSequence))]
@@ -442,25 +471,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
withKeyPath:[NSString stringWithFormat:@"selection.%@", NSStringFromSelector(@selector(keystrokeSequence))] withKeyPath:[NSString stringWithFormat:@"selection.%@", NSStringFromSelector(@selector(keystrokeSequence))]
options:nil]; options:nil];
NSArray *inputs = @[self.titleTextField,
self.passwordTextField,
self.usernameTextField,
self.URLTextField,
self.expiresCheckButton,
self.tagsTokenField,
self.generatePasswordButton,
self.addAttachmentButton,
self.addCustomFieldButton,
self.addWindowAssociationButton];
for(NSControl *control in inputs) {
NSString *keyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(isHistory))];
[control bind:NSEnabledBinding
toObject:self
withKeyPath:keyPath
options:@{NSConditionallySetsEditableBindingOption: @NO, NSValueTransformerNameBindingOption: NSNegateBooleanTransformerName}];
}
} }