added option to lock on user logout

This commit is contained in:
michael starke
2017-07-02 09:22:20 +02:00
parent 90ca759e67
commit 47c9491e71
10 changed files with 65 additions and 35 deletions

View File

@@ -263,7 +263,7 @@
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="82" secondAttribute="trailing" constant="20" symbolic="YES" id="4df-0Y-ggz"/> <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"/> <constraint firstItem="82" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="leading" constant="20" symbolic="YES" id="zU6-5h-Swa"/>
</constraints> </constraints>
<point key="canvasLocation" x="-18" y="-317"/> <point key="canvasLocation" x="294" y="-838"/>
</view> </view>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="4" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="291" height="712"/> <rect key="frame" x="0.0" y="0.0" width="291" height="712"/>
@@ -523,7 +523,7 @@
<constraint firstItem="0U8-TS-giU" firstAttribute="leading" secondItem="4" secondAttribute="leading" constant="20" id="kLH-Bj-C5m"/> <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 firstItem="57" firstAttribute="top" secondItem="59" secondAttribute="bottom" constant="8" symbolic="YES" id="lYe-am-xJx"/>
</constraints> </constraints>
<point key="canvasLocation" x="-430" y="-256"/> <point key="canvasLocation" x="-400" y="-728"/>
</customView> </customView>
<view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter"> <view translatesAutoresizingMaskIntoConstraints="NO" id="zv7-wE-Bmg" customClass="HNHUIScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="301" height="424"/> <rect key="frame" x="0.0" y="0.0" width="301" height="424"/>
@@ -778,7 +778,7 @@
<constraint firstAttribute="trailing" secondItem="45R-v4-ywl" secondAttribute="trailing" constant="20" symbolic="YES" id="uUm-S5-cxM"/> <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"/> <constraint firstAttribute="trailing" secondItem="z03-zW-GN3" secondAttribute="trailing" constant="20" symbolic="YES" id="wiq-pY-TG8"/>
</constraints> </constraints>
<point key="canvasLocation" x="-150" y="-889"/> <point key="canvasLocation" x="-50" y="-872"/>
</view> </view>
<scrollView borderType="line" autohidesScrollers="YES" horizontalLineScroll="56" horizontalPageScroll="10" verticalLineScroll="56" verticalPageScroll="10" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="180" customClass="HNHUIScrollView"> <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"/> <rect key="frame" x="0.0" y="0.0" width="261" height="270"/>
@@ -878,7 +878,7 @@
<connections> <connections>
<outlet property="nextKeyView" destination="QSX-Xo-tcH" id="KP9-D4-4cC"/> <outlet property="nextKeyView" destination="QSX-Xo-tcH" id="KP9-D4-4cC"/>
</connections> </connections>
<point key="canvasLocation" x="-772" y="-225"/> <point key="canvasLocation" x="-725" y="-950"/>
</scrollView> </scrollView>
</objects> </objects>
<resources> <resources>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<capability name="box content view" minToolsVersion="7.0"/> <capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPGeneralSettingsController"> <customObject id="-2" userLabel="File's Owner" customClass="MPGeneralSettingsController">
@@ -12,6 +12,7 @@
<outlet property="clearPasteboardTimeoutPopup" destination="419" id="521"/> <outlet property="clearPasteboardTimeoutPopup" destination="419" id="521"/>
<outlet property="createUntitledOnActivation" destination="879" id="920"/> <outlet property="createUntitledOnActivation" destination="879" id="920"/>
<outlet property="idleTimeOutPopup" destination="584" id="809"/> <outlet property="idleTimeOutPopup" destination="584" id="809"/>
<outlet property="lockOnLogoutCheckButton" destination="5SP-Vi-1sn" id="yaI-LH-R5A"/>
<outlet property="lockOnSleepCheckButton" destination="630" id="810"/> <outlet property="lockOnSleepCheckButton" destination="630" id="810"/>
<outlet property="rememberKeyFileCheckButton" destination="bSt-Wf-FNZ" id="aQm-EA-yAN"/> <outlet property="rememberKeyFileCheckButton" destination="bSt-Wf-FNZ" id="aQm-EA-yAN"/>
<outlet property="reopenLastDatabase" destination="530" id="878"/> <outlet property="reopenLastDatabase" destination="530" id="878"/>
@@ -21,16 +22,16 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="400" height="360"/> <rect key="frame" x="0.0" y="0.0" width="400" height="380"/>
<subviews> <subviews>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" title="Security" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="465"> <box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Security" translatesAutoresizingMaskIntoConstraints="NO" id="465">
<rect key="frame" x="17" y="16" width="366" height="246"/> <rect key="frame" x="17" y="16" width="366" height="266"/>
<view key="contentView" id="mNh-3L-Z6E"> <view key="contentView" id="mNh-3L-Z6E">
<rect key="frame" x="1" y="1" width="364" height="230"/> <rect key="frame" x="1" y="1" width="364" height="250"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="431"> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="431">
<rect key="frame" x="16" y="202" width="120" height="17"/> <rect key="frame" x="16" y="222" width="120" height="17"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="17" id="803"/> <constraint firstAttribute="height" constant="17" id="803"/>
</constraints> </constraints>
@@ -41,7 +42,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="419"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="419">
<rect key="frame" x="179" y="199" width="170" height="22"/> <rect key="frame" x="179" y="219" width="170" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="165" id="877"/> <constraint firstAttribute="width" constant="165" id="877"/>
</constraints> </constraints>
@@ -61,7 +62,7 @@
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
<button verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="447"> <button verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="447">
<rect key="frame" x="31" y="178" width="164" height="18"/> <rect key="frame" x="31" y="198" width="164" height="18"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="14" id="773"/> <constraint firstAttribute="height" constant="14" id="773"/>
</constraints> </constraints>
@@ -71,7 +72,7 @@
</buttonCell> </buttonCell>
</button> </button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="584"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="584">
<rect key="frame" x="179" y="150" width="170" height="26"/> <rect key="frame" x="179" y="170" width="170" height="26"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="585"> <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="585">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/> <font key="font" metaFont="menu"/>
@@ -88,14 +89,14 @@
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
<button translatesAutoresizingMaskIntoConstraints="NO" id="630"> <button translatesAutoresizingMaskIntoConstraints="NO" id="630">
<rect key="frame" x="31" y="131" width="119" height="18"/> <rect key="frame" x="31" y="151" width="119" height="18"/>
<buttonCell key="cell" type="check" title="Lock after sleep" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="631"> <buttonCell key="cell" type="check" title="Lock after sleep" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="631">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="805"> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="805">
<rect key="frame" x="16" y="155" width="93" height="17"/> <rect key="frame" x="16" y="175" width="93" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Lock while idle" id="806"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Lock while idle" id="806">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -109,7 +110,7 @@
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5cV-xX-SUU"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5cV-xX-SUU">
<rect key="frame" x="16" y="43" width="332" height="56"/> <rect key="frame" x="16" y="43" width="332" height="56"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="ACh-7H-42N"> <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="ACh-7H-42N">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -128,7 +129,19 @@
<action selector="clearRememberdKeyFiles:" target="-1" id="Vlr-aK-ikW"/> <action selector="clearRememberdKeyFiles:" target="-1" id="Vlr-aK-ikW"/>
</connections> </connections>
</button> </button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="5SP-Vi-1sn">
<rect key="frame" x="31" y="131" width="129" height="18"/>
<buttonCell key="cell" type="check" title="Lock after log out" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Dzn-9R-JjE">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews> </subviews>
<constraints>
<constraint firstItem="bSt-Wf-FNZ" firstAttribute="top" secondItem="5SP-Vi-1sn" secondAttribute="bottom" constant="11" id="WUG-Uf-FCO"/>
<constraint firstItem="5SP-Vi-1sn" firstAttribute="leading" secondItem="447" secondAttribute="leading" id="Ylr-aA-jaD"/>
<constraint firstItem="5SP-Vi-1sn" firstAttribute="top" secondItem="630" secondAttribute="bottom" constant="6" symbolic="YES" id="acg-vp-LeB"/>
</constraints>
</view> </view>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="419" secondAttribute="trailing" constant="16" id="1de-jU-TAq"/> <constraint firstAttribute="trailing" secondItem="419" secondAttribute="trailing" constant="16" id="1de-jU-TAq"/>
@@ -149,18 +162,15 @@
<constraint firstItem="oQr-FC-HkN" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="465" secondAttribute="leading" constant="16" id="kZ7-HL-y2Q"/> <constraint firstItem="oQr-FC-HkN" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="465" secondAttribute="leading" constant="16" id="kZ7-HL-y2Q"/>
<constraint firstItem="5cV-xX-SUU" firstAttribute="leading" secondItem="bSt-Wf-FNZ" secondAttribute="leading" id="qhV-iB-z4e"/> <constraint firstItem="5cV-xX-SUU" firstAttribute="leading" secondItem="bSt-Wf-FNZ" secondAttribute="leading" id="qhV-iB-z4e"/>
<constraint firstItem="oQr-FC-HkN" firstAttribute="top" secondItem="5cV-xX-SUU" secondAttribute="bottom" constant="8" id="qsT-Cs-vVj"/> <constraint firstItem="oQr-FC-HkN" firstAttribute="top" secondItem="5cV-xX-SUU" secondAttribute="bottom" constant="8" id="qsT-Cs-vVj"/>
<constraint firstItem="bSt-Wf-FNZ" firstAttribute="top" secondItem="630" secondAttribute="bottom" constant="11" id="tje-q7-o1T"/>
<constraint firstItem="447" firstAttribute="top" secondItem="419" secondAttribute="bottom" constant="8" symbolic="YES" id="u35-aE-Ui9"/> <constraint firstItem="447" firstAttribute="top" secondItem="419" secondAttribute="bottom" constant="8" symbolic="YES" id="u35-aE-Ui9"/>
<constraint firstItem="419" firstAttribute="leading" secondItem="584" secondAttribute="leading" id="xws-PK-qQU"/> <constraint firstItem="419" firstAttribute="leading" secondItem="584" secondAttribute="leading" id="xws-PK-qQU"/>
<constraint firstItem="630" firstAttribute="leading" secondItem="447" secondAttribute="leading" id="ybt-cQ-JwG"/> <constraint firstItem="630" firstAttribute="leading" secondItem="447" secondAttribute="leading" id="ybt-cQ-JwG"/>
<constraint firstItem="805" firstAttribute="top" secondItem="447" secondAttribute="bottom" constant="8" symbolic="YES" id="ywh-V0-xuC"/> <constraint firstItem="805" firstAttribute="top" secondItem="447" secondAttribute="bottom" constant="8" symbolic="YES" id="ywh-V0-xuC"/>
<constraint firstItem="447" firstAttribute="top" secondItem="431" secondAttribute="bottom" constant="8" symbolic="YES" id="zkd-Hf-09b"/> <constraint firstItem="447" firstAttribute="top" secondItem="431" secondAttribute="bottom" constant="8" symbolic="YES" id="zkd-Hf-09b"/>
</constraints> </constraints>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box> </box>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" title="Startup" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="888"> <box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Startup" translatesAutoresizingMaskIntoConstraints="NO" id="888">
<rect key="frame" x="17" y="266" width="366" height="74"/> <rect key="frame" x="17" y="286" width="366" height="74"/>
<view key="contentView" id="cpg-tt-SHE"> <view key="contentView" id="cpg-tt-SHE">
<rect key="frame" x="1" y="1" width="364" height="58"/> <rect key="frame" x="1" y="1" width="364" height="58"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -188,8 +198,6 @@
<constraint firstItem="530" firstAttribute="leading" secondItem="888" secondAttribute="leading" constant="16" id="iCa-F0-TFe"/> <constraint firstItem="530" firstAttribute="leading" secondItem="888" secondAttribute="leading" constant="16" id="iCa-F0-TFe"/>
<constraint firstItem="879" firstAttribute="top" secondItem="888" secondAttribute="top" constant="25" id="mTD-NM-deL"/> <constraint firstItem="879" firstAttribute="top" secondItem="888" secondAttribute="top" constant="25" id="mTD-NM-deL"/>
</constraints> </constraints>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box> </box>
</subviews> </subviews>
<constraints> <constraints>
@@ -202,7 +210,7 @@
<constraint firstItem="465" firstAttribute="top" secondItem="1" secondAttribute="top" constant="98" id="950"/> <constraint firstItem="465" firstAttribute="top" secondItem="1" secondAttribute="top" constant="98" id="950"/>
<constraint firstAttribute="bottom" secondItem="465" secondAttribute="bottom" constant="20" symbolic="YES" id="uwq-az-XwJ"/> <constraint firstAttribute="bottom" secondItem="465" secondAttribute="bottom" constant="20" symbolic="YES" id="uwq-az-XwJ"/>
</constraints> </constraints>
<point key="canvasLocation" x="394" y="190"/> <point key="canvasLocation" x="-54" y="66"/>
</customView> </customView>
</objects> </objects>
</document> </document>

