moved overlay display to MPPasteboardController

content copied in text fields now gets purged if clear-clipboard is set to true
This commit is contained in:
michael starke
2017-10-26 18:30:56 +02:00
parent 37fc5241ce
commit 509d0c84b2
14 changed files with 208 additions and 154 deletions

View File

@@ -1,3 +1,3 @@
github "sparkle-project/Sparkle" ~> 1.18.1
github "mstarke/KeePassKit" ~> 1.3
github "mstarke/HNHUi" ~> 1.1
github "mstarke/KeePassKit" ~> 1.4
github "mstarke/HNHUi" ~> 1.4

View File

@@ -1,3 +1,3 @@
github "mstarke/HNHUi" "1.2"
github "mstarke/KeePassKit" "1.3"
github "mstarke/HNHUi" "1.4"
github "mstarke/KeePassKit" "1.4"
github "sparkle-project/Sparkle" "1.18.1"

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -84,10 +85,7 @@
</connections>
</button>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="126">
<rect key="frame" x="18" y="433" width="77" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="73" id="136"/>
</constraints>
<rect key="frame" x="18" y="433" width="71" height="14"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Attachments" id="135">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -165,8 +163,8 @@
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="170"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="166">
<rect key="frame" x="41" y="10" width="160" height="17"/>
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="166">
<rect key="frame" x="41" y="10" width="158" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="171">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -174,10 +172,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="42g-QS-XtW">
<rect key="frame" x="207" y="5" width="38" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="38" id="2EY-Pv-ic4"/>
</constraints>
<rect key="frame" x="205" y="5" width="40" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" altersStateOfSelectedItem="NO" id="nJc-UT-cas">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -241,6 +236,7 @@
<constraint firstAttribute="trailing" secondItem="124" secondAttribute="trailing" constant="20" symbolic="YES" id="133"/>
<constraint firstItem="124" firstAttribute="baseline" secondItem="126" secondAttribute="baseline" id="134"/>
<constraint firstAttribute="bottom" secondItem="125" secondAttribute="bottom" constant="26" id="281"/>
<constraint firstItem="124" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="126" secondAttribute="trailing" constant="8" symbolic="YES" id="D9J-rW-ffS"/>
</constraints>
</view>
</tabViewItem>
@@ -263,7 +259,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="294" y="-838"/>
<point key="canvasLocation" x="391" y="-865"/>
</view>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="291" height="712"/>
@@ -287,6 +283,7 @@
<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>
@@ -309,6 +306,7 @@
<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>
@@ -323,6 +321,7 @@
<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>
@@ -367,6 +366,7 @@
</allowedInputSourceLocales>
</secureTextFieldCell>
<connections>
<outlet property="delegate" destination="-2" id="RBf-26-U9y"/>
<outlet property="nextKeyView" destination="61" id="5yc-GS-oVG"/>
</connections>
</secureTextField>
@@ -451,6 +451,9 @@
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="delegate" destination="-2" id="bJ5-Un-81o"/>
</connections>
</textField>
<button focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="179">
<rect key="frame" x="200" y="100" width="71" height="25"/>
@@ -523,8 +526,9 @@
<constraint firstAttribute="trailing" secondItem="QSX-Xo-tcH" secondAttribute="trailing" constant="20" symbolic="YES" id="hr2-Eb-g24"/>
<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"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6" secondAttribute="trailing" constant="20" symbolic="YES" id="uuh-ba-z4h"/>
</constraints>
<point key="canvasLocation" x="-400" y="-728"/>
<point key="canvasLocation" x="-306" y="-851"/>
</customView>
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="301" height="424"/>
@@ -583,7 +587,7 @@
<rect key="frame" x="20" y="138" width="261" height="160"/>
<clipView key="contentView" id="aDE-WT-YIv">
<rect key="frame" x="1" y="1" width="259" height="158"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="caM-L6-UHC">
<rect key="frame" x="0.0" y="0.0" width="259" height="158"/>
@@ -779,13 +783,13 @@
<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="-50" y="-872"/>
<point key="canvasLocation" x="39" y="-995"/>
</view>
<scrollView borderType="line" autohidesScrollers="YES" horizontalLineScroll="56" horizontalPageScroll="10" verticalLineScroll="56" verticalPageScroll="10" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="180" customClass="HNHUIScrollView">
<rect key="frame" x="0.0" y="0.0" width="261" height="270"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="k8G-zp-BXZ">
<rect key="frame" x="1" y="1" width="259" height="268"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" 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="268"/>
@@ -811,13 +815,13 @@
<rect key="frame" x="1" y="1" width="256" height="54"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="199">
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="199" customClass="HNHUIRoundedSecureTextField">
<rect key="frame" x="3" y="10" width="139" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="212"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="213"/>
</constraints>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Value" drawsBackground="YES" id="214" customClass="HNHUIRoundedTextFieldCell">
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Value" drawsBackground="YES" id="214">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -837,7 +841,7 @@
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="198">
<rect key="frame" x="190" y="8" width="32" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="32" id="215"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="32" id="215"/>
</constraints>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="216">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -847,9 +851,9 @@
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tDI-EL-JGB">
<rect key="frame" x="150" y="8" width="32" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="32" id="JGO-sl-fdM"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="32" id="JGO-sl-fdM"/>
</constraints>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="52_EncryptedTemplate" imagePosition="only" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fat-C5-dS2">
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="52_EncryptedTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fat-C5-dS2">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPPasswordEditWindowController">
@@ -19,25 +20,23 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<window title="Change Password" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="335" height="212"/>
<rect key="contentRect" x="196" y="240" width="403" height="219"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="335" height="212"/>
<rect key="frame" x="0.0" y="0.0" width="403" height="219"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
<rect key="frame" x="105" y="83" width="174" height="26"/>
<animations/>
<rect key="frame" x="105" y="87" width="242" height="26"/>
<pathCell key="cell" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="23">
<font key="font" metaFont="system"/>
</pathCell>
</pathControl>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5">
<rect key="frame" x="52" y="87" width="50" height="17"/>
<animations/>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5">
<rect key="frame" x="53" y="91" width="49" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Keyfile:" id="22">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -45,33 +44,27 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6">
<rect key="frame" x="108" y="60" width="168" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="168" id="7T4-xj-PPw"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" title="Generate Keyfile" bezelStyle="roundedRect" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="21">
<rect key="frame" x="108" y="59" width="236" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Generate Keyfile" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="21">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="generateKey:" target="-2" id="66"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7">
<rect key="frame" x="284" y="143" width="31" height="25"/>
<rect key="frame" x="352" y="153" width="31" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="31" id="59"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSQuickLookTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="20">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8">
<rect key="frame" x="284" y="84" width="31" height="25"/>
<animations/>
<rect key="frame" x="352" y="88" width="31" height="25"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSStopProgressTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="19">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -81,8 +74,10 @@
</connections>
</button>
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="HNHUIRoundedSecureTextField">
<rect key="frame" x="108" y="143" width="168" height="24"/>
<animations/>
<rect key="frame" x="108" y="153" width="236" height="24"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="Gin-yR-DMk"/>
</constraints>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter Password" drawsBackground="YES" usesSingleLineMode="YES" id="18">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -92,9 +87,8 @@
</allowedInputSourceLocales>
</secureTextFieldCell>
</secureTextField>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="10">
<rect key="frame" x="50" y="121" width="52" height="17"/>
<animations/>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="10">
<rect key="frame" x="51" y="123" width="51" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Repeat:" id="16">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -102,8 +96,7 @@
</textFieldCell>
</textField>
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11" customClass="HNHUIRoundedSecureTextField">
<rect key="frame" x="108" y="115" width="168" height="24"/>
<animations/>
<rect key="frame" x="108" y="119" width="236" height="24"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Repeat Password" drawsBackground="YES" usesSingleLineMode="YES" id="15">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -113,21 +106,16 @@
</allowedInputSourceLocales>
</secureTextFieldCell>
</secureTextField>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12">
<rect key="frame" x="125" y="175" width="135" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="13"/>
</constraints>
<animations/>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="12">
<rect key="frame" x="158" y="185" width="136" height="14"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Missmatching Passwords" id="14">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="68">
<rect key="frame" x="171" y="13" width="150" height="32"/>
<animations/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="68">
<rect key="frame" x="240" y="13" width="149" height="32"/>
<buttonCell key="cell" type="push" title="Change Password" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="69">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -136,9 +124,8 @@
<action selector="save:" target="-2" id="81"/>
</connections>
</button>
<button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="72">
<rect key="frame" x="89" y="13" width="82" height="32"/>
<animations/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="72">
<rect key="frame" x="158" y="13" width="82" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="73">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -150,9 +137,8 @@ Gw
<action selector="cancel:" target="-2" id="84"/>
</connections>
</button>
<button horizontalHuggingPriority="249" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yKc-I9-uzv">
<rect key="frame" x="18" y="148" width="84" height="18"/>
<animations/>
<button horizontalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="yKc-I9-uzv">
<rect key="frame" x="18" y="156" width="84" height="18"/>
<buttonCell key="cell" type="check" title="Password:" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="OQz-DA-SoY">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -164,7 +150,6 @@ Gw
<constraint firstItem="4" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="8" symbolic="YES" id="27"/>
<constraint firstItem="10" firstAttribute="baseline" secondItem="11" secondAttribute="baseline" id="29"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="9" secondAttribute="trailing" constant="8" symbolic="YES" id="30"/>
<constraint firstItem="4" firstAttribute="trailing" secondItem="11" secondAttribute="trailing" id="34"/>
<constraint firstItem="4" firstAttribute="top" secondItem="11" secondAttribute="bottom" constant="8" symbolic="YES" id="35"/>
<constraint firstItem="7" firstAttribute="top" secondItem="9" secondAttribute="top" id="36"/>
<constraint firstItem="11" firstAttribute="leading" secondItem="10" secondAttribute="trailing" constant="8" symbolic="YES" id="37"/>
@@ -180,22 +165,31 @@ Gw
<constraint firstItem="72" firstAttribute="top" secondItem="6" secondAttribute="bottom" constant="20" symbolic="YES" id="76"/>
<constraint firstAttribute="bottom" secondItem="72" secondAttribute="bottom" constant="20" symbolic="YES" id="77"/>
<constraint firstAttribute="bottom" secondItem="68" secondAttribute="bottom" constant="20" symbolic="YES" id="78"/>
<constraint firstItem="6" firstAttribute="trailing" secondItem="4" secondAttribute="trailing" id="49e-nD-CHa"/>
<constraint firstItem="5" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="4Yq-mp-X3O"/>
<constraint firstItem="4" firstAttribute="width" secondItem="11" secondAttribute="width" id="55p-Rc-8jw"/>
<constraint firstItem="72" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="5JM-Ve-z5Y"/>
<constraint firstItem="8" firstAttribute="leading" secondItem="4" secondAttribute="trailing" constant="8" id="7GY-2X-nJn"/>
<constraint firstItem="4" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="8" id="7eR-m5-mhQ"/>
<constraint firstItem="9" firstAttribute="baseline" secondItem="yKc-I9-uzv" secondAttribute="baseline" id="DrZ-BA-xPv"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="9" secondAttribute="trailing" constant="8" id="IqJ-u6-6jk"/>
<constraint firstItem="yKc-I9-uzv" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="OdM-OO-kNS"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="9" secondAttribute="trailing" constant="8" symbolic="YES" id="PnG-bb-nYQ"/>
<constraint firstItem="11" firstAttribute="top" secondItem="9" secondAttribute="bottom" constant="10" symbolic="YES" id="Qe9-z3-Wa6"/>
<constraint firstItem="yKc-I9-uzv" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="R8d-VG-2we"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6" secondAttribute="trailing" constant="20" symbolic="YES" id="TUn-PZ-fb5"/>
<constraint firstItem="10" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="UHJ-Fx-Kkf"/>
<constraint firstItem="6" firstAttribute="width" secondItem="11" secondAttribute="width" id="V37-mo-ah1"/>
<constraint firstItem="9" firstAttribute="leading" secondItem="yKc-I9-uzv" secondAttribute="trailing" constant="8" symbolic="YES" id="f8B-Dm-rGD"/>
<constraint firstItem="6" firstAttribute="trailing" secondItem="9" secondAttribute="trailing" id="fQD-6S-tkb"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="12" secondAttribute="trailing" constant="20" symbolic="YES" id="hmt-qe-o3D"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="11" secondAttribute="trailing" constant="20" symbolic="YES" id="nDO-Oh-tGz"/>
<constraint firstItem="6" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="tie-Hu-X1C"/>
<constraint firstItem="12" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="ukY-Gg-KY2"/>
<constraint firstItem="11" firstAttribute="width" secondItem="9" secondAttribute="width" id="wEk-Sj-XCb"/>
<constraint firstItem="6" firstAttribute="leading" secondItem="11" secondAttribute="leading" id="xV3-et-ECG"/>
<constraint firstItem="6" firstAttribute="leading" secondItem="9" secondAttribute="leading" id="zeJ-6i-fY3"/>
</constraints>
<animations/>
</view>
<point key="canvasLocation" x="-226" y="45"/>
</window>
</objects>
<resources>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPReferenceBuilderViewController">
@@ -17,14 +18,14 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="200" height="211"/>
<rect key="frame" x="0.0" y="0.0" width="205" height="215"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IZP-Gd-jdU">
<rect key="frame" x="13" y="153" width="80" height="19"/>
<popUpButtonCell key="cell" type="roundRect" bezelStyle="roundedRect" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KPf-xE-gde">
<rect key="frame" x="13" y="152" width="82" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KPf-xE-gde">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="Vxk-eO-bbf">
<items>
<menuItem title="Get" id="142-bE-IMZ"/>
@@ -36,7 +37,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IFf-vC-3vk" customClass="HNHUIRoundedTextField">
<rect key="frame" x="13" y="102" width="167" height="22"/>
<rect key="frame" x="13" y="102" width="172" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="Seu-01-P53"/>
</constraints>
@@ -46,23 +47,23 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T2o-aJ-JmD">
<rect key="frame" x="143" y="18" width="37" height="25"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="T2o-aJ-JmD">
<rect key="frame" x="147" y="18" width="38" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Use" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Kqx-qm-nMG">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VR5-Rx-ueN">
<rect key="frame" x="99" y="180" width="23" height="14"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VR5-Rx-ueN">
<rect key="frame" x="101" y="184" width="24" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Key" id="K1t-OZ-ACe">
<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" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sZo-ie-Asw">
<rect key="frame" x="11" y="180" width="57" height="14"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sZo-ie-Asw">
<rect key="frame" x="11" y="184" width="58" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Reference" id="r1V-VE-ngy">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -70,10 +71,10 @@
</textFieldCell>
</textField>
<popUpButton horizontalHuggingPriority="249" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="b4e-k2-WPS">
<rect key="frame" x="101" y="153" width="79" height="19"/>
<popUpButtonCell key="cell" type="roundRect" title="Matching" bezelStyle="roundedRect" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="yT1-XL-k6a" id="Aob-tW-bUP">
<rect key="frame" x="103" y="152" width="82" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" title="Matching" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="yT1-XL-k6a" id="Aob-tW-bUP">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="j2A-qj-k7L">
<items>
<menuItem title="Matching" state="on" id="yT1-XL-k6a">
@@ -103,7 +104,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="b36-T7-1tO" customClass="HNHUIRoundedTextField">
<rect key="frame" x="13" y="50" width="167" height="22"/>
<rect key="frame" x="13" y="50" width="172" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Reference" drawsBackground="YES" id="dr9-x8-kKk">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -121,23 +122,27 @@
<constraint firstItem="IFf-vC-3vk" firstAttribute="trailing" secondItem="b36-T7-1tO" secondAttribute="trailing" id="A5u-Ke-7v2"/>
<constraint firstItem="b4e-k2-WPS" firstAttribute="leading" secondItem="IZP-Gd-jdU" secondAttribute="trailing" constant="8" id="FZh-nD-5FA"/>
<constraint firstItem="sZo-ie-Asw" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="13" id="IGM-B6-h77"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="mcC-bG-cCz" secondAttribute="trailing" constant="20" symbolic="YES" id="J2I-RN-t0c"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="WTJ-he-uTu" secondAttribute="trailing" constant="20" symbolic="YES" id="KHp-go-bxN"/>
<constraint firstItem="sZo-ie-Asw" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="17" id="MFw-nO-YjE"/>
<constraint firstItem="IFf-vC-3vk" firstAttribute="top" secondItem="WTJ-he-uTu" secondAttribute="bottom" constant="8" id="NAD-cd-qCS"/>
<constraint firstItem="VR5-Rx-ueN" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="sZo-ie-Asw" secondAttribute="trailing" constant="8" symbolic="YES" id="SFi-X6-U36"/>
<constraint firstItem="IFf-vC-3vk" firstAttribute="leading" secondItem="mcC-bG-cCz" secondAttribute="leading" id="SdU-b0-En0"/>
<constraint firstAttribute="trailing" secondItem="b4e-k2-WPS" secondAttribute="trailing" constant="20" symbolic="YES" id="TY7-di-r3Z"/>
<constraint firstItem="IFf-vC-3vk" firstAttribute="leading" secondItem="WTJ-he-uTu" secondAttribute="leading" id="XIB-he-FfV"/>
<constraint firstItem="b36-T7-1tO" firstAttribute="top" secondItem="mcC-bG-cCz" secondAttribute="bottom" constant="8" symbolic="YES" id="Xka-0w-eDc"/>
<constraint firstAttribute="bottom" secondItem="T2o-aJ-JmD" secondAttribute="bottom" constant="20" symbolic="YES" id="bG1-hy-Rfa"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="VR5-Rx-ueN" secondAttribute="trailing" constant="20" symbolic="YES" id="g8R-Ob-o0J"/>
<constraint firstItem="IZP-Gd-jdU" firstAttribute="top" secondItem="sZo-ie-Asw" secondAttribute="bottom" constant="8" id="gK4-Td-hA9"/>
<constraint firstItem="sZo-ie-Asw" firstAttribute="centerY" secondItem="VR5-Rx-ueN" secondAttribute="centerY" id="gsh-ja-cXw"/>
<constraint firstAttribute="trailing" secondItem="IFf-vC-3vk" secondAttribute="trailing" constant="20" symbolic="YES" id="jYR-km-1Eh"/>
<constraint firstItem="b4e-k2-WPS" firstAttribute="centerY" secondItem="IZP-Gd-jdU" secondAttribute="centerY" id="pKr-Oo-UwF"/>
<constraint firstItem="T2o-aJ-JmD" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="c22-O7-iKe" secondAttribute="leading" constant="20" symbolic="YES" id="pbd-5J-DRj"/>
<constraint firstItem="WTJ-he-uTu" firstAttribute="leading" secondItem="IZP-Gd-jdU" secondAttribute="leading" id="qaF-8T-8XH"/>
<constraint firstItem="mcC-bG-cCz" firstAttribute="top" secondItem="IFf-vC-3vk" secondAttribute="bottom" constant="8" id="wNQ-xf-cQH"/>
<constraint firstItem="T2o-aJ-JmD" firstAttribute="trailing" secondItem="b36-T7-1tO" secondAttribute="trailing" id="yQJ-FX-1Xw"/>
</constraints>
<point key="canvasLocation" x="-219" y="-73.5"/>
<point key="canvasLocation" x="-64" y="77"/>
</customView>
</objects>
</document>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -130,11 +131,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="PasswordCell" id="428">
<rect key="frame" x="256" y="1" width="118" height="17"/>
<rect key="frame" x="256" y="1" width="119" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField">
<rect key="frame" x="1" y="0.0" width="116" height="17"/>
<rect key="frame" x="1" y="0.0" width="117" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -251,7 +252,7 @@
<constraint firstItem="54" firstAttribute="top" secondItem="336" secondAttribute="top" constant="-1" id="683"/>
<constraint firstAttribute="bottom" secondItem="54" secondAttribute="bottom" id="vfw-Ff-Ip8"/>
</constraints>
<point key="canvasLocation" x="256" y="530"/>
<point key="canvasLocation" x="-28" y="434"/>
</customView>
</objects>
<resources>

