Implemented workflow double click settings

This commit is contained in:
James Hurst
2014-08-17 19:28:29 -04:00
parent 07057e450c
commit 1d19b08f21
14 changed files with 78 additions and 67 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="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPGeneralSettingsController">
@@ -10,7 +10,6 @@
<outlet property="clearPasteboardOnQuitCheckButton" destination="447" id="520"/>
<outlet property="clearPasteboardTimeoutPopup" destination="419" id="521"/>
<outlet property="createUntitledOnActivation" destination="879" id="920"/>
<outlet property="doubleClickURLToLaunchCheckButton" destination="929" id="958"/>
<outlet property="idleTimeOutPopup" destination="584" id="809"/>
<outlet property="lockOnSleepCheckButton" destination="630" id="810"/>
<outlet property="remeberKeyFile" destination="bSt-Wf-FNZ" id="836-2L-bX1"/>
@@ -22,33 +21,9 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="400" height="418"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="360"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" title="General" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="928">
<rect key="frame" x="17" y="266" width="366" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="364" height="38"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="252" translatesAutoresizingMaskIntoConstraints="NO" id="929">
<rect key="frame" x="16" y="12" width="234" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Double-click entry URL to Launch" bezelStyle="regularSquare" imagePosition="left" inset="2" id="937">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</view>
<constraints>
<constraint firstItem="929" firstAttribute="leading" secondItem="928" secondAttribute="leading" constant="16" id="933"/>
<constraint firstAttribute="bottom" secondItem="929" secondAttribute="bottom" constant="11" id="935"/>
</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 autoresizesSubviews="NO" verticalHuggingPriority="500" title="Security" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="465">
<rect key="frame" x="17" y="16" width="366" height="246"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -196,7 +171,7 @@
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" title="Startup" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="888">
<rect key="frame" x="17" y="324" width="366" height="74"/>
<rect key="frame" x="17" y="266" width="366" height="74"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="364" height="58"/>
@@ -238,13 +213,9 @@
<constraint firstAttribute="trailing" secondItem="888" secondAttribute="trailing" constant="20" symbolic="YES" id="893"/>
<constraint firstItem="888" firstAttribute="top" secondItem="1" secondAttribute="top" constant="20" symbolic="YES" id="903"/>
<constraint firstAttribute="width" constant="400" id="918"/>
<constraint firstItem="928" firstAttribute="top" secondItem="888" secondAttribute="bottom" constant="8" symbolic="YES" id="944"/>
<constraint firstItem="928" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="945"/>
<constraint firstAttribute="trailing" secondItem="928" secondAttribute="trailing" constant="20" symbolic="YES" id="947"/>
<constraint firstItem="465" firstAttribute="top" secondItem="928" secondAttribute="bottom" constant="8" symbolic="YES" id="949"/>
<constraint firstItem="465" firstAttribute="top" secondItem="1" secondAttribute="top" constant="156" 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"/>
</constraints>
</customView>
</objects>
</document>
</document>

View File

@@ -8,6 +8,8 @@
<customObject id="-2" userLabel="File's Owner" customClass="MPWorkflowSettingsController">
<connections>
<outlet property="browserPopup" destination="ehI-gq-lsb" id="YMy-L1-pQw"/>
<outlet property="doubleClickTitlePopup" destination="40" id="aKJ-q9-xjb"/>
<outlet property="doubleClickURLPopup" destination="13" id="fGP-5I-0XK"/>
<outlet property="view" destination="1" id="52"/>
</connections>
</customObject>
@@ -36,7 +38,7 @@
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13">
<rect key="frame" x="161" y="42" width="105" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="15">
@@ -59,13 +61,13 @@
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="40">
<rect key="frame" x="161" y="11" width="136" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="41">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="41">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="42">
<items>
<menuItem title="Opens Inspector" id="44"/>
<menuItem title="is Ignored" id="43"/>
<menuItem title="Is Ignored" id="43"/>
</items>
</menu>
</popUpButtonCell>

View File

@@ -660,7 +660,17 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
NSTableColumn *column = [self.entryTable tableColumns][[self.entryTable clickedColumn]];
NSString *identifier = [column identifier];
if([identifier isEqualToString:MPEntryTableTitleColumnIdentifier]) {
[[self windowController] showInspector:nil];
MPDoubleClickTitleAction action = [[NSUserDefaults standardUserDefaults] integerForKey:kMPSettingsKeyDoubleClickTitleAction];
if (action == MPDoubleClickTitleActionInspect) {
[[self windowController] showInspector:nil];
}
else if (action == MPDoubleClickTitleActionIgnore) {
}
else {
NSLog(@"Unknown double click action");
}
}
else if([identifier isEqualToString:MPEntryTablePasswordColumnIdentifier]) {
[self copyPassword:nil];
@@ -669,10 +679,16 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
[self copyUsername:nil];
}
else if([identifier isEqualToString:MPEntryTableURLColumnIdentifier]) {
if([[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyDoubleClickURLToLaunch])
MPDoubleClickURLAction action = [[NSUserDefaults standardUserDefaults] integerForKey:kMPSettingsKeyDoubleClickURLAction];
if(action == MPDoubleClickURLActionOpen) {
[self openURL:nil];
else
}
else if (action == MPDoubleClickURLActionCopy) {
[self copyURL:nil];
}
else {
NSLog(@"Unknown double click URL action");
}
}
// TODO: Add more actions for new columns
}