View File

@@ -101,7 +101,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
/* We want to inform anyone about the changes to keyFile remembering */ /* We want to inform anyone about the changes to keyFile remembering */
[self bind:NSStringFromSelector(@selector(isAllowedToStoreKeyFile)) [self bind:NSStringFromSelector(@selector(isAllowedToStoreKeyFile))
toObject:[NSUserDefaultsController sharedUserDefaultsController] toObject:NSUserDefaultsController.sharedUserDefaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyRememberKeyFilesForDatabases] withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyRememberKeyFilesForDatabases]
options:nil]; options:nil];
} }

View File

@@ -39,6 +39,7 @@
toObject:view toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(value))] withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(value))]
options:nil]; options:nil];
// TODO: Move to public KeePassKit API! // TODO: Move to public KeePassKit API!
for(NSControl *control in @[view.labelTextField, view.valueTextField, view.removeButton ]) { for(NSControl *control in @[view.labelTextField, view.valueTextField, view.removeButton ]) {
[control bind:NSEnabledBinding [control bind:NSEnabledBinding
@@ -53,9 +54,8 @@
view.observer = tableView.window.windowController.document; view.observer = tableView.window.windowController.document;
//[view.removeButton bind:NSVisibleBinding toObject:view.valueTextField withKeyPath:@"" options:nil];
return view; return view;
} }
@end @end

View File

@@ -42,7 +42,7 @@
@property (weak) IBOutlet NSTableView *attachmentTableView; @property (weak) IBOutlet NSTableView *attachmentTableView;
/* Custom Fields */ /* Custom Fields */
@property (weak) IBOutlet NSTableView *customFieldsTableView; @property (strong) IBOutlet NSTableView *customFieldsTableView;
@property (weak) IBOutlet NSButton *showCustomDataButton; @property (weak) IBOutlet NSButton *showCustomDataButton;
/* Autotype */ /* Autotype */

View File

@@ -16,6 +16,7 @@
@property (weak) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup; @property (weak) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup;
@property (weak) IBOutlet NSPopUpButton *idleTimeOutPopup; @property (weak) IBOutlet NSPopUpButton *idleTimeOutPopup;
@property (weak) IBOutlet NSButton *lockOnSleepCheckButton; @property (weak) IBOutlet NSButton *lockOnSleepCheckButton;
@property (weak) IBOutlet NSButton *lockOnLogoutCheckButton;
@property (weak) IBOutlet NSButton *reopenLastDatabase; @property (weak) IBOutlet NSButton *reopenLastDatabase;
@property (weak) IBOutlet NSButton *createUntitledOnActivation; @property (weak) IBOutlet NSButton *createUntitledOnActivation;
@property (weak) IBOutlet NSButton *rememberKeyFileCheckButton; @property (weak) IBOutlet NSButton *rememberKeyFileCheckButton;

View File

@@ -36,6 +36,7 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
[self.clearPasteboardOnQuitCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyClearPasteboardOnQuit] options:nil]; [self.clearPasteboardOnQuitCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyClearPasteboardOnQuit] options:nil];
[self.clearPasteboardTimeoutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyPasteboardClearTimeout] options:nil]; [self.clearPasteboardTimeoutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyPasteboardClearTimeout] options:nil];
[self.lockOnSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil]; [self.lockOnSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil];
[self.lockOnLogoutCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnLogout] options:nil];
[self.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil]; [self.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil];
[self.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch] options:nil]; [self.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch] options:nil];
[self.rememberKeyFileCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyRememberKeyFilesForDatabases] options:nil]; [self.rememberKeyFileCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyRememberKeyFilesForDatabases] options:nil];