View File

@@ -33,19 +33,23 @@
[view.labelTextField bind:NSValueBinding
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(key))]
withKeyPath:@"objectValue.key"
options:@{ NSValidatesImmediatelyBindingOption: @YES }];
[view.valueTextField bind:NSValueBinding
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(value))]
withKeyPath:@"objectValue.value"
options:nil];
// TODO: Move to public KeePassKit API!
for(NSControl *control in @[view.labelTextField, view.valueTextField, view.removeButton ]) {
[view.protectedButton bind:NSValueBinding
toObject:view
withKeyPath:@"objectValue.isProtected"
options:nil];
for(NSControl *control in @[view.labelTextField, view.valueTextField, view.removeButton, view.protectedButton ]) {
[control bind:NSEnabledBinding
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(entry)), NSStringFromSelector(@selector(isHistory))]
options:@{NSConditionallySetsEditableBindingOption: @NO, NSValueTransformerNameBindingOption: NSNegateBooleanTransformerName}];
withKeyPath:@"objectValue.isEditable"
options:@{NSConditionallySetsEditableBindingOption: @NO }];
}
view.removeButton.target = self.viewController;

View File

@@ -445,6 +445,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error{
// TODO: Make this API asynchronous
self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password key:keyFileURL];
self.tree = [[KPKTree alloc] initWithData:self.encryptedData key:self.compositeKey error:error];

