Using NSObjectController for entry inspector

This commit is contained in:
michael starke
2015-12-17 19:07:44 +01:00
parent 8bce3907f3
commit c7590dcb60
6 changed files with 169 additions and 225 deletions

View File

@@ -1,8 +1,8 @@
<?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">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" 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="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPEntryInspectorViewController">
@@ -41,8 +41,7 @@
<rect key="frame" x="0.0" y="0.0" width="293" height="529"/>
<subviews>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="82">
<rect key="frame" x="34.5" y="505" width="224" height="19"/>
<animations/>
<rect key="frame" x="35" y="505" width="224" height="19"/>
<segmentedCell key="cell" controlSize="small" borderStyle="border" alignment="left" style="texturedSquare" trackingMode="selectOne" id="238">
<font key="font" metaFont="smallSystem"/>
<segments>
@@ -55,14 +54,12 @@
</segmentedControl>
<tabView drawsBackground="NO" type="noTabsNoBorder" initialItem="110" translatesAutoresizingMaskIntoConstraints="NO" id="83">
<rect key="frame" x="0.0" y="0.0" width="293" height="503"/>
<animations/>
<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="293" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
</view>
</tabViewItem>
<tabViewItem label="Attachments" identifier="" id="109">
@@ -75,7 +72,6 @@
<constraints>
<constraint firstAttribute="width" constant="32" id="176"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSAddTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="177">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
@@ -89,7 +85,6 @@
<constraints>
<constraint firstAttribute="width" constant="73" id="136"/>
</constraints>
<animations/>
<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"/>
@@ -105,7 +100,6 @@
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="36" rowSizeStyle="automatic" viewBased="YES" id="137">
<rect key="frame" x="0.0" y="0.0" width="251" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="alternateSelectedControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
@@ -133,12 +127,10 @@
<constraint firstAttribute="width" constant="32" id="153"/>
<constraint firstAttribute="height" constant="32" id="154"/>
</constraints>
<animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="152"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="145">
<rect key="frame" x="41" y="10" width="206" height="17"/>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="151">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -153,7 +145,6 @@
<constraint firstAttribute="trailing" secondItem="145" secondAttribute="trailing" constant="3" id="149"/>
<constraint firstItem="145" firstAttribute="leading" secondItem="144" secondAttribute="trailing" constant="8" symbolic="YES" id="150"/>
</constraints>
<animations/>
<connections>
<outlet property="imageView" destination="144" id="239"/>
<outlet property="textField" destination="145" id="240"/>
@@ -169,12 +160,10 @@
<constraint firstAttribute="height" constant="32" id="168"/>
<constraint firstAttribute="width" constant="32" id="169"/>
</constraints>
<animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="170"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="166">
<rect key="frame" x="41" y="10" width="160" height="17"/>
<animations/>
<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"/>
@@ -186,7 +175,6 @@
<constraints>
<constraint firstAttribute="width" constant="38" id="2EY-Pv-ic4"/>
</constraints>
<animations/>
<popUpButtonCell key="cell" type="roundRect" bezelStyle="roundedRect" 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="cellTitle"/>
@@ -216,7 +204,6 @@
<constraint firstItem="42g-QS-XtW" firstAttribute="leading" secondItem="166" secondAttribute="trailing" constant="8" id="EEX-YD-llx"/>
<constraint firstAttribute="trailing" secondItem="42g-QS-XtW" secondAttribute="trailing" constant="3" id="vvP-2V-gwi"/>
</constraints>
<animations/>
<connections>
<outlet property="actionButton" destination="42g-QS-XtW" id="IEV-gn-6YI"/>
<outlet property="imageView" destination="167" id="244"/>
@@ -228,22 +215,18 @@
</tableColumns>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="100" id="KFw-Ma-DSd"/>
</constraints>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="138">
<rect key="frame" x="1" y="147" width="52" height="16"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="139">
<rect key="frame" x="37" y="1" width="16" height="2"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
</subviews>
@@ -257,7 +240,6 @@
<constraint firstItem="124" firstAttribute="baseline" secondItem="126" secondAttribute="baseline" id="134"/>
<constraint firstAttribute="bottom" secondItem="125" secondAttribute="bottom" constant="26" id="281"/>
</constraints>
<animations/>
</view>
<connections>
<outlet property="initialFirstResponder" destination="124" id="HDR-d9-QyI"/>
@@ -273,7 +255,6 @@
<constraints>
<constraint firstAttribute="width" constant="32" id="231"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSAddTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="232">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
@@ -284,7 +265,6 @@
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="181">
<rect key="frame" x="18" y="469" width="79" height="14"/>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Custom Fields" id="190">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -300,7 +280,6 @@
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" rowSizeStyle="automatic" viewBased="YES" id="193">
<rect key="frame" x="0.0" y="0.0" width="259" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
@@ -328,7 +307,6 @@
<constraint firstAttribute="height" constant="22" id="212"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="213"/>
</constraints>
<animations/>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Value" drawsBackground="YES" id="214" customClass="HNHUIRoundedTextFieldCell">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -340,7 +318,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="210"/>
</constraints>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" placeholderString="Title" id="211">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -352,7 +329,6 @@
<constraints>
<constraint firstAttribute="width" constant="32" id="215"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" 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"/>
<font key="font" metaFont="cellTitle"/>
@@ -370,7 +346,6 @@
<constraint firstItem="198" firstAttribute="leading" secondItem="199" secondAttribute="trailing" constant="8" symbolic="YES" id="208"/>
<constraint firstAttribute="trailing" secondItem="198" secondAttribute="trailing" constant="1" id="209"/>
</constraints>
<animations/>
<connections>
<outlet property="labelTextField" destination="200" id="242"/>
<outlet property="removeButton" destination="198" id="243"/>
@@ -387,7 +362,6 @@
<constraint firstAttribute="height" constant="22" id="226"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="227"/>
</constraints>
<animations/>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Value" drawsBackground="YES" id="225" customClass="HNHUIRoundedTextFieldCell">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -400,7 +374,6 @@
<constraint firstAttribute="height" constant="14" id="229"/>
<constraint firstAttribute="width" constant="252" id="230"/>
</constraints>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" placeholderString="Title" id="228">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -416,7 +389,6 @@
<constraint firstAttribute="bottom" secondItem="224" secondAttribute="bottom" constant="10" id="221"/>
<constraint firstAttribute="trailing" secondItem="224" secondAttribute="trailing" constant="3" id="222"/>
</constraints>
<animations/>
<connections>
<outlet property="labelTextField" destination="223" id="249"/>
<outlet property="valueTextField" destination="224" id="248"/>
@@ -427,22 +399,18 @@
</tableColumns>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="100" id="Car-Dj-KWv"/>
</constraints>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="192">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="191">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
</subviews>
@@ -456,7 +424,6 @@
<constraint firstItem="179" firstAttribute="baseline" secondItem="181" secondAttribute="baseline" id="189"/>
<constraint firstAttribute="bottom" secondItem="180" secondAttribute="bottom" constant="26" id="280"/>
</constraints>
<animations/>
</view>
<connections>
<outlet property="initialFirstResponder" destination="179" id="wSu-XB-L1r"/>
@@ -466,7 +433,6 @@
<view key="view" id="2py-ab-4ZU">
<rect key="frame" x="0.0" y="0.0" width="293" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
</view>
</tabViewItem>
</tabViewItems>
@@ -482,15 +448,13 @@
<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>
<animations/>
<point key="canvasLocation" x="262.5" y="-61.5"/>
<point key="canvasLocation" x="662.5" y="-37.5"/>
</view>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="252" height="453"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="52">
<rect key="frame" x="18" y="434" width="28" height="14"/>
<animations/>
<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"/>
@@ -502,7 +466,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="7Xj-3i-fBY"/>
</constraints>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="70">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -514,7 +477,6 @@
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="54">
<rect key="frame" x="18" y="378" width="58" height="14"/>
<animations/>
<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"/>
@@ -526,7 +488,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="0l5-fD-0eW"/>
</constraints>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="68">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -541,7 +502,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="SoS-8e-rkN"/>
</constraints>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="67">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -553,7 +513,6 @@
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="57">
<rect key="frame" x="18" y="244" width="26" height="14"/>
<animations/>
<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"/>
@@ -562,7 +521,6 @@
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="58">
<rect key="frame" x="18" y="322" width="55" height="14"/>
<animations/>
<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"/>
@@ -571,7 +529,6 @@
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="59">
<rect key="frame" x="20" y="265" width="212" height="19"/>
<animations/>
<buttonCell key="cell" type="roundRect" title="Generate" bezelStyle="roundedRect" 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="cellTitle"/>
@@ -586,7 +543,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="VFI-jo-tOU"/>
</constraints>
<animations/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="63">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -604,7 +560,6 @@
<constraints>
<constraint firstAttribute="width" constant="31" id="rSr-fw-11t"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSQuickLookTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="62">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -618,7 +573,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="vgc-Xu-RJs"/>
</constraints>
<animations/>
<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"/>
@@ -632,7 +586,6 @@
<constraints>
<constraint firstAttribute="width" constant="31" id="Ped-nx-uti"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" 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="cellTitle"/>
@@ -647,7 +600,6 @@
<constraints>
<constraint firstAttribute="height" constant="77" id="80"/>
</constraints>
<animations/>
<tokenFieldCell key="cell" selectable="YES" editable="YES" borderStyle="bezel" alignment="left" drawsBackground="YES" allowsEditingTextAttributes="YES" id="81">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -659,7 +611,6 @@
</tokenField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6">
<rect key="frame" x="18" y="162" width="29" height="14"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Tags" id="79">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -668,7 +619,6 @@
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="0U8-TS-giU">
<rect key="frame" x="18" y="50" width="32" height="14"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" title="UUID" id="vTq-N1-5oa">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -680,7 +630,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="Zfy-mh-1TF"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="Hml-NR-AeS">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -732,8 +681,7 @@
<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"/>
</constraints>
<animations/>
<point key="canvasLocation" x="616" y="-71.5"/>
<point key="canvasLocation" x="310" y="-50.5"/>
</customView>
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="301" height="424"/>
@@ -743,7 +691,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="c9A-Ju-Cj9"/>
</constraints>
<animations/>
<buttonCell key="cell" type="check" title="Enable Autotype" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="9Nx-mE-DK3">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -754,7 +701,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="KKP-xg-uUu"/>
</constraints>
<animations/>
<buttonCell key="cell" type="check" title="Obfuscate Autotype" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="oNq-kB-3eb">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -762,7 +708,6 @@
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="45R-v4-ywl">
<rect key="frame" x="18" y="358" width="265" height="14"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Autotype Sequence" id="bQ5-0E-h3O">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -774,7 +719,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="2hC-UP-Iie"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Custom Entry Sequence" drawsBackground="YES" id="R2X-Ex-c6q">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -786,7 +730,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="xvF-LU-XNu"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Window Associations" id="ned-1Q-FXA">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -802,7 +745,6 @@
<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="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
@@ -826,7 +768,6 @@
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JgP-7K-Ugw">
<rect key="frame" x="0.0" y="0.0" width="256" height="17"/>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="dyA-lo-PGa">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -834,7 +775,6 @@
</textFieldCell>
</textField>
</subviews>
<animations/>
<connections>
<outlet property="textField" destination="JgP-7K-Ugw" id="EIY-vk-jbY"/>
</connections>
@@ -844,20 +784,16 @@
</tableColumns>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="160" id="B8z-Sq-4j9"/>
</constraints>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="Y4S-4R-dwJ">
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="abK-py-K7A">
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Iy9-9L-Aev">
@@ -866,7 +802,6 @@
<constraint firstAttribute="height" constant="18" id="VeX-Jj-eA9"/>
<constraint firstAttribute="width" constant="32" id="mjs-Yf-Cb2"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSAddTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="5J6-uD-iK6">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
@@ -881,7 +816,6 @@
<constraint firstAttribute="width" constant="32" id="vWY-ez-gy9"/>
<constraint firstAttribute="height" constant="18" id="xwN-WB-cn2"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="86n-d4-lOW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
@@ -895,7 +829,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="GF5-sR-zdR"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Window Title" id="bkO-Bk-AuX">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -907,7 +840,6 @@
<constraints>
<constraint firstAttribute="height" constant="20" id="rXS-QE-6cW"/>
</constraints>
<animations/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" id="VLq-Hn-aei">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -919,7 +851,6 @@
<constraints>
<constraint firstAttribute="height" constant="14" id="MPq-gU-72D"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Window Sequence" id="RQB-bR-MC0">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -931,7 +862,6 @@
<constraints>
<constraint firstAttribute="height" constant="22" id="oIA-8f-Jkf"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Custom Window Sequence" drawsBackground="YES" id="fW9-9p-wwR">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -943,7 +873,6 @@
<constraints>
<constraint firstAttribute="width" constant="32" id="CbR-2P-dZH"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSActionTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="V5Z-qf-FVH">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -954,7 +883,6 @@
<constraints>
<constraint firstAttribute="width" constant="32" id="Ek5-IH-qGo"/>
</constraints>
<animations/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSActionTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="HIC-T9-j9G">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -1002,8 +930,7 @@
<constraint firstAttribute="trailing" secondItem="45R-v4-ywl" secondAttribute="trailing" constant="20" symbolic="YES" id="uUm-S5-cxM"/>
<constraint firstAttribute="trailing" secondItem="z03-zW-GN3" secondAttribute="trailing" constant="20" symbolic="YES" id="wiq-pY-TG8"/>
</constraints>
<animations/>
<point key="canvasLocation" x="-77.5" y="102"/>
<point key="canvasLocation" x="-28.5" y="-45"/>
</view>
</objects>
<resources>