View File

@@ -13,6 +13,7 @@
@interface MPLockDaemon () @interface MPLockDaemon ()
@property (nonatomic,assign) BOOL lockOnSleep; @property (nonatomic,assign) BOOL lockOnSleep;
@property (nonatomic,assign) BOOL lockOnLogout;
@property (nonatomic,assign) NSUInteger idleLockTime; @property (nonatomic,assign) NSUInteger idleLockTime;
@property (nonatomic,strong) id eventHandler; @property (nonatomic,strong) id eventHandler;
@property (nonatomic,strong) NSTimer *idleCheckTimer; @property (nonatomic,strong) NSTimer *idleCheckTimer;
@@ -43,6 +44,7 @@ static MPLockDaemon *_sharedInstance;
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController]; NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[self bind:NSStringFromSelector(@selector(lockOnSleep)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil]; [self bind:NSStringFromSelector(@selector(lockOnSleep)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil];
[self bind:NSStringFromSelector(@selector(idleLockTime)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil]; [self bind:NSStringFromSelector(@selector(idleLockTime)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil];
[self bind:NSStringFromSelector(@selector(lockOnLogout)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnLogout] options:nil];
} }
return self; return self;
} }
@@ -55,6 +57,18 @@ static MPLockDaemon *_sharedInstance;
[NSEvent removeMonitor:self.eventHandler]; [NSEvent removeMonitor:self.eventHandler];
} }
- (void)setLockOnLogout:(BOOL)lockOnLogout {
if(_lockOnLogout != lockOnLogout) {
_lockOnLogout = lockOnLogout;
if(_lockOnLogout) {
[NSWorkspace.sharedWorkspace.notificationCenter addObserver:self selector:@selector(_willLogOutNotification:) name:NSWorkspaceSessionDidResignActiveNotification object:nil];
}
else {
[NSWorkspace.sharedWorkspace.notificationCenter removeObserver:self name:@"" object:nil];
}
}
}
- (void)setLockOnSleep:(BOOL)lockOnSleep { - (void)setLockOnSleep:(BOOL)lockOnSleep {
if(_lockOnSleep != lockOnSleep) { if(_lockOnSleep != lockOnSleep) {
_lockOnSleep = lockOnSleep; _lockOnSleep = lockOnSleep;
@@ -62,7 +76,7 @@ static MPLockDaemon *_sharedInstance;
[[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(_willSleepNotification:) name:NSWorkspaceWillSleepNotification object:nil]; [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(_willSleepNotification:) name:NSWorkspaceWillSleepNotification object:nil];
} }
else { else {
[[NSWorkspace sharedWorkspace].notificationCenter removeObserver:self]; [[NSWorkspace sharedWorkspace].notificationCenter removeObserver:self name:NSWorkspaceWillSleepNotification object:nil];
} }
} }
} }
@@ -79,6 +93,9 @@ static MPLockDaemon *_sharedInstance;
} }
} }
- (void)_willLogOutNotification:(NSNotification *)notification {
[((MPAppDelegate *)NSApp.delegate) lockAllDocuments];
}
- (void)_willSleepNotification:(NSNotification *)notification { - (void)_willSleepNotification:(NSNotification *)notification {
[((MPAppDelegate *)NSApp.delegate) lockAllDocuments]; [((MPAppDelegate *)NSApp.delegate) lockAllDocuments];
} }

