mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 11:42:30 +00:00
disabled more actions and controls in history view
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
<outlet property="obfuscateAutotypeCheckButton" destination="I7L-Am-Qpa" id="hwa-zl-24W"/>
|
||||
<outlet property="passwordTextField" destination="60" id="263"/>
|
||||
<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="showCustomEntrySequenceAutotypeBuilderButton" destination="HDS-Bz-jrr" id="7u1-17-oMK"/>
|
||||
<outlet property="tabView" destination="83" id="269"/>
|
||||
@@ -97,7 +98,7 @@
|
||||
<rect key="frame" x="20" y="26" width="253" height="396"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="F3N-QI-Di5">
|
||||
<rect key="frame" x="1" y="1" width="251" height="394"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<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"/>
|
||||
@@ -274,7 +275,7 @@
|
||||
<rect key="frame" x="16" y="50" width="261" height="372"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="k8G-zp-BXZ">
|
||||
<rect key="frame" x="1" y="1" width="259" height="370"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<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">
|
||||
<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 firstItem="82" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="leading" constant="20" symbolic="YES" id="zU6-5h-Swa"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="954.5" y="-506.5"/>
|
||||
<point key="canvasLocation" x="229" y="-549"/>
|
||||
</view>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
|
||||
<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 firstAttribute="bottom" secondItem="IpW-b2-jWu" secondAttribute="bottom" constant="20" symbolic="YES" id="w8h-As-nba"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="595" y="-523"/>
|
||||
<point key="canvasLocation" x="-132" y="-219"/>
|
||||
</customView>
|
||||
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
|
||||
<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="z03-zW-GN3" secondAttribute="trailing" constant="20" symbolic="YES" id="wiq-pY-TG8"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-153" y="-727"/>
|
||||
<point key="canvasLocation" x="-315" y="-755"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
@@ -743,11 +743,13 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
valid &= (nil != targetGroup);
|
||||
valid &= !targetGroup.isTrash;
|
||||
valid &= !targetGroup.isTrashed;
|
||||
valid &= !self.historyEntry;
|
||||
break;
|
||||
case MPActionAddEntry:
|
||||
valid &= (nil != targetGroup);
|
||||
valid &= !targetGroup.isTrash;
|
||||
valid &= !targetGroup.isTrashed;
|
||||
valid &= !self.historyEntry;
|
||||
break;
|
||||
case MPActionDelete:
|
||||
valid &= targetNodes.count > 0;
|
||||
@@ -760,7 +762,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
}
|
||||
break;
|
||||
case MPActionDuplicateEntry:
|
||||
case MPActionDuplicateEntryWithOptions:
|
||||
valid &= targetEntries.count > 0;
|
||||
valid &= !self.historyEntry;
|
||||
break;
|
||||
case MPActionEmptyTrash:
|
||||
valid &= (self.trash.groups.count + self.trash.entries.count) > 0;
|
||||
@@ -775,6 +779,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
case MPActionShowEntryHistory:
|
||||
valid &= (nil != targetEntry);
|
||||
valid &= targetEntry.history.count > 0;
|
||||
valid &= !self.historyEntry;
|
||||
break;
|
||||
/* Entry View Actions */
|
||||
case MPActionCopyUsername:
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
@property (weak) IBOutlet NSTextField *associationSequenceTextField;
|
||||
@property (weak) IBOutlet NSButton *addWindowAssociationButton;
|
||||
@property (weak) IBOutlet NSButton *removeWindowAssociationButton;
|
||||
|
||||
- (void)registerNotificationsForDocument:(MPDocument *)document;
|
||||
|
||||
|
||||
@@ -362,6 +362,31 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
#pragma mark -
|
||||
#pragma mark Entry Selection
|
||||
- (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 */
|
||||
[self.titleTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
@@ -419,10 +444,14 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(obfuscateDataTransfer))]
|
||||
options:nil];
|
||||
[self.customEntrySequenceTextField bind:NSEnabledBinding
|
||||
|
||||
/* Use enabled2 since NSEnabledBinding is already bound! */
|
||||
[self.customEntrySequenceTextField bind:@"enabled2"
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(enabled))]
|
||||
options:nil];
|
||||
|
||||
|
||||
[self.customEntrySequenceTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
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))]
|
||||
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}];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user