View File

@@ -93,7 +93,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document];
[self.entryViewController regsiterNotificationsForDocument:document];
[self.inspectorViewController regsiterNotificationsForDocument:document];
[self.inspectorViewController registerNotificationsForDocument:document];
[self.outlineViewController regsiterNotificationsForDocument:document];
[self.toolbarDelegate registerNotificationsForDocument:document];

View File

@@ -53,7 +53,7 @@
@property (weak) IBOutlet NSTextField *associationSequenceTextField;
- (void)setupBindings:(MPDocument *)document;
- (void)regsiterNotificationsForDocument:(MPDocument *)document;
- (void)registerNotificationsForDocument:(MPDocument *)document;
- (IBAction)saveAttachment:(id)sender;
- (IBAction)addAttachment:(id)sender;

View File

@@ -50,14 +50,22 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
@property (nonatomic, assign) BOOL showPassword;
@property (nonatomic, assign) MPEntryTab activeTab;
@property (strong) NSPopover *activePopover;
@property (strong) NSObjectController *entryController;
@property (readonly, nonatomic) KPKEntry *contentEntry;
@property (nonatomic, weak) KPKEntry *entry;
//@property (nonatomic, weak) KPKEntry *entry;
@property (strong) MPTemporaryFileStorage *quicklookStorage;
@end
@implementation MPEntryInspectorViewController
static NSString *kMPContentBindingString1 = @"content.%@";
static NSString *kMPContentBindingString2 = @"content.%@.%@";
static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
- (NSString *)nibName {
return @"EntryInspectorView";
}
@@ -77,10 +85,19 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
_attachmentTableDelegate.viewController = self;
_customFieldTableDelegate.viewController = self;
_activeTab = MPEntryTabGeneral;
_entryController = [[NSObjectController alloc] init];
_entryController.objectClass = [KPKEntry class];
}
return self;
}
- (KPKEntry *)contentEntry {
if([self.entryController.content isKindOfClass:[KPKEntry class]]) {
return self.entryController.content;
}
return nil;
}
- (void)didLoadView {
[self _addScrollViewWithView:self.generalView atTab:MPEntryTabGeneral];
@@ -109,30 +126,24 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[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 _setupViewBindings];
}
- (void)setupBindings:(MPDocument *)document {
[self bind:NSStringFromSelector(@selector(entry)) toObject:document withKeyPath:NSStringFromSelector(@selector(selectedEntry)) options:nil];
[self.entryController bind:NSContentObjectBinding toObject:document withKeyPath:NSStringFromSelector(@selector(selectedEntry)) options:nil];
}
- (void)setEntry:(KPKEntry *)entry {
if(_entry != entry) {
_entry = entry;
[self _updateContent];
}
}
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
- (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didAddEntry:)
name:MPDocumentDidAddEntryNotification
object:document];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_willSave:)
name:MPDocumentWillSaveNotification
object:document];
// [[NSNotificationCenter defaultCenter] addObserver:self
// selector:@selector(_willSave:)
// name:MPDocumentWillSaveNotification
// object:document];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didBeginEditingSelectedItem:)
@@ -159,12 +170,12 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)addCustomField:(id)sender {
MPDocument *document = [[self windowController] document];
[document createCustomAttribute:self.entry];
[document createCustomAttribute:self.entryController.content];
}
- (void)removeCustomField:(id)sender {
NSUInteger index = [sender tag];
KPKAttribute *attribute = self.entry.customAttributes[index];
[self.entry removeCustomAttribute:attribute];
KPKAttribute *attribute = self.contentEntry.customAttributes[index];
[self.contentEntry removeCustomAttribute:attribute];
}
- (void)saveAttachment:(id)sender {
@@ -172,15 +183,15 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
if(row < 0) {
return; // No selection
}
KPKBinary *binary = self.entry.binaries[row];
KPKBinary *binary = self.contentEntry.binaries[row];
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setCanCreateDirectories:YES];
[savePanel setNameFieldStringValue:binary.name];
savePanel.canCreateDirectories = YES;
savePanel.nameFieldStringValue = binary.name;
[savePanel beginSheetModalForWindow:[[self windowController] window] completionHandler:^(NSInteger result) {
[savePanel beginSheetModalForWindow:self.windowController.window completionHandler:^(NSInteger result) {
if(result == NSFileHandlingPanelOKButton) {
NSError *error;
BOOL sucess = [binary saveToLocation:[savePanel URL] error:&error];
BOOL sucess = [binary saveToLocation:savePanel.URL error:&error];
if(!sucess && error) {
[NSApp presentError:error];
}
@@ -190,37 +201,37 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)addAttachment:(id)sender {
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
[openPanel setAllowsMultipleSelection:YES];
[openPanel beginSheetModalForWindow:[[self windowController] window] completionHandler:^(NSInteger result) {
openPanel.canChooseDirectories = NO;
openPanel.canChooseFiles = YES;
openPanel.allowsMultipleSelection = YES;
[openPanel beginSheetModalForWindow:self.windowController.window completionHandler:^(NSInteger result) {
if(result == NSFileHandlingPanelOKButton) {
for (NSURL *attachmentURL in [openPanel URLs]) {
for (NSURL *attachmentURL in openPanel.URLs) {
KPKBinary *binary = [[KPKBinary alloc] initWithContentsOfURL:attachmentURL];
[self.entry addBinary:binary];
[self.contentEntry addBinary:binary];
}
}
}];
}
- (void)removeAttachment:(id)sender {
NSInteger row = [self.attachmentTableView selectedRow];
NSInteger row = self.attachmentTableView.selectedRow;
if(row < 0) {
return; // no selection
}
KPKBinary *binary = self.entry.binaries[row];
[self.entry removeBinary:binary];
KPKBinary *binary = self.contentEntry.binaries[row];
[self.contentEntry removeBinary:binary];
}
- (void)addWindowAssociation:(id)sender {
KPKWindowAssociation *associtation = [[KPKWindowAssociation alloc] initWithWindowTitle:NSLocalizedString(@"DEFAULT_WINDOW_TITLE", "") keystrokeSequence:nil];
[self.entry.autotype addAssociation:associtation];
[self.contentEntry.autotype addAssociation:associtation];
}
- (void)removeWindowAssociation:(id)sender {
NSInteger row = [self.windowAssociationsTableView selectedRow];
if(row > - 1 && row < [self.entry.autotype.associations count]) {
[self.entry.autotype removeAssociation:self.entry.autotype.associations[row]];
if(row > - 1 && row < [self.contentEntry.autotype.associations count]) {
[self.contentEntry.autotype removeAssociation:self.contentEntry.autotype.associations[row]];
}
}
@@ -273,7 +284,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_updatePreviewItemForPanel:(QLPreviewPanel *)panel {
NSInteger row = [self.attachmentTableView selectedRow];
NSAssert(row > -1, @"Row needs to be selected");
KPKBinary *binary = self.entry.binaries[row];
KPKBinary *binary = self.contentEntry.binaries[row];
MPTemporaryFileStorage *oldStorage = (MPTemporaryFileStorage *)panel.dataSource;
[[MPTemporaryFileStorageCenter defaultCenter] unregisterStorage:oldStorage];
panel.dataSource = [[MPTemporaryFileStorageCenter defaultCenter] storageForBinary:binary];
@@ -286,7 +297,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[self.generatePasswordButton setEnabled:NO];
MPPasswordCreatorViewController *viewController = [[MPPasswordCreatorViewController alloc] init];
viewController.allowsEntryDefaults = YES;
viewController.entry = self.entry;
viewController.entry = self.contentEntry;
[self _showPopopver:viewController atView:self.passwordTextField onEdge:NSMinYEdge];
}
@@ -315,8 +326,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
if([controller respondsToSelector:@selector(generatedPassword)]) {
NSString *password = [controller generatedPassword];
/* We should only use the password if there is actually one */
if([password length] > 0) {
self.entry.password = [controller generatedPassword];
if(password.length > 0) {
self.contentEntry.password = [controller generatedPassword];
}
}
/* TODO: Check for Icon wizard */
@@ -349,13 +360,13 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
NSDictionary *views = NSDictionaryOfVariableBindings(view, scrollView);
[scrollView.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|"
options:0
metrics:nil
views:views ]];
options:0
metrics:nil
views:views ]];
[scrollView.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|"
options:0
metrics:nil
views:views]];
options:0
metrics:nil
views:views]];
[clipView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|"
options:0
metrics:nil
@@ -365,7 +376,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
#pragma mark -
#pragma mark Entry Selection
- (void)_updateContent {
- (void)_setupViewBindings {
[self _bindEntry];
[self _bindAttachments];
[self _bindCustomFields];
@@ -373,100 +384,103 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
}
- (void)_bindEntry {
static NSArray *items;
if(!items) {
items = @[ self.titleTextField,
self.passwordTextField,
self.usernameTextField,
self.URLTextField,
self.expiresCheckButton,
self.tagsTokenField ];
}
if(self.entry) {
[self.titleTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(title)) options:nil];
[self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(password)) options:nil];
[self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(username)) options:nil];
[self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(url)) options:nil];
[self.expiresCheckButton bind:NSTitleBinding
toObject:self.entry.timeInfo
withKeyPath:NSStringFromSelector(@selector(expirationDate))
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
[self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
[self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(tags)) options:nil];
[self.uuidTextField bind:NSValueBinding toObject:self.entry.uuid withKeyPath:NSStringFromSelector(@selector(UUIDString)) options:nil];
self.uuidTextField.editable = NO;
[self.titleTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(title))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")} ];
[self.passwordTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(password))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }];
[self.usernameTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(username))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "") }];
[self.URLTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(url))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")}];
/* Setup enable/disable */
for(id item in items) {
[item bind:NSEnabledBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(isEditable)) options:nil];
}
}
else {
for(id item in items) {
[item unbind:NSValueBinding];
[item unbind:NSEnabledBinding];
}
[self.uuidTextField unbind:NSValueBinding];
[self.expiresCheckButton unbind:NSTitleBinding];
}
[self.expiresCheckButton bind:NSTitleBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expirationDate))]
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
[self.expiresCheckButton bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expires))]
options:nil];
[self.tagsTokenField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(tags))]
options:nil];
[self.uuidTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(uuid)), NSStringFromSelector(@selector(UUIDString))]
options:nil];
self.uuidTextField.editable = NO;
/*for(id item in items) {
[item bind:NSEnabledBinding toObject:self.entryController withKeyPath:NSStringFromSelector(@selector(isEditable)) options:nil];
}*/
}
- (void)_bindAttachments {
if(self.entry) {
[_attachmentsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(binaries)) options:nil];
}
else if([_attachmentsController content] != nil){
[_attachmentsController unbind:NSContentArrayBinding];
[_attachmentsController setContent:nil];
}
[_attachmentsController bind:NSContentArrayBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(binaries))]
options:nil];
}
- (void)_bindCustomFields {
if(self.entry) {
[_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(customAttributes)) options:nil];
}
else if ([_customFieldsController content] != nil ) {
[_customFieldsController unbind:NSContentArrayBinding];
[_customFieldsController setContent:nil];
}
[_customFieldsController bind:NSContentArrayBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString1, NSStringFromSelector(@selector(customAttributes))]
options:nil];
}
- (void)_bindAutotype {
- (void)_bindAutotype {
if(self.entry) {
[self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil];
[self.obfuscateAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(obfuscateDataTransfer)) options:nil];
[self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil];
[self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(defaultKeystrokeSequence)) options:@{ NSValidatesImmediatelyBindingOption: @(YES) }];
[_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(associations)) options:nil];
//[self.windowTitleComboBox setStringValue:@""];
NSString *selectedWindowTitlePath = [[NSString alloc] initWithFormat:@"selection.%@", NSStringFromSelector(@selector(windowTitle))];
[self.windowTitleComboBox bind:NSValueBinding toObject:_windowAssociationsController withKeyPath:selectedWindowTitlePath options:nil];
[self.enableAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(isEnabled))] options:nil];
[self.obfuscateAutotypeCheckButton bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(obfuscateDataTransfer))]
options:nil];
[self.customEntrySequenceTextField bind:NSEnabledBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(isEnabled))]
options:nil];
[self.customEntrySequenceTextField bind:NSValueBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(defaultKeystrokeSequence))]
options:@{ NSValidatesImmediatelyBindingOption: @(YES) }];
[_windowAssociationsController bind:NSContentArrayBinding
toObject:self.entryController
withKeyPath:[NSString stringWithFormat:kMPContentBindingString2, NSStringFromSelector(@selector(autotype)), NSStringFromSelector(@selector(associations))]
options:nil];
[self.windowTitleComboBox setStringValue:@""];
[self.windowTitleComboBox bind:NSValueBinding
toObject:_windowAssociationsController
withKeyPath:[NSString stringWithFormat:@"selection.%@", NSStringFromSelector(@selector(windowTitle))]
options:nil];
NSString *selectedWindowKeyStrokesPath = [[NSString alloc] initWithFormat:@"selection.%@", NSStringFromSelector(@selector(keystrokeSequence))];
[self.associationSequenceTextField bind:NSValueBinding toObject:_windowAssociationsController withKeyPath:selectedWindowKeyStrokesPath options:nil];
}
else {
[self.enableAutotypeCheckButton unbind:NSValueBinding];
[self.customEntrySequenceTextField unbind:NSEnabledBinding];
[self.customEntrySequenceTextField unbind:NSValueBinding];
if([_windowAssociationsController content] != nil) {
[_windowAssociationsController unbind:NSContentArrayBinding];
[_windowAssociationsController setContent:nil];
}
[self.windowTitleComboBox unbind:NSValueBinding];
[self.associationSequenceTextField unbind:NSValueBinding];
}
[self.associationSequenceTextField bind:NSValueBinding
toObject:_windowAssociationsController
withKeyPath:[NSString stringWithFormat:@"selection.%@", NSStringFromSelector(@selector(keystrokeSequence))]
options:nil];
}
- (void)_toggleEditing:(BOOL)edit {
NSArray <NSTextField *> *textFields = @[self.titleTextField,
self.usernameTextField,
self.URLTextField,
self.passwordTextField,
self.tagsTokenField
/*self.createdTextField,
self.modifiedTextField*/
];
self.usernameTextField,
self.URLTextField,
self.passwordTextField,
self.tagsTokenField
/*self.createdTextField,
self.modifiedTextField*/
];
for(NSTextField *t in textFields) {
t.editable = edit;
t.selectable = edit;
@@ -483,7 +497,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_willSave:(NSNotification *)notification {
// Force selected textfield to end editing
[[[self view] window] makeFirstResponder:nil];
[self.view.window makeFirstResponder:nil];
}
@end

View File

@@ -26,6 +26,6 @@
- (IBAction)pickExpiryDate:(id)sender;
/* Separate call to ensure all registered objects are in place */
- (void)regsiterNotificationsForDocument:(NSDocument *)document;
- (void)registerNotificationsForDocument:(NSDocument *)document;
@end

View File

@@ -47,6 +47,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
@property (weak) IBOutlet NSSplitView *splitView;
@property (unsafe_unretained) IBOutlet NSTextView *notesTextView;
@property (strong) NSObjectController *nodeController;
@end
@implementation MPInspectorViewController
@@ -61,6 +63,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
self.activeTab = MPEmptyTab;
self.entryViewController = [[MPEntryInspectorViewController alloc] init];
self.groupViewController = [[MPGroupInspectorViewController alloc] init];
self.nodeController = [[NSObjectController alloc] init];
}
return self;
}
@@ -70,18 +73,18 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
}
- (NSResponder *)reconmendedFirstResponder {
return [self view];
return self.view;
}
- (void)awakeFromNib {
[self.bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight];
self.bottomBar.borderType = (HNHBorderTop|HNHBorderHighlight);
[[self.noSelectionInfo cell] setBackgroundStyle:NSBackgroundStyleRaised];
[[self.itemImageView cell] setBackgroundStyle:NSBackgroundStyleRaised];
[self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil];
self.noSelectionInfo.cell.backgroundStyle = NSBackgroundStyleRaised;
self.itemImageView.cell.backgroundStyle = NSBackgroundStyleRaised;
[self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil];
NSView *entryView = [self.entryViewController view];
NSView *groupView = [self.groupViewController view];
NSView *entryView = self.entryViewController.view;
NSView *groupView = self.groupViewController.view;
NSTabViewItem *entryTabItem = [self.tabView tabViewItemAtIndex:MPEntryTab];
@@ -99,7 +102,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
[groupTabView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[groupView]|" options:0 metrics:nil views:views]];
[groupTabItem setInitialFirstResponder:groupView];
[[self view] layout];
[self.view layout];
/* Init edit and cancel buttons */
self.editButton.action = @selector(beginEditing:);
@@ -110,12 +113,12 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
[self _toggleEditors:NO];
}
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
- (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didChangeCurrentItem:)
name:MPDocumentCurrentItemChangedNotification
object:document];
[self.entryViewController regsiterNotificationsForDocument:document];
[self.entryViewController registerNotificationsForDocument:document];
[self.entryViewController setupBindings:document];
[self.groupViewController setupBindings:document];