View File

@@ -22,6 +22,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyBrowserBundleId;
/* Autolock */ /* Autolock */
APPKIT_EXTERN NSString *const kMPSettingsKeyLockOnSleep; APPKIT_EXTERN NSString *const kMPSettingsKeyLockOnSleep;
APPKIT_EXTERN NSString *const kMPSettingskeyLockOnLogout;
APPKIT_EXTERN NSString *const kMPSettingsKeyIdleLockTimeOut; APPKIT_EXTERN NSString *const kMPSettingsKeyIdleLockTimeOut;
/* Autosaving states */ /* Autosaving states */

View File

@@ -18,6 +18,7 @@ NSString *const kMPSettingsKeyBrowserBundleId = @"Browse
NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch"; NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch";
NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch"; NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch";
NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep"; NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep";
NSString *const kMPSettingskeyLockOnLogout = @"LockOnLogout";
NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut"; NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut";
NSString *const kMPSettingsKeyShowInspector = @"ShowInspector"; NSString *const kMPSettingsKeyShowInspector = @"ShowInspector";
NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors"; NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors";
@@ -101,6 +102,7 @@ NSString *const kMPDeprecatedSettingsKeyDefaultPasswordRounds = @"Ke
kMPSettingsKeyOpenEmptyDatabaseOnLaunch: @NO, kMPSettingsKeyOpenEmptyDatabaseOnLaunch: @NO,
kMPSettingsKeyReopenLastDatabaseOnLaunch: @YES, kMPSettingsKeyReopenLastDatabaseOnLaunch: @YES,
kMPSettingsKeyLockOnSleep: @YES, kMPSettingsKeyLockOnSleep: @YES,
kMPSettingskeyLockOnLogout: @NO,
kMPSettingsKeyIdleLockTimeOut: @0, // 5 minutes kMPSettingsKeyIdleLockTimeOut: @0, // 5 minutes
kMPSettingsKeyLegacyHideNotes: @NO, kMPSettingsKeyLegacyHideNotes: @NO,
kMPSettingsKeyLegacyHidePassword: @YES, kMPSettingsKeyLegacyHidePassword: @YES,