Added checkbox to disable autosave

This commit is contained in:
Michael Starke
2019-03-25 08:52:37 +01:00
parent 7ba9ec2685
commit 6d046bc933
5 changed files with 51 additions and 21 deletions

View File

@@ -10,6 +10,7 @@
<connections>
<outlet property="clearPasteboardOnQuitCheckButton" destination="447" id="520"/>
<outlet property="clearPasteboardTimeoutPopup" destination="419" id="521"/>
<outlet property="enableAutosaveCheckButton" destination="lz3-4U-UMI" id="L5y-58-IgH"/>
<outlet property="fileChangeStrategyPopup" destination="wIu-Sh-2a2" id="oJo-dA-lEE"/>
<outlet property="idleTimeOutPopup" destination="584" id="809"/>
<outlet property="lockOnLogoutCheckButton" destination="5SP-Vi-1sn" id="yaI-LH-R5A"/>
@@ -23,7 +24,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="400" height="482"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="524"/>
<subviews>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Security" translatesAutoresizingMaskIntoConstraints="NO" id="465">
<rect key="frame" x="17" y="16" width="366" height="357"/>
@@ -157,11 +158,18 @@
</subviews>
<constraints>
<constraint firstItem="5cV-xX-SUU" firstAttribute="leading" secondItem="mNh-3L-Z6E" secondAttribute="leading" constant="20" symbolic="YES" id="1jw-nb-bAB"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="630" secondAttribute="trailing" constant="20" symbolic="YES" id="7cd-1e-eRD"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="nqZ-rB-mFS" secondAttribute="trailing" constant="20" symbolic="YES" id="CL9-fA-GTJ"/>
<constraint firstItem="584" firstAttribute="top" secondItem="hy4-RL-dAa" secondAttribute="bottom" constant="8" symbolic="YES" id="SV7-PD-nId"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="bSt-Wf-FNZ" secondAttribute="trailing" constant="20" symbolic="YES" id="VQY-eq-fCM"/>
<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="hy4-RL-dAa" firstAttribute="top" secondItem="nqZ-rB-mFS" secondAttribute="bottom" constant="8" symbolic="YES" id="a3i-tc-gUU"/>
<constraint firstItem="5SP-Vi-1sn" firstAttribute="top" secondItem="630" secondAttribute="bottom" constant="6" symbolic="YES" id="acg-vp-LeB"/>
<constraint firstItem="584" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="805" secondAttribute="trailing" constant="8" symbolic="YES" id="aoz-sS-O0n"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="447" secondAttribute="trailing" constant="20" symbolic="YES" id="i8H-ad-IKb"/>
<constraint firstItem="419" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="431" secondAttribute="trailing" constant="8" symbolic="YES" id="pN3-pB-Z5I"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="5SP-Vi-1sn" secondAttribute="trailing" constant="20" symbolic="YES" id="q0v-Wo-mHx"/>
<constraint firstItem="nqZ-rB-mFS" firstAttribute="top" secondItem="447" secondAttribute="bottom" constant="11" id="qLm-ih-A04"/>
<constraint firstAttribute="trailing" secondItem="5cV-xX-SUU" secondAttribute="trailing" constant="20" symbolic="YES" id="qY0-io-RZ0"/>
<constraint firstAttribute="trailing" secondItem="hy4-RL-dAa" secondAttribute="trailing" constant="20" symbolic="YES" id="r5c-KT-eh0"/>
@@ -193,18 +201,33 @@
</constraints>
</box>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="File Handling" translatesAutoresizingMaskIntoConstraints="NO" id="888">
<rect key="frame" x="17" y="375" width="366" height="87"/>
<rect key="frame" x="17" y="375" width="366" height="129"/>
<view key="contentView" id="cpg-tt-SHE">
<rect key="frame" x="3" y="3" width="360" height="69"/>
<rect key="frame" x="3" y="3" width="360" height="111"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="252" translatesAutoresizingMaskIntoConstraints="NO" id="530">
<rect key="frame" x="14" y="43" width="234" height="18"/>
<rect key="frame" x="14" y="85" width="234" height="18"/>
<buttonCell key="cell" type="check" title="Reopen last Database after Launch" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="531">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lz3-4U-UMI">
<rect key="frame" x="14" y="65" width="123" height="18"/>
<buttonCell key="cell" type="check" title="Enable Autosave" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="wG7-bi-2fi">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Bo-Ml-1KB">
<rect key="frame" x="18" y="45" width="324" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Close and open all documents for changes to take effect" id="ya5-ps-c4W">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="h3w-Ms-ohK">
<rect key="frame" x="14" y="20" width="93" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="If file changes:" id="QrK-hM-Xt1">
@@ -223,12 +246,19 @@
</popUpButton>
</subviews>
<constraints>
<constraint firstItem="3Bo-Ml-1KB" firstAttribute="leading" secondItem="cpg-tt-SHE" secondAttribute="leading" constant="20" symbolic="YES" id="2Jh-pk-bN7"/>
<constraint firstAttribute="trailing" secondItem="wIu-Sh-2a2" secondAttribute="trailing" constant="20" id="2Qw-fT-Dd8"/>
<constraint firstAttribute="trailing" secondItem="3Bo-Ml-1KB" secondAttribute="trailing" constant="20" symbolic="YES" id="2UW-ao-hrC"/>
<constraint firstAttribute="bottom" secondItem="h3w-Ms-ohK" secondAttribute="bottom" constant="20" symbolic="YES" id="3KB-kR-5d6"/>
<constraint firstItem="h3w-Ms-ohK" firstAttribute="leading" secondItem="530" secondAttribute="leading" id="4Fi-rX-8e0"/>
<constraint firstItem="lz3-4U-UMI" firstAttribute="top" secondItem="530" secondAttribute="bottom" constant="6" symbolic="YES" id="BQf-9P-8Y8"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="lz3-4U-UMI" secondAttribute="trailing" constant="20" symbolic="YES" id="Kaj-GT-zpd"/>
<constraint firstItem="wIu-Sh-2a2" firstAttribute="leading" secondItem="h3w-Ms-ohK" secondAttribute="trailing" constant="8" id="LYK-Na-Md1"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="530" secondAttribute="trailing" constant="20" symbolic="YES" id="QEp-Zq-u24"/>
<constraint firstItem="wIu-Sh-2a2" firstAttribute="baseline" secondItem="h3w-Ms-ohK" secondAttribute="baseline" id="Zqx-cl-oal"/>
<constraint firstItem="h3w-Ms-ohK" firstAttribute="top" secondItem="530" secondAttribute="bottom" constant="8" id="kIs-yJ-F2K"/>
<constraint firstItem="h3w-Ms-ohK" firstAttribute="top" secondItem="3Bo-Ml-1KB" secondAttribute="bottom" constant="8" symbolic="YES" id="emA-Z1-LCv"/>
<constraint firstItem="lz3-4U-UMI" firstAttribute="leading" secondItem="cpg-tt-SHE" secondAttribute="leading" constant="16" id="pm7-O1-afa"/>
<constraint firstItem="3Bo-Ml-1KB" firstAttribute="top" secondItem="lz3-4U-UMI" secondAttribute="bottom" constant="8" symbolic="YES" id="xkU-ut-P9X"/>
</constraints>
</view>
<constraints>
@@ -247,7 +277,7 @@
<constraint firstAttribute="bottom" secondItem="465" secondAttribute="bottom" constant="20" symbolic="YES" id="uwq-az-XwJ"/>
<constraint firstItem="465" firstAttribute="top" secondItem="cpg-tt-SHE" secondAttribute="bottom" constant="5" id="wyH-HB-i2U"/>
</constraints>
<point key="canvasLocation" x="-363" y="-54"/>
<point key="canvasLocation" x="-131" y="-93"/>
</customView>
</objects>
</document>

