mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-19 19:09:38 +00:00
Replaced default attributes with new view controller editors
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MPEntryInspectorViewController">
|
||||
<connections>
|
||||
<outlet property="URLTextField" destination="56" id="262"/>
|
||||
<outlet property="addAttachmentButton" destination="177" id="w3F-U0-Rpk"/>
|
||||
<outlet property="addCustomFieldButton" destination="G9J-nn-2bu" id="vco-Lt-hkc"/>
|
||||
<outlet property="addWindowAssociationButton" destination="Iy9-9L-Aev" id="kDA-Mm-lah"/>
|
||||
@@ -18,23 +17,16 @@
|
||||
<outlet property="customEntrySequenceTextField" destination="cDK-DM-F5z" id="CDU-Oq-AHP"/>
|
||||
<outlet property="customFieldsTableView" destination="193" id="266"/>
|
||||
<outlet property="enableAutotypeCheckButton" destination="kdV-Xa-8p3" id="vlC-HP-lBv"/>
|
||||
<outlet property="expiresCheckButton" destination="7" id="286"/>
|
||||
<outlet property="fieldsStackView" destination="dx3-E2-FFt" id="GbY-9q-iEy"/>
|
||||
<outlet property="generalView" destination="4" id="270"/>
|
||||
<outlet property="generatePasswordButton" destination="59" id="282"/>
|
||||
<outlet property="infoTabControl" destination="82" id="264"/>
|
||||
<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="showCustomDataButton" destination="QSX-Xo-tcH" id="bqq-Rh-GOb"/>
|
||||
<outlet property="showCustomEntrySequenceAutotypeBuilderButton" destination="HDS-Bz-jrr" id="7u1-17-oMK"/>
|
||||
<outlet property="tabView" destination="83" id="269"/>
|
||||
<outlet property="tagsTokenField" destination="5" id="287"/>
|
||||
<outlet property="titleTextField" destination="53" id="260"/>
|
||||
<outlet property="togglePassword" destination="61" id="268"/>
|
||||
<outlet property="usernameTextField" destination="55" id="261"/>
|
||||
<outlet property="uuidTextField" destination="IpW-b2-jWu" id="dP6-qA-jJm"/>
|
||||
<outlet property="view" destination="3" id="250"/>
|
||||
<outlet property="windowAssociationsTableView" destination="caM-L6-UHC" id="n5M-f8-z24"/>
|
||||
@@ -58,12 +50,12 @@
|
||||
</segmentedCell>
|
||||
</segmentedControl>
|
||||
<tabView drawsBackground="NO" type="noTabsNoBorder" initialItem="110" translatesAutoresizingMaskIntoConstraints="NO" id="83">
|
||||
<rect key="frame" x="0.0" y="0.0" width="273" height="467"/>
|
||||
<rect key="frame" x="0.0" y="60" width="273" height="407"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<tabViewItems>
|
||||
<tabViewItem label="General" identifier="1" id="110">
|
||||
<view key="view" id="111">
|
||||
<rect key="frame" x="0.0" y="0.0" width="273" height="467"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="273" height="407"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</view>
|
||||
</tabViewItem>
|
||||
@@ -248,18 +240,30 @@
|
||||
</tabViewItem>
|
||||
</tabViewItems>
|
||||
</tabView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ESJ-wu-D4P">
|
||||
<rect key="frame" x="108" y="13" width="58" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Edit" alternateTitle="Done" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="hJ8-Kw-czh">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="toggleEdit:" target="-2" id="Odr-gt-fBV"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="83" firstAttribute="leading" secondItem="3" secondAttribute="leading" id="85"/>
|
||||
<constraint firstItem="83" firstAttribute="trailing" secondItem="3" secondAttribute="trailing" id="86"/>
|
||||
<constraint firstItem="82" firstAttribute="top" secondItem="3" secondAttribute="top" constant="5" id="89"/>
|
||||
<constraint firstAttribute="centerX" secondItem="82" secondAttribute="centerX" id="90"/>
|
||||
<constraint firstItem="83" firstAttribute="bottom" secondItem="3" secondAttribute="bottom" id="254"/>
|
||||
<constraint firstItem="83" firstAttribute="top" secondItem="3" secondAttribute="top" constant="26" id="279"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="82" secondAttribute="trailing" constant="20" symbolic="YES" id="4df-0Y-ggz"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ESJ-wu-D4P" secondAttribute="bottom" constant="20" symbolic="YES" id="OGC-4z-9MD"/>
|
||||
<constraint firstItem="ESJ-wu-D4P" firstAttribute="centerX" secondItem="3" secondAttribute="centerX" id="bEP-z8-ndT"/>
|
||||
<constraint firstItem="ESJ-wu-D4P" firstAttribute="top" secondItem="83" secondAttribute="bottom" constant="20" symbolic="YES" id="wQY-dE-8bJ"/>
|
||||
<constraint firstItem="82" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="leading" constant="20" symbolic="YES" id="zU6-5h-Swa"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-457" y="-1614"/>
|
||||
<point key="canvasLocation" x="-457.5" y="-1614.5"/>
|
||||
</view>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
|
||||
<rect key="frame" x="0.0" y="0.0" width="291" height="840"/>
|
||||
@@ -291,7 +295,6 @@
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="showPluginData:" target="-1" id="yGe-GL-mcW"/>
|
||||
<outlet property="nextKeyView" destination="53" id="HTB-dl-8aH"/>
|
||||
</connections>
|
||||
</button>
|
||||
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G9J-nn-2bu" customClass="MPContextButton">
|
||||
@@ -309,162 +312,8 @@
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="250" verticalStackHuggingPriority="250" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dx3-E2-FFt">
|
||||
<rect key="frame" x="20" y="491" width="251" height="329"/>
|
||||
<rect key="frame" x="20" y="721" width="251" height="99"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="52">
|
||||
<rect key="frame" x="-2" y="315" width="255" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Title" id="71">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="53" customClass="HNHUITextField">
|
||||
<rect key="frame" x="0.0" y="286" width="251" height="21"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="70">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="pQH-Xf-3pz"/>
|
||||
<outlet property="nextKeyView" destination="55" id="FgE-cj-E5Z"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="54">
|
||||
<rect key="frame" x="-2" y="264" width="255" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Username" id="69">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="55" customClass="HNHUITextField">
|
||||
<rect key="frame" x="0.0" y="236" width="251" height="20"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="68">
|
||||
<font key="font" size="13" name="Menlo-Regular"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="22y-I8-aaG"/>
|
||||
<outlet property="nextKeyView" destination="60" id="ZPp-lg-TBS"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="58">
|
||||
<rect key="frame" x="-2" y="214" width="255" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Password" id="65">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalHuggingPriority="249" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="C4J-K4-QBG">
|
||||
<rect key="frame" x="0.0" y="186" width="251" height="20"/>
|
||||
<subviews>
|
||||
<secureTextField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" allowsCharacterPickerTouchBarItem="YES" contentType="oneTimeCode" translatesAutoresizingMaskIntoConstraints="NO" id="60" customClass="HNHUISecureTextField">
|
||||
<rect key="frame" x="0.0" y="0.0" width="123" height="20"/>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="63" customClass="HNHUISecureTextFieldCell">
|
||||
<font key="font" size="13" name="Menlo-Regular"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<allowedInputSourceLocales>
|
||||
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
|
||||
</allowedInputSourceLocales>
|
||||
</secureTextFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="RBf-26-U9y"/>
|
||||
<outlet property="nextKeyView" destination="61" id="5yc-GS-oVG"/>
|
||||
</connections>
|
||||
</secureTextField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="61">
|
||||
<rect key="frame" x="124" y="-7" width="50" height="32"/>
|
||||
<buttonCell key="cell" type="push" bezelStyle="rounded" image="NSQuickLookTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="62">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<outlet property="nextKeyView" destination="59" id="ZRe-l9-kNq"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="59">
|
||||
<rect key="frame" x="168" y="-7" width="90" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Generate" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="64">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="showPasswordGenerator:" target="-2" id="xxV-lD-L1K"/>
|
||||
<outlet property="nextKeyView" destination="56" id="rY0-PH-WBT"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="57">
|
||||
<rect key="frame" x="-2" y="164" width="255" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="URL" id="66">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="56" customClass="HNHUITextField">
|
||||
<rect key="frame" x="0.0" y="135" width="251" height="21"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="67">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="LzV-u6-mkP"/>
|
||||
<outlet property="nextKeyView" destination="7" id="8Vo-ZR-aWE"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalHuggingPriority="248" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="buA-UH-XId">
|
||||
<rect key="frame" x="0.0" y="107" width="251" height="20"/>
|
||||
<subviews>
|
||||
<button horizontalHuggingPriority="249" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="7">
|
||||
<rect key="frame" x="-2" y="1" width="214" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Expires" bezelStyle="regularSquare" imagePosition="left" lineBreakMode="truncatingMiddle" state="on" inset="2" id="78">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="toggleExpire:" target="-2" id="EBe-2q-ASh"/>
|
||||
<outlet property="nextKeyView" destination="8" id="SbJ-ZA-mXZ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8">
|
||||
<rect key="frame" x="213" y="-7" width="45" height="32"/>
|
||||
<buttonCell key="cell" type="push" bezelStyle="rounded" image="NSActionTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="77">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="pickExpiryDate:" target="-1" id="DQK-sp-SIL"/>
|
||||
<outlet property="nextKeyView" destination="5" id="cVg-qt-OBX"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6">
|
||||
<rect key="frame" x="-2" y="85" width="255" height="14"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Tags" id="79">
|
||||
@@ -491,28 +340,10 @@
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
</subviews>
|
||||
@@ -878,7 +709,6 @@
|
||||
<image name="NSActionTemplate" width="15" height="15"/>
|
||||
<image name="NSAddTemplate" width="14" height="13"/>
|
||||
<image name="NSLockLockedTemplate" width="14" height="15"/>
|
||||
<image name="NSQuickLookTemplate" width="21" height="13"/>
|
||||
<image name="NSRemoveTemplate" width="14" height="4"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -101,8 +101,8 @@ NSString *nameForDefaultKey(NSString *key) {
|
||||
|
||||
}
|
||||
_isDefaultAttribute = self.representedAttribute.isDefault;
|
||||
[self updateValues];
|
||||
[self updateEditing];
|
||||
[self updateValues];
|
||||
}
|
||||
|
||||
-(void)commitChanges {
|
||||
@@ -160,7 +160,7 @@ NSString *nameForDefaultKey(NSString *key) {
|
||||
}
|
||||
|
||||
- (void)updateValues {
|
||||
self.view.hidden = (!self.isEditor && self.representedAttribute.value.length == 0);
|
||||
self.view.hidden = self.isEditor ? NO : self.representedAttribute.value.length == 0;
|
||||
|
||||
NSString *localizedKey = nameForDefaultKey(self.representedAttribute.key);
|
||||
if(localizedKey) {
|
||||
@@ -176,12 +176,13 @@ NSString *nameForDefaultKey(NSString *key) {
|
||||
}
|
||||
|
||||
- (void)updateEditing {
|
||||
self.view.hidden = self.isEditor ? NO : self.representedAttribute.value.length == 0;
|
||||
self.keyTextField.editable = !_isDefaultAttribute && self.isEditor;
|
||||
self.valueTextField.editable = self.isEditor;
|
||||
self.keyTextField.selectable = YES;
|
||||
self.valueTextField.selectable = YES;
|
||||
self.toggleProtectedButton.hidden = _isDefaultAttribute;
|
||||
self.removeButton.hidden = !self.isEditor || (self.isEditor && !_isDefaultAttribute);
|
||||
self.removeButton.hidden = !self.isEditor ? YES : _isDefaultAttribute;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -36,14 +36,7 @@
|
||||
@property (weak) IBOutlet NSTabView *tabView;
|
||||
@property (strong) IBOutlet NSView *generalView;
|
||||
|
||||
@property (weak) IBOutlet NSTextField *titleTextField;
|
||||
@property (weak) IBOutlet NSTextField *usernameTextField;
|
||||
@property (weak) IBOutlet NSTextField *URLTextField;
|
||||
@property (weak) IBOutlet HNHUISecureTextField *passwordTextField;
|
||||
@property (weak) IBOutlet NSButton *generatePasswordButton;
|
||||
@property (weak) IBOutlet NSButton *togglePassword;
|
||||
@property (weak) IBOutlet NSButton *pickExpireDateButton;
|
||||
@property (weak) IBOutlet NSButton *expiresCheckButton;
|
||||
//@property (weak) IBOutlet NSTextField *titleTextField;
|
||||
@property (weak) IBOutlet NSTokenField *tagsTokenField;
|
||||
@property (weak) IBOutlet NSTextField *uuidTextField;
|
||||
|
||||
@@ -99,4 +92,6 @@
|
||||
- (IBAction)toggleQuicklookPreview:(id)sender;
|
||||
- (IBAction)toggleExpire:(NSButton*)sender;
|
||||
|
||||
- (IBAction)toggleEdit:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -79,19 +79,19 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
MPTagsTokenFieldDelegate *_tagTokenFieldDelegate;
|
||||
MPAddCustomFieldContextMenuDelegate *_addCustomFieldContextMenuDelegate;
|
||||
|
||||
NSMutableArray<NSViewController<MPInspectorEditor> *> *_customAttributeEditorViewControllers;
|
||||
|
||||
MPEntryAttributeViewController *_titleEditorViewController;
|
||||
MPEntryAttributeViewController *_usernameEditorViewController;
|
||||
MPEntryAttributeViewController *_urlEditorViewController;
|
||||
MPNodeExpirationViewController *_expiresEditorViewController;
|
||||
MPEntryPasswordAttributeViewController *_passwordEditorViewController;
|
||||
NSMutableArray<NSViewController<MPAttributeInspectorEditor> *> *_customAttributeEditorViewControllers;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) BOOL showPassword;
|
||||
@property (nonatomic, assign) MPEntryTab activeTab;
|
||||
@property (nonatomic, readonly) KPKEntry *representedEntry;
|
||||
@property (strong) MPTOTPViewController *totpViewController;
|
||||
@property (strong) MPEntryAttributeViewController *titleEditorViewController;
|
||||
@property (strong) MPEntryAttributeViewController *usernameEditorViewController;
|
||||
@property (strong) MPEntryAttributeViewController *urlEditorViewController;
|
||||
@property (strong) MPNodeExpirationViewController *expiresEditorViewController;
|
||||
@property (strong) MPEntryPasswordAttributeViewController *passwordEditorViewController;
|
||||
|
||||
|
||||
@property (strong) MPTemporaryFileStorage *quicklookStorage;
|
||||
|
||||
@@ -139,6 +139,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
if(self.representedObject) {
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKWillChangeEntryNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKDidChangeEntryNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKWillAddAttributeNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKDidAddAttributeNotification object:self.representedEntry];
|
||||
}
|
||||
super.representedObject = representedObject;
|
||||
|
||||
@@ -148,6 +150,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
if(self.representedEntry) {
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_willChangeEntry:) name:KPKWillChangeEntryNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didChangeEntry:) name:KPKDidChangeEntryNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_willAddAttribute:) name:KPKWillAddAttributeNotification object:self.representedEntry];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didAddAttribute:) name:KPKDidAddAttributeNotification object:self.representedEntry];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +207,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
|
||||
self.windowTitleComboBox.delegate = _windowTitleMenuDelegate;
|
||||
|
||||
[self.passwordTextField bind:NSStringFromSelector(@selector(showPassword)) toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
|
||||
[self.togglePassword bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
|
||||
//[self.passwordTextField bind:NSStringFromSelector(@selector(showPassword)) toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
|
||||
//[self.togglePassword bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
|
||||
|
||||
self.tagsTokenField.delegate = _tagTokenFieldDelegate;
|
||||
|
||||
@@ -330,6 +334,16 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleEdit:(id)sender {
|
||||
// commit changes in editors!
|
||||
self.titleEditorViewController.isEditor = !self.titleEditorViewController.isEditor;
|
||||
self.usernameEditorViewController.isEditor = !self.usernameEditorViewController.isEditor;
|
||||
self.passwordEditorViewController.isEditor = !self.passwordEditorViewController.isEditor;
|
||||
self.urlEditorViewController.isEditor = !self.urlEditorViewController.isEditor;
|
||||
self.expiresEditorViewController.isEditor = !self.expiresEditorViewController.isEditor;
|
||||
//self.totpViewController.isEditor = !self.totpViewController.isEditor;
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
||||
switch([MPActionHelper typeForAction:menuItem.action]) {
|
||||
case MPActionToggleQuicklook: {
|
||||
@@ -400,7 +414,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
}
|
||||
|
||||
- (IBAction)showPasswordGenerator:(id)sender {
|
||||
self.generatePasswordButton.enabled = NO;
|
||||
//self.generatePasswordButton.enabled = NO;
|
||||
MPPasswordCreatorViewController *viewController = [[MPPasswordCreatorViewController alloc] init];
|
||||
viewController.allowsEntryDefaults = YES;
|
||||
viewController.representedObject = self.representedObject;
|
||||
@@ -430,7 +444,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
self.showCustomEntrySequenceAutotypeBuilderButton.enabled = YES;
|
||||
}
|
||||
else if([viewController isKindOfClass:MPPasswordCreatorViewController.class]) {
|
||||
self.generatePasswordButton.enabled = YES;
|
||||
//self.generatePasswordButton.enabled = YES;
|
||||
}
|
||||
[super dismissViewController:viewController];
|
||||
}
|
||||
@@ -494,13 +508,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
|
||||
- (void)_setupViewBindings {
|
||||
/* Disable for history view */
|
||||
NSArray *inputs = @[self.titleTextField,
|
||||
self.passwordTextField,
|
||||
self.usernameTextField,
|
||||
self.URLTextField,
|
||||
self.expiresCheckButton,
|
||||
NSArray *inputs = @[
|
||||
self.tagsTokenField,
|
||||
self.generatePasswordButton,
|
||||
self.addAttachmentButton,
|
||||
self.addCustomFieldButton,
|
||||
self.addWindowAssociationButton,
|
||||
@@ -522,35 +531,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
NSDictionary *nullPlaceholderBindingOptionsDict = @{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "Placeholder text for input fields if no entry or group is selected")};
|
||||
NSDictionary *prettyPasswordBindingOptionsDict = @{ NSNullPlaceholderBindingOption: nullPlaceholderBindingOptionsDict[NSNullPlaceholderBindingOption], NSValueTransformerNameBindingOption : MPPrettyPasswordTransformerName };
|
||||
|
||||
[self.titleTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(title))]
|
||||
options:nullPlaceholderBindingOptionsDict];
|
||||
[self.passwordTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(password))]
|
||||
options:prettyPasswordBindingOptionsDict];
|
||||
|
||||
[self.usernameTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(username))]
|
||||
options:nullPlaceholderBindingOptionsDict];
|
||||
|
||||
[self.URLTextField bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(url))]
|
||||
options:nullPlaceholderBindingOptionsDict];
|
||||
|
||||
[self.expiresCheckButton bind:NSTitleBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expirationDate))]
|
||||
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformerName }];
|
||||
|
||||
[self.expiresCheckButton bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expires))]
|
||||
options:nil];
|
||||
|
||||
[self.tagsTokenField bind:NSValueBinding
|
||||
toObject:self
|
||||
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(tags))]
|
||||
@@ -623,52 +603,61 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
}
|
||||
|
||||
- (void)_setupAttributeEditors {
|
||||
self.titleEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
self.titleEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.titleEditorViewController.view];
|
||||
|
||||
self.usernameEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
self.usernameEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.usernameEditorViewController.view];
|
||||
|
||||
self.passwordEditorViewController = [[MPEntryPasswordAttributeViewController alloc] init];
|
||||
self.passwordEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.passwordEditorViewController.view];
|
||||
|
||||
self.urlEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
self.urlEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.urlEditorViewController.view];
|
||||
|
||||
self.totpViewController = [[MPTOTPViewController alloc] init];
|
||||
|
||||
NSInteger urlindex = [self.fieldsStackView.arrangedSubviews indexOfObject:self.URLTextField];
|
||||
NSAssert(urlindex != NSNotFound, @"Missing reference view. This should not happen!");
|
||||
[self addChildViewController:self.totpViewController];
|
||||
[self.fieldsStackView insertArrangedSubview:self.totpViewController.view atIndex:urlindex - 1];
|
||||
|
||||
_titleEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
_titleEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:_titleEditorViewController.view];
|
||||
//self.totpViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.totpViewController.view];
|
||||
|
||||
_usernameEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
_usernameEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:_usernameEditorViewController.view];
|
||||
|
||||
_passwordEditorViewController = [[MPEntryPasswordAttributeViewController alloc] init];
|
||||
_passwordEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:_passwordEditorViewController.view];
|
||||
|
||||
_urlEditorViewController = [[MPEntryAttributeViewController alloc] init];
|
||||
_urlEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:_urlEditorViewController.view];
|
||||
|
||||
_expiresEditorViewController = [[MPNodeExpirationViewController alloc] init];
|
||||
_expiresEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:_expiresEditorViewController.view];
|
||||
self.expiresEditorViewController = [[MPNodeExpirationViewController alloc] init];
|
||||
self.expiresEditorViewController.isEditor = NO;
|
||||
[self.fieldsStackView addArrangedSubview:self.expiresEditorViewController.view];
|
||||
}
|
||||
|
||||
- (void)_updateEditors {
|
||||
self.totpViewController.representedObject = self.representedObject;
|
||||
self.expiresEditorViewController.representedObject = self.representedEntry.timeInfo;
|
||||
|
||||
_titleEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKTitleKey];
|
||||
_usernameEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKUsernameKey];
|
||||
_passwordEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKPasswordKey];
|
||||
_urlEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKURLKey];
|
||||
_expiresEditorViewController.representedObject = self.representedEntry.timeInfo;
|
||||
self.titleEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKTitleKey];
|
||||
self.usernameEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKUsernameKey];
|
||||
self.passwordEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKPasswordKey];
|
||||
self.urlEditorViewController.representedObject = [self.representedEntry attributeWithKey:kKPKURLKey];
|
||||
|
||||
// update custom field editors
|
||||
if(!self.representedEntry.hasCustomAttributes) {
|
||||
// clear all custom attribute editors
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark HNHUITextFieldDelegate
|
||||
- (BOOL)textField:(NSTextField *)textField allowServicesForTextView:(NSTextView *)textView {
|
||||
/* disallow servies for password fields */
|
||||
if(textField == self.passwordTextField) {
|
||||
|
||||
/*
|
||||
FIXME: Add to MPEntryPasswordViewController
|
||||
if(textField == self.passwordTextField) {
|
||||
return NO;
|
||||
}
|
||||
*/
|
||||
NSInteger index = MPCustomFieldIndexFromTag(textField.tag);
|
||||
if(index > -1) {
|
||||
KPKAttribute *attribute = _customFieldsController.arrangedObjects[index];
|
||||
@@ -705,6 +694,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
if(selectedValue.length == 0) {
|
||||
return YES;
|
||||
}
|
||||
/* FIXME: Add to AttributeViewController
|
||||
if(textField == self.usernameTextField) {
|
||||
info = MPPasteboardOverlayInfoUsername;
|
||||
}
|
||||
@@ -714,12 +704,9 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
else if(textField == self.URLTextField) {
|
||||
info = MPPasteboardOverlayInfoURL;
|
||||
}
|
||||
else if(textField == self.uuidTextField) {
|
||||
else*/ if(textField == self.uuidTextField) {
|
||||
name = NSLocalizedString(@"UUID", "Displayed name when uuid field was copied");
|
||||
}
|
||||
else if(textField == self.titleTextField) {
|
||||
name = NSLocalizedString(@"TITLE", "Displayed name when title field was copied");
|
||||
}
|
||||
else {
|
||||
NSInteger index = MPCustomFieldIndexFromTag(textField.tag);
|
||||
if(index > -1) {
|
||||
@@ -733,9 +720,13 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
}
|
||||
|
||||
- (IBAction)toggleExpire:(NSButton*)sender {
|
||||
if([sender state] == NSOnState && [self.representedEntry.timeInfo.expirationDate isEqualToDate:NSDate.distantFuture]) {
|
||||
|
||||
/*
|
||||
FIXME: Add to expiredViewController
|
||||
if([sender state] == NSOnState && [self.representedEntry.timeInfo.expirationDate isEqualToDate:NSDate.distantFuture]) {
|
||||
[NSApp sendAction:self.pickExpireDateButton.action to:nil from:self.pickExpireDateButton];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -743,7 +734,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
|
||||
- (void)_didAddEntry:(NSNotification *)notification {
|
||||
[self.tabView selectTabViewItemAtIndex:MPEntryTabGeneral];
|
||||
[self.titleTextField becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (void)_didChangeCurrentItem:(NSNotification *)notificiation {
|
||||
@@ -769,4 +759,19 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
- (void)_didChangeAttribute:(NSNotification *)notification {
|
||||
}
|
||||
|
||||
- (void)_willAddAttribute:(NSNotification *)notification {
|
||||
|
||||
}
|
||||
|
||||
- (void)_didAddAttribute:(NSNotification *)notification {
|
||||
// TODO: add attribute editor to stackview
|
||||
}
|
||||
|
||||
- (void)_willRemoveAttribute:(NSNotification *)notification {
|
||||
// TODO: remove attribute editor form stackview
|
||||
}
|
||||
|
||||
- (void)_didRemoveAttribute:(NSNotification *)notification {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user