Changed layout for Autotype builder. Using new KeePassKit API

This commit is contained in:
michael starke
2017-05-19 19:24:24 +02:00
parent 3b8e0a7ae2
commit 6eea1ed48e
4 changed files with 63 additions and 20 deletions

View File

@@ -1,3 +1,3 @@
github "sparkle-project/Sparkle" ~> 1.17.0
github "mstarke/KeePassKit" "ba7e116cbe48edb3be3d82fdd9f6f72da5745d4a"
github "mstarke/KeePassKit" "ab95d3a85b2bcb86d9e3e5e74d2168c209756b8b"
github "mstarke/HNHUi" ~> 1.1

View File

@@ -1,3 +1,3 @@
github "mstarke/HNHUi" "1.1"
github "mstarke/KeePassKit" "ba7e116cbe48edb3be3d82fdd9f6f72da5745d4a"
github "mstarke/KeePassKit" "ab95d3a85b2bcb86d9e3e5e74d2168c209756b8b"
github "sparkle-project/Sparkle" "1.17.0"

View File

@@ -16,29 +16,73 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="405" height="333"/>
<rect key="frame" x="0.0" y="0.0" width="392" height="210"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<tokenField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k06-gn-ahB">
<rect key="frame" x="20" y="50" width="365" height="268"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<tokenFieldCell key="cell" selectable="YES" editable="YES" borderStyle="bezel" alignment="left" drawsBackground="YES" allowsEditingTextAttributes="YES" id="mfe-Zs-cxC">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</tokenFieldCell>
</tokenField>
<tokenField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jzn-UC-Ok8">
<rect key="frame" x="20" y="20" width="365" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<tokenField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jzn-UC-Ok8">
<rect key="frame" x="20" y="50" width="352" height="66"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="66" id="7rr-fC-NeH"/>
</constraints>
<tokenFieldCell key="cell" selectable="YES" editable="YES" borderStyle="bezel" alignment="left" drawsBackground="YES" allowsEditingTextAttributes="YES" id="uy0-iq-Q8N">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</tokenFieldCell>
</tokenField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lS4-1R-Bhp">
<rect key="frame" x="215" y="18" width="157" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Set Autotype Sequence" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="aOD-Ih-Sft">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7xF-eN-vs3">
<rect key="frame" x="18" y="176" width="207" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Available Commands and Placeholders" id="lug-97-H9D">
<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="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Kw-lW-ASe">
<rect key="frame" x="18" y="124" width="107" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Autotype Sequence" id="8ny-Qk-Jvo">
<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>
<tokenField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k06-gn-ahB">
<rect key="frame" x="20" y="146" width="352" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="400" id="can-wk-8oX"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="22" id="nk8-bB-yOg"/>
</constraints>
<tokenFieldCell key="cell" selectable="YES" editable="YES" borderStyle="bezel" alignment="left" drawsBackground="YES" allowsEditingTextAttributes="YES" id="mfe-Zs-cxC">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</tokenFieldCell>
</tokenField>
</subviews>
<point key="canvasLocation" x="66.5" y="-10.5"/>
<constraints>
<constraint firstItem="lS4-1R-Bhp" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="0gF-2O-Ph5"/>
<constraint firstItem="Jzn-UC-Ok8" firstAttribute="leading" secondItem="k06-gn-ahB" secondAttribute="leading" id="9TA-kn-IaI"/>
<constraint firstItem="7xF-eN-vs3" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="DDW-2E-z4M"/>
<constraint firstAttribute="trailing" secondItem="lS4-1R-Bhp" secondAttribute="trailing" constant="20" id="JGg-gw-ge8"/>
<constraint firstItem="9Kw-lW-ASe" firstAttribute="leading" secondItem="7xF-eN-vs3" secondAttribute="leading" id="Mjz-o8-Vqx"/>
<constraint firstAttribute="bottom" secondItem="lS4-1R-Bhp" secondAttribute="bottom" constant="20" symbolic="YES" id="PZa-cL-9DY"/>
<constraint firstAttribute="trailing" secondItem="k06-gn-ahB" secondAttribute="trailing" constant="20" symbolic="YES" id="UwG-TO-3PS"/>
<constraint firstItem="lS4-1R-Bhp" firstAttribute="top" secondItem="Jzn-UC-Ok8" secondAttribute="bottom" constant="8" symbolic="YES" id="ZCK-9U-M92"/>
<constraint firstItem="k06-gn-ahB" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="hJ8-Oo-CDZ"/>
<constraint firstItem="Jzn-UC-Ok8" firstAttribute="trailing" secondItem="k06-gn-ahB" secondAttribute="trailing" id="hWO-Ql-W8s"/>
<constraint firstItem="9Kw-lW-ASe" firstAttribute="top" secondItem="k06-gn-ahB" secondAttribute="bottom" constant="8" symbolic="YES" id="qdv-SC-dEw"/>
<constraint firstItem="Jzn-UC-Ok8" firstAttribute="top" secondItem="9Kw-lW-ASe" secondAttribute="bottom" constant="8" symbolic="YES" id="tfX-FJ-kTN"/>
<constraint firstItem="7xF-eN-vs3" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" symbolic="YES" id="zHm-gV-IQO"/>
<constraint firstItem="k06-gn-ahB" firstAttribute="top" secondItem="7xF-eN-vs3" secondAttribute="bottom" constant="8" symbolic="YES" id="zcP-hw-fVe"/>
</constraints>
<point key="canvasLocation" x="-47" y="-464"/>
</customView>
</objects>
</document>

View File

@@ -70,10 +70,9 @@
}
if([[representedObject uppercaseString] hasPrefix:@"{S:"]) {
KPKEntry *entry = self.representedObject;
NSArray <KPKAttribute *> *customAttributes = entry.customAttributes;
if(customAttributes.count > 0 ) {
if(entry.hasCustomAttributes ) {
NSMenu *menu = [[NSMenu alloc] init];
for(KPKAttribute *attribute in customAttributes) {
for(KPKAttribute *attribute in entry.customAttributes) {
[menu addItemWithTitle:attribute.key action:@selector(addCustomKeyPlaceholder:) keyEquivalent:@""];
}
return menu;
@@ -86,7 +85,7 @@
if(tokenField != self.availableCommandsTokenField) {
return NO;
}
BOOL showMenu = ([[representedObject uppercaseString] hasPrefix:@"{S:"] && [self.representedObject customAttributes].count > 0);
BOOL showMenu = ([[representedObject uppercaseString] hasPrefix:@"{S:"] && [self.representedObject hasCustomAttributes]);
return showMenu;
}