View File

@@ -263,7 +263,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
openPanel.allowsMultipleSelection = NO;
openPanel.canChooseDirectories = NO;
openPanel.canChooseFiles = YES;
openPanel.allowedFileTypes = @[(id)kUTTypeXML];
openPanel.allowedFileTypes = @[(id)kUTTypeXML];
[openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
if(result == NSFileHandlingPanelOKButton) {
[document readXMLfromURL:openPanel.URL];

View File

@@ -21,13 +21,13 @@
//
#import "MPViewController.h"
#import "HNHUi/HNHUi.h"
#import <Quartz/Quartz.h>
@class HNHUIRoundedSecureTextField;
@class MPDocument;
@interface MPEntryInspectorViewController : MPViewController <NSPopoverDelegate, QLPreviewPanelDelegate>
@interface MPEntryInspectorViewController : MPViewController <NSPopoverDelegate, QLPreviewPanelDelegate, HNHUITextFieldDelegate>
@property (weak) IBOutlet NSSegmentedControl *infoTabControl;

View File

@@ -38,6 +38,7 @@
#import "MPTemporaryFileStorageCenter.h"
#import "MPActionHelper.h"
#import "MPSettingsHelper.h"
#import "MPPasteBoardController.h"
#import "MPArrayController.h"
@@ -511,6 +512,41 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
}
#pragma mark -
#pragma mark HNHUITextFieldDelegate
- (NSMenu *)textField:(NSTextField *)textField textView:(NSTextView *)view menu:(NSMenu *)menu {
return menu;
}
- (BOOL)textField:(NSTextField *)textField textView:(NSTextView *)textView performAction:(SEL)action {
if(action == @selector(copy:)) {
MPPasteboardOverlayInfoType info = MPPasteboardOverlayInfoCustom;
NSString *value = textField.stringValue;
NSString *name = @"";
if(nil == value) {
return YES;
}
if(textField == self.usernameTextField) {
info = MPPasteboardOverlayInfoUsername;
}
else if(textField == self.passwordTextField) {
info = MPPasteboardOverlayInfoPassword;
}
else if(textField == self.URLTextField) {
info = MPPasteboardOverlayInfoURL;
}
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");
}
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:info name:name atView:self.view];
return NO;
}
return YES;
}
- (IBAction)toggleExpire:(NSButton*)sender {
if([sender state] == NSOnState && [self.representedEntry.timeInfo.expirationDate isEqualToDate:[NSDate distantFuture]]) {
[NSApp sendAction:self.pickExpireDateButton.action to:nil from:self.pickExpireDateButton];

View File

@@ -52,13 +52,6 @@
#define STATUS_BAR_ANIMATION_TIME 0.15
#define EXPIRED_ENTRY_REFRESH_SECONDS 60
typedef NS_ENUM(NSUInteger, MPOverlayInfoType) {
MPOverlayInfoPassword,
MPOverlayInfoUsername,
MPOverlayInfoURL,
MPOverlayInfoCustom,
};
NSString *const MPEntryTableIndexColumnIdentifier = @"MPEntryTableIndexColumnIdentifier";
NSString *const MPEntryTableUserNameColumnIdentifier = @"MPUserNameColumnIdentifier";
NSString *const MPEntryTableTitleColumnIdentifier = @"MPTitleColumnIdentifier";
@@ -597,37 +590,6 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
}];
}
#pragma mark Copy/Paste Overlays
- (void)_copyToPasteboard:(NSString *)data overlayInfo:(MPOverlayInfoType)overlayInfoType name:(NSString *)name{
if(data) {
[MPPasteBoardController.defaultController copyObjects:@[ data ]];
}
NSImage *infoImage = nil;
NSString *infoText = nil;
switch (overlayInfoType) {
case MPOverlayInfoPassword:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoText = NSLocalizedString(@"COPIED_PASSWORD", @"Password was copied to the pasteboard");
break;
case MPOverlayInfoURL:
infoImage = [[NSBundle mainBundle] imageForResource:@"01_PackageNetworkTemplate"];
infoText = NSLocalizedString(@"COPIED_URL", @"URL was copied to the pasteboard");
break;
case MPOverlayInfoUsername:
infoImage = [[NSBundle mainBundle] imageForResource:@"09_IdentityTemplate"];
infoText = NSLocalizedString(@"COPIED_USERNAME", @"Username was copied to the pasteboard");
break;
case MPOverlayInfoCustom:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoText = [NSString stringWithFormat:NSLocalizedString(@"COPIED_FIELD_%@", "Field name that was copied to the pasteboard"), name];
break;
}
[[MPOverlayWindowController sharedController] displayOverlayImage:infoImage label:infoText atView:self.view];
}
#pragma mark Validation
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
/* Validation is solely handled in the document */
@@ -679,16 +641,18 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
- (void)copyPassword:(id)sender {
NSArray *nodes = [self currentTargetNodes];
KPKEntry *selectedEntry = nodes.count == 1 ? [nodes.firstObject asEntry] : nil;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.password kpk_finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoPassword name:nil];
NSString *value = [selectedEntry.password kpk_finalValueForEntry:selectedEntry];
if(value) {
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:MPPasteboardOverlayInfoPassword name:nil atView:self.view];
}
}
- (void)copyUsername:(id)sender {
NSArray *nodes = [self currentTargetNodes];
KPKEntry *selectedEntry = nodes.count == 1 ? [nodes.firstObject asEntry] : nil;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.username kpk_finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoUsername name:nil];
NSString *value = [selectedEntry.username kpk_finalValueForEntry:selectedEntry];
if(value) {
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:MPPasteboardOverlayInfoUsername name:nil atView:self.view];
}
}
@@ -697,17 +661,21 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
KPKEntry *selectedEntry = nodes.count == 1 ? [nodes.firstObject asEntry] : nil;
if(selectedEntry && [selectedEntry isKindOfClass:[KPKEntry class]]) {
NSUInteger index = [sender tag];
NSAssert((index >= 0) && (index < [selectedEntry.customAttributes count]), @"Index for custom field needs to be valid");
NSAssert((index >= 0) && (index < selectedEntry.customAttributes.count), @"Index for custom field needs to be valid");
KPKAttribute *attribute = selectedEntry.customAttributes[index];
[self _copyToPasteboard:attribute.evaluatedValue overlayInfo:MPOverlayInfoCustom name:attribute.key];
NSString *value = attribute.evaluatedValue;
if(value) {
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:MPPasteboardOverlayInfoCustom name:attribute.key atView:self.view];
}
}
}
- (void)copyURL:(id)sender {
NSArray *nodes = [self currentTargetNodes];
KPKEntry *selectedEntry = nodes.count == 1 ? [nodes.firstObject asEntry] : nil;
if(selectedEntry) {
[self _copyToPasteboard:[selectedEntry.url kpk_finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoURL name:nil];
NSString *value = [selectedEntry.url kpk_finalValueForEntry:selectedEntry];
if(value) {
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:MPPasteboardOverlayInfoURL name:nil atView:self.view];
}
}

View File

@@ -22,6 +22,13 @@
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, MPPasteboardOverlayInfoType) {
MPPasteboardOverlayInfoPassword,
MPPasteboardOverlayInfoUsername,
MPPasteboardOverlayInfoURL,
MPPasteboardOverlayInfoCustom,
};
@interface MPPasteBoardController : NSObject
/**
@@ -51,4 +58,6 @@ FOUNDATION_EXPORT NSString *const MPPasteBoardControllerDidClearClipboard;
- (void)copyObjects:(NSArray<id<NSPasteboardWriting>> *)objects;
- (void)copyObjectsWithoutTimeout:(NSArray<id<NSPasteboardWriting>> *)objects;
- (void)copyObjects:(NSArray<id<NSPasteboardWriting>> *)objects overlayInfo:(MPPasteboardOverlayInfoType)overlayInfoType name:(NSString *)name atView:(NSView *)view;
@end

View File

@@ -22,6 +22,7 @@
#import "MPPasteBoardController.h"
#import "MPSettingsHelper.h"
#import "MPOverlayWindowController.h"
/* Notifications */
NSString *const MPPasteBoardControllerDidCopyObjects = @"com.hicknhack.macpass.MPPasteBoardControllerDidCopyObjects";
@@ -105,6 +106,37 @@ NSString *const MPPasteBoardControllerDidClearClipboard = @"com.hicknhack.macpas
self.isEmpty = NO;
}
- (void)copyObjects:(NSArray<id<NSPasteboardWriting>> *)objects overlayInfo:(MPPasteboardOverlayInfoType)overlayInfoType name:(NSString *)name atView:(NSView *)view{
if(!objects) {
return;
}
[MPPasteBoardController.defaultController copyObjects:objects];
NSImage *infoImage = nil;
NSString *infoText = nil;
switch(overlayInfoType) {
case MPPasteboardOverlayInfoPassword:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoText = NSLocalizedString(@"COPIED_PASSWORD", @"Password was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoURL:
infoImage = [[NSBundle mainBundle] imageForResource:@"01_PackageNetworkTemplate"];
infoText = NSLocalizedString(@"COPIED_URL", @"URL was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoUsername:
infoImage = [[NSBundle mainBundle] imageForResource:@"09_IdentityTemplate"];
infoText = NSLocalizedString(@"COPIED_USERNAME", @"Username was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoCustom:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoText = [NSString stringWithFormat:NSLocalizedString(@"COPIED_FIELD_%@", "Field name that was copied to the pasteboard"), name];
break;
}
[[MPOverlayWindowController sharedController] displayOverlayImage:infoImage label:infoText atView:view];
}
- (void)_clearPasteboardContents {
/* Only clear stuff we might have put there */
if(!self.isEmpty) {