View File

@@ -13,7 +13,6 @@
@interface MPGeneralSettingsController : MPViewController <MPSettingsTab>
@property (weak) IBOutlet NSButton *clearPasteboardOnQuitCheckButton;
@property (weak) IBOutlet NSButton *doubleClickURLToLaunchCheckButton;
@property (weak) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup;
@property (weak) IBOutlet NSPopUpButton *idleTimeOutPopup;
@property (weak) IBOutlet NSButton *lockOnSleepCheckButton;

View File

@@ -34,7 +34,6 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[self.clearPasteboardOnQuitCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyClearPasteboardOnQuit] options:nil];
[self.doubleClickURLToLaunchCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickURLToLaunch] 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.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil];

View File

@@ -18,7 +18,6 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch;
APPKIT_EXTERN NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch;
/* URL handling */
APPKIT_EXTERN NSString *const kMPSettingsKeyDoubleClickURLToLaunch;
APPKIT_EXTERN NSString *const kMPSettingsKeyBrowserBundleId;
/* Server Settings */
@@ -50,7 +49,6 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyRememberKeyFilesForDatabases; //
APPKIT_EXTERN NSString *const kMPSettingsKeySendCommandForControlKey; // Should MacPass swap control for command. This is usefull in a cross plattform environment
APPKIT_EXTERN NSString *const kMPSettingsKeyEnableGlobalAutotype; // Is Global Autotype enabled?
APPKIT_EXTERN NSString *const kMPSettingsKeyGlobalAutotypeKeyDataKey; // The stored Data for the useder defined global autotype key
APPKIT_EXTERN NSString *const kMPDepricatedSettingsKeyDocumentsAutotypeFixNoteWasShown; // YES if Autotype fix was shown
/* Search */
APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterMode;
@@ -58,6 +56,20 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterMode;
/* Quicklook */
APPKIT_EXTERN NSString *const kMPSettingsKeyEnableQuicklookPreview;
/* Workflow */
APPKIT_EXTERN NSString *const kMPSettingsKeyDoubleClickURLAction;
APPKIT_EXTERN NSString *const kMPSettingsKeyDoubleClickTitleAction;
typedef NS_ENUM(NSUInteger, MPDoubleClickURLAction) {
MPDoubleClickURLActionCopy,
MPDoubleClickURLActionOpen,
};
typedef NS_ENUM(NSUInteger, MPDoubleClickTitleAction) {
MPDoubleClickTitleActionInspect,
MPDoubleClickTitleActionIgnore,
};
/* Password Generation */
APPKIT_EXTERN NSString *const kMPSettingsKeyCopyGeneratedPasswordToClipboard;
APPKIT_EXTERN NSString *const kMPSettingsKeyDefaultPasswordRounds;

View File