View File

@@ -25,7 +25,7 @@
<rect key="frame" x="0.0" y="0.0" width="508" height="392"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2">
<rect key="frame" x="310" y="105" width="83" height="32"/>
<rect key="frame" x="309" y="105" width="83" height="32"/>
<buttonCell key="cell" type="push" title="Unlock" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -85,14 +85,14 @@ DQ
</connections>
</secureTextField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="408">
<rect key="frame" x="358" y="185" width="29" height="23"/>
<rect key="frame" x="357.5" y="185" width="29" height="23"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSQuickLookTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="409">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="486">
<rect key="frame" x="358" y="152" width="29" height="23"/>
<rect key="frame" x="357.5" y="152" width="29" height="23"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSStopProgressTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="487">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -109,7 +109,7 @@ DQ
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2pb-ZG-spA">
<rect key="frame" x="228" y="105" width="82" height="32"/>
<rect key="frame" x="227" y="105" width="82" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="erj-mR-UyO">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>

View File

@@ -116,7 +116,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
}
+ (BOOL)autosavesInPlace {
return YES;
return [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyEnableAutosave];
}
- (instancetype)init {

View File

@@ -26,15 +26,15 @@
@interface MPGeneralSettingsController : MPViewController <MPPreferencesTab>
@property (weak) IBOutlet NSButton *clearPasteboardOnQuitCheckButton;
@property (weak) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup;
@property (strong) IBOutlet NSButton *clearPasteboardOnQuitCheckButton;
@property (strong) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup;
@property (strong) IBOutlet NSButton *preventUniversalClipboardSupportCheckButton;
@property (weak) IBOutlet NSPopUpButton *idleTimeOutPopup;
@property (weak) IBOutlet NSButton *lockOnSleepCheckButton;
@property (weak) IBOutlet NSButton *lockOnLogoutCheckButton;
@property (weak) IBOutlet NSButton *reopenLastDatabase;
@property (weak) IBOutlet NSButton *createUntitledOnActivation;
@property (weak) IBOutlet NSButton *rememberKeyFileCheckButton;
@property (weak) IBOutlet NSPopUpButton *fileChangeStrategyPopup;
@property (strong) IBOutlet NSPopUpButton *idleTimeOutPopup;
@property (strong) IBOutlet NSButton *lockOnSleepCheckButton;
@property (strong) IBOutlet NSButton *lockOnLogoutCheckButton;
@property (strong) IBOutlet NSButton *reopenLastDatabase;
@property (strong) IBOutlet NSButton *enableAutosaveCheckButton;
@property (strong) IBOutlet NSButton *rememberKeyFileCheckButton;
@property (strong) IBOutlet NSPopUpButton *fileChangeStrategyPopup;
@end

View File

@@ -54,8 +54,8 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
[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.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch] options:nil];
[self.enableAutosaveCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableAutosave] options:nil];
[self.rememberKeyFileCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyRememberKeyFilesForDatabases] options:nil];
[self.createUntitledOnActivation setState:NSOffState]; //kMPSettingsKeyOpenEmptyDatabaseOnLaunch
/* File Change Strategy Menu */
NSDictionary *fileChangeStragegyDict = @{ @(MPFileChangeStrategyAsk) : NSLocalizedString(@"FILE_CHANGE_STRATEGY_ASK", @"External file change strategy option: ask what to do"),