@@ -11,7 +11,6 @@
NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout";
NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit";
NSString *const kMPSettingsKeyDoubleClickURLToLaunch = @"DoubleClickURLToLaunch";
NSString *const kMPSettingsKeyBrowserBundleId = @"BrowserBundleId";
NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch";
NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch";
@@ -49,10 +48,14 @@ NSString *const kMPSettingsKeyPasswordCharacterFlags = @"Passwo
NSString *const kMPSettingsKeyPasswordUseCustomString = @"PasswordUseCustomString";
NSString *const kMPSettingsKeyPasswordCustomString = @"PasswordCustomString";
/* Depricated */
NSString *const kMPDepricatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases";
NSString *const kMPDepricatedSettingsKeyLastDatabasePath = @"MPLastDatabasePath";
NSString *const kMPDepricatedSettingsKeyDocumentsAutotypeFixNoteWasShown = @"DocumentsAutotypeFixNoteWasShown";
NSString *const kMPSettingsKeyDoubleClickURLAction = @"DoubleClickURLAction";
NSString *const kMPSettingsKeyDoubleClickTitleAction = @"DoubleClickTitleAction";
/* Deprecated */
NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases";
NSString *const kMPDeprecatedSettingsKeyLastDatabasePath = @"MPLastDatabasePath";
NSString *const kMPDeprecatedSettingsKeyDocumentsAutotypeFixNoteWasShown = @"DocumentsAutotypeFixNoteWasShown";
NSString *const kMPDeprecatedSettingsKeyDoubleClickURLToLaunch = @"DoubleClickURLToLaunch";
@implementation MPSettingsHelper
@@ -77,7 +80,6 @@ NSString *const kMPDepricatedSettingsKeyDocumentsAutotypeFixNoteWasShown = @"Do
kMPSettingsKeyShowInspector: @YES, // Show the Inspector by default
kMPSettingsKeyPasteboardClearTimeout: @30, // 30 seconds
kMPSettingsKeyClearPasteboardOnQuit: @YES,
kMPSettingsKeyDoubleClickURLToLaunch: @NO,
kMPSettingsKeyOpenEmptyDatabaseOnLaunch: @NO,
kMPSettingsKeyReopenLastDatabaseOnLaunch: @YES,
kMPSettingsKeyHttpPort: @19455,
@@ -100,27 +102,30 @@ NSString *const kMPDepricatedSettingsKeyDocumentsAutotypeFixNoteWasShown = @"Do
kMPSettingsKeyDefaultPasswordLength: @12,
kMPSettingsKeyPasswordCharacterFlags: @(MPPasswordCharactersAll),
kMPSettingsKeyPasswordUseCustomString: @NO,
kMPSettingsKeyPasswordCustomString: @""
kMPSettingsKeyPasswordCustomString: @"",
kMPSettingsKeyDoubleClickURLAction: @(MPDoubleClickURLActionCopy),
kMPSettingsKeyDoubleClickTitleAction: @(MPDoubleClickTitleActionInspect)
};
});
return standardDefaults;
}
+ (NSArray *)_depircatedSettingsKeys {
static NSArray *depircatedSettings;
+ (NSArray *)_deprecatedSettingsKeys {
static NSArray *deprecatedSettings;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
depircatedSettings = @[ kMPDepricatedSettingsKeyRememberKeyFilesForDatabases,
kMPDepricatedSettingsKeyLastDatabasePath,
kMPDepricatedSettingsKeyDocumentsAutotypeFixNoteWasShown ];
deprecatedSettings = @[ kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases,
kMPDeprecatedSettingsKeyLastDatabasePath,
kMPDeprecatedSettingsKeyDocumentsAutotypeFixNoteWasShown,
kMPDeprecatedSettingsKeyDoubleClickURLToLaunch ];
});
return depircatedSettings;
return deprecatedSettings;
}
+ (void)_removeObsolteValues {
/* Clear old style values */
for(NSString *key in [self _depircatedSettingsKeys]) {
for(NSString *key in [self _deprecatedSettingsKeys]) {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}
}

View File

@@ -12,6 +12,8 @@
@interface MPWorkflowSettingsController : MPViewController <MPSettingsTab>
@property (weak) IBOutlet NSPopUpButton *browserPopup;
@property (weak) IBOutlet NSPopUpButton *doubleClickURLPopup;
@property (weak) IBOutlet NSPopUpButton *doubleClickTitlePopup;
- (IBAction)_showCustomBrowserSelection:(id)sender;

View File

@@ -21,6 +21,11 @@
}
- (void)didLoadView {
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[self.doubleClickURLPopup bind:NSSelectedIndexBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickURLAction] options:nil];
[self.doubleClickTitlePopup bind:NSSelectedIndexBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickTitleAction] options:nil];
[self _updateBrowserSelection];
}

View File

@@ -20,7 +20,7 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "42"; */
"42.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "is Ignored"; ObjectID = "43"; */
/* Class = "NSMenuItem"; title = "Is Ignored"; ObjectID = "43"; */
"43.title" = "ignorieren";
/* Class = "NSMenuItem"; title = "Opens Inspector"; ObjectID = "44"; */

View File

@@ -20,8 +20,8 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "42"; */
"42.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "is Ignored"; ObjectID = "43"; */
"43.title" = "is Ignored";
/* Class = "NSMenuItem"; title = "Is Ignored"; ObjectID = "43"; */
"43.title" = "Is Ignored";
/* Class = "NSMenuItem"; title = "Opens Inspector"; ObjectID = "44"; */
"44.title" = "Opens Inspector";

View File

@@ -20,8 +20,8 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "42"; */
"42.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "is Ignored"; ObjectID = "43"; */
"43.title" = "is Ignored";
/* Class = "NSMenuItem"; title = "Is Ignored"; ObjectID = "43"; */
"43.title" = "Is Ignored";
/* Class = "NSMenuItem"; title = "Opens Inspector"; ObjectID = "44"; */
"44.title" = "Opens Inspector";

View File

@@ -20,8 +20,8 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "42"; */
"42.title" = "Overige";
/* Class = "NSMenuItem"; title = "is Ignored"; ObjectID = "43"; */
"43.title" = "is Genegeerd";
/* Class = "NSMenuItem"; title = "Is Ignored"; ObjectID = "43"; */
"43.title" = "Is Genegeerd";
/* Class = "NSMenuItem"; title = "Opens Inspector"; ObjectID = "44"; */
"44.title" = "Opent Inspector";

View File

@@ -20,7 +20,7 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "42"; */
"42.title" = "其他视图";
/* Class = "NSMenuItem"; title = "is Ignored"; ObjectID = "43"; */
/* Class = "NSMenuItem"; title = "Is Ignored"; ObjectID = "43"; */
"43.title" = "被忽略了";
/* Class = "NSMenuItem"; title = "Opens Inspector"; ObjectID = "44"; */