More NSStringFromSelector coverage

This commit is contained in:
michael starke
2014-03-25 23:38:01 +01:00
parent 8ddc4ccc9f
commit ca67a2fc60
6 changed files with 74 additions and 40 deletions

View File

@@ -19,18 +19,18 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/> <customObject id="-3" userLabel="Application"/>
<scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="37" customClass="HNHScrollView"> <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="37" customClass="HNHScrollView">
<rect key="frame" x="0.0" y="0.0" width="257" height="205"/> <rect key="frame" x="0.0" y="0.0" width="257" height="261"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="HjA-kA-fcX"> <clipView key="contentView" id="HjA-kA-fcX">
<rect key="frame" x="0.0" y="0.0" width="257" height="205"/> <rect key="frame" x="0.0" y="0.0" width="257" height="261"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view translatesAutoresizingMaskIntoConstraints="NO" id="38" customClass="HNHScrollDocumentViewAdapter"> <view translatesAutoresizingMaskIntoConstraints="NO" id="38" customClass="HNHScrollDocumentViewAdapter">
<rect key="frame" x="0.0" y="0.0" width="257" height="205"/> <rect key="frame" x="0.0" y="0.0" width="257" height="261"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="24"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="24">
<rect key="frame" x="18" y="186" width="35" height="14"/> <rect key="frame" x="18" y="242" width="35" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Name" id="25"> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Name" id="25">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -39,7 +39,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="23" customClass="HNHRoundedTextField"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="23" customClass="HNHRoundedTextField">
<rect key="frame" x="20" y="156" width="217" height="22"/> <rect key="frame" x="20" y="212" width="217" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="26"> <textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="26">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -51,8 +51,11 @@
</connections> </connections>
</textField> </textField>
<button horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="5"> <button horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="5">
<rect key="frame" x="18" y="128" width="67" height="18"/> <rect key="frame" x="18" y="184" width="67" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="pWR-o1-KI6"/>
</constraints>
<buttonCell key="cell" type="check" title="Expires" bezelStyle="regularSquare" imagePosition="left" lineBreakMode="truncatingMiddle" state="on" inset="2" id="32"> <buttonCell key="cell" type="check" title="Expires" bezelStyle="regularSquare" imagePosition="left" lineBreakMode="truncatingMiddle" state="on" inset="2" id="32">
<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"/>
@@ -62,7 +65,7 @@
</connections> </connections>
</button> </button>
<button focusRingType="exterior" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4"> <button focusRingType="exterior" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4">
<rect key="frame" x="206" y="127" width="31" height="19"/> <rect key="frame" x="206" y="183" width="31" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="31" id="l5I-EF-dHs"/> <constraint firstAttribute="width" constant="31" id="l5I-EF-dHs"/>
@@ -77,7 +80,7 @@
</connections> </connections>
</button> </button>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="229"> <popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="229">
<rect key="frame" x="18" y="72" width="222" height="26"/> <rect key="frame" x="18" y="128" width="222" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="230"> <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="230">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
@@ -97,7 +100,7 @@
</connections> </connections>
</popUpButton> </popUpButton>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="240"> <popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="240">
<rect key="frame" x="18" y="17" width="222" height="26"/> <rect key="frame" x="18" y="73" width="222" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="242"> <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="242">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
@@ -111,11 +114,11 @@
</menu> </menu>
</popUpButtonCell> </popUpButtonCell>
<connections> <connections>
<outlet property="nextKeyView" destination="23" id="uir-lY-3HQ"/> <outlet property="nextKeyView" destination="Fnw-qz-IZU" id="Q0q-HY-T34"/>
</connections> </connections>
</popUpButton> </popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="264"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="264">
<rect key="frame" x="18" y="104" width="40" height="14"/> <rect key="frame" x="18" y="160" width="40" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search" id="265"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search" id="265">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -124,7 +127,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="276"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="276">
<rect key="frame" x="18" y="49" width="53" height="14"/> <rect key="frame" x="18" y="105" width="53" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Autotype" id="277"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Autotype" id="277">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -132,8 +135,30 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Fnw-qz-IZU" customClass="HNHRoundedTextField">
<rect key="frame" x="20" y="20" width="217" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="VeF-V7-i2I">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="nextKeyView" destination="23" id="ZlU-EF-myK"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6Lw-XW-x20">
<rect key="frame" x="18" y="50" width="107" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Autotype Sequence" id="6FG-UZ-Adh">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="Fnw-qz-IZU" secondAttribute="trailing" constant="20" symbolic="YES" id="3Gx-EC-k0Q"/>
<constraint firstItem="240" firstAttribute="top" secondItem="276" secondAttribute="bottom" constant="8" id="6Pu-PB-xxy"/> <constraint firstItem="240" firstAttribute="top" secondItem="276" secondAttribute="bottom" constant="8" id="6Pu-PB-xxy"/>
<constraint firstItem="23" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="ABR-Ef-1ss"/> <constraint firstItem="23" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="ABR-Ef-1ss"/>
<constraint firstAttribute="trailing" secondItem="229" secondAttribute="trailing" constant="20" symbolic="YES" id="Anv-gp-aTi"/> <constraint firstAttribute="trailing" secondItem="229" secondAttribute="trailing" constant="20" symbolic="YES" id="Anv-gp-aTi"/>
@@ -141,20 +166,24 @@
<constraint firstItem="240" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="E0a-1e-KR9"/> <constraint firstItem="240" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="E0a-1e-KR9"/>
<constraint firstItem="5" firstAttribute="centerY" secondItem="4" secondAttribute="centerY" id="FdF-Pn-yY2"/> <constraint firstItem="5" firstAttribute="centerY" secondItem="4" secondAttribute="centerY" id="FdF-Pn-yY2"/>
<constraint firstItem="5" firstAttribute="top" secondItem="23" secondAttribute="bottom" constant="12" id="GFF-xs-Nuj"/> <constraint firstItem="5" firstAttribute="top" secondItem="23" secondAttribute="bottom" constant="12" id="GFF-xs-Nuj"/>
<constraint firstItem="Fnw-qz-IZU" firstAttribute="top" secondItem="6Lw-XW-x20" secondAttribute="bottom" constant="8" id="Gfr-Tc-ldH"/>
<constraint firstItem="4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="5" secondAttribute="trailing" constant="8" symbolic="YES" id="HDo-Yu-P02"/> <constraint firstItem="4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="5" secondAttribute="trailing" constant="8" symbolic="YES" id="HDo-Yu-P02"/>
<constraint firstItem="24" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="OhC-BP-oPg"/> <constraint firstItem="24" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="OhC-BP-oPg"/>
<constraint firstItem="6Lw-XW-x20" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="SVn-Hh-xc6"/>
<constraint firstAttribute="trailing" secondItem="240" secondAttribute="trailing" constant="20" symbolic="YES" id="V4d-R9-46P"/> <constraint firstAttribute="trailing" secondItem="240" secondAttribute="trailing" constant="20" symbolic="YES" id="V4d-R9-46P"/>
<constraint firstAttribute="trailing" secondItem="23" secondAttribute="trailing" constant="20" id="Vej-zI-z2w"/> <constraint firstAttribute="trailing" secondItem="23" secondAttribute="trailing" constant="20" id="Vej-zI-z2w"/>
<constraint firstItem="24" firstAttribute="top" secondItem="38" secondAttribute="top" constant="5" id="Wk6-kJ-fTY"/> <constraint firstItem="24" firstAttribute="top" secondItem="38" secondAttribute="top" constant="5" id="Wk6-kJ-fTY"/>
<constraint firstItem="5" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="ZaF-lS-pN8"/> <constraint firstItem="5" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="ZaF-lS-pN8"/>
<constraint firstItem="276" firstAttribute="top" secondItem="229" secondAttribute="bottom" constant="12" id="c0H-cE-rnF"/> <constraint firstItem="276" firstAttribute="top" secondItem="229" secondAttribute="bottom" constant="12" id="c0H-cE-rnF"/>
<constraint firstItem="6Lw-XW-x20" firstAttribute="top" secondItem="240" secondAttribute="bottom" constant="12" id="hDT-8L-2eV"/>
<constraint firstItem="23" firstAttribute="top" secondItem="24" secondAttribute="bottom" constant="8" id="kbc-Eb-FPr"/> <constraint firstItem="23" firstAttribute="top" secondItem="24" secondAttribute="bottom" constant="8" id="kbc-Eb-FPr"/>
<constraint firstItem="Fnw-qz-IZU" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="lGO-Wz-eF9"/>
<constraint firstItem="229" firstAttribute="top" secondItem="264" secondAttribute="bottom" constant="8" id="pDa-nw-ByQ"/> <constraint firstItem="229" firstAttribute="top" secondItem="264" secondAttribute="bottom" constant="8" id="pDa-nw-ByQ"/>
<constraint firstItem="264" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="qnB-Pd-MqU"/> <constraint firstItem="264" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="qnB-Pd-MqU"/>
<constraint firstItem="229" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="sCg-Na-ouj"/> <constraint firstItem="229" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="sCg-Na-ouj"/>
<constraint firstItem="276" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="xLc-Rz-374"/> <constraint firstItem="276" firstAttribute="leading" secondItem="38" secondAttribute="leading" constant="20" id="xLc-Rz-374"/>
<constraint firstAttribute="bottom" secondItem="Fnw-qz-IZU" secondAttribute="bottom" constant="20" symbolic="YES" id="xRe-8b-p6s"/>
<constraint firstItem="264" firstAttribute="top" secondItem="5" secondAttribute="bottom" constant="12" id="xe7-ue-Wip"/> <constraint firstItem="264" firstAttribute="top" secondItem="5" secondAttribute="bottom" constant="12" id="xe7-ue-Wip"/>
<constraint firstAttribute="bottom" secondItem="240" secondAttribute="bottom" constant="20" symbolic="YES" id="zhA-eR-h1f"/>
</constraints> </constraints>
</view> </view>
</subviews> </subviews>

View File

@@ -27,7 +27,7 @@
} }
- (instancetype)initWithDefaultSequenceForEntry:(KPKEntry *)entry { - (instancetype)initWithDefaultSequenceForEntry:(KPKEntry *)entry {
self = [self initWithEntry:entry andSequence:entry.autotype.defaultSequence]; self = [self initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence];
return self; return self;
} }

View File

@@ -85,8 +85,6 @@ NSString *const kMPApplciationNameKey = @"applicationName";
NSDictionary *frontApplicationInfoDict = [self _frontMostApplicationInfoDict]; NSDictionary *frontApplicationInfoDict = [self _frontMostApplicationInfoDict];
NSString *windowTitle = frontApplicationInfoDict[kMPWindowTitleKey]; NSString *windowTitle = frontApplicationInfoDict[kMPWindowTitleKey];
self.lastFrontMostApplication = frontApplicationInfoDict[kMPApplciationNameKey]; self.lastFrontMostApplication = frontApplicationInfoDict[kMPApplciationNameKey];
//NSLog(@"Looking for entries matching window title:%@ of applciation: %@", windowTitle, applicationName);
/* /*
Query the document to generate a autotype command list for the window title Query the document to generate a autotype command list for the window title
We do not care where this came form, just get the autotype commands We do not care where this came form, just get the autotype commands
@@ -137,6 +135,10 @@ NSString *const kMPApplciationNameKey = @"applicationName";
NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID)); NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID));
for(NSDictionary *windowDict in currentWindows) { for(NSDictionary *windowDict in currentWindows) {
NSString *windowTitle = windowDict[(NSString *)kCGWindowName];
if([windowTitle length] <= 0) {
continue;
}
NSNumber *processId = windowDict[(NSString *)kCGWindowOwnerPID]; NSNumber *processId = windowDict[(NSString *)kCGWindowOwnerPID];
if(processId && [processId isEqualToNumber:@(frontApplication.processIdentifier)]) { if(processId && [processId isEqualToNumber:@(frontApplication.processIdentifier)]) {
return @{ return @{
@@ -172,11 +174,14 @@ NSString *const kMPApplciationNameKey = @"applicationName";
} }
+ (void)_orderApplicationToFront:(NSString *)applicationName { + (void)_orderApplicationToFront:(NSString *)applicationName {
NSLog(@"Moving %@ to the front.", applicationName); //NSLog(@"Moving %@ to the front.", applicationName);
NSString *appleScript = [[NSString alloc] initWithFormat:@"activate application \"%@\"", applicationName]; NSString *appleScript = [[NSString alloc] initWithFormat:@"activate application \"%@\"", applicationName];
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:appleScript]; NSAppleScript *script = [[NSAppleScript alloc] initWithSource:appleScript];
NSDictionary *error; NSDictionary *error;
NSAppleEventDescriptor *descriptor = [script executeAndReturnError:&error]; NSAppleEventDescriptor *descriptor = [script executeAndReturnError:&error];
if(descriptor) {
NSLog(@"Error trying to execure %@: %@", script, error);
}
} }

View File

@@ -41,7 +41,7 @@
NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch]; NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];
MPAutotypeContext *context; MPAutotypeContext *context;
if(titleRange.location != NSNotFound && titleRange.length != 0) { if(titleRange.location != NSNotFound && titleRange.length != 0) {
context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultSequence]; context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence];
} }
/* search in Autotype entries for match */ /* search in Autotype entries for match */
else { else {

View File

@@ -86,30 +86,30 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[self _addScrollViewWithView:self.generalView atTab:MPEntryTabGeneral]; [self _addScrollViewWithView:self.generalView atTab:MPEntryTabGeneral];
[self _addScrollViewWithView:self.autotypView atTab:MPEntryTabAutotype]; [self _addScrollViewWithView:self.autotypView atTab:MPEntryTabAutotype];
[self.infoTabControl bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil]; [self.infoTabControl bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil];
[self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil]; [self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil];
/* Set background to clearcolor so we can draw in the scrollview */ /* Set background to clearcolor so we can draw in the scrollview */
[self.attachmentTableView setBackgroundColor:[NSColor clearColor]]; [self.attachmentTableView setBackgroundColor:[NSColor clearColor]];
[self.attachmentTableView bind:NSContentBinding toObject:_attachmentsController withKeyPath:@"arrangedObjects" options:nil]; [self.attachmentTableView bind:NSContentBinding toObject:_attachmentsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil];
[self.attachmentTableView setDelegate:_attachmentTableDelegate]; [self.attachmentTableView setDelegate:_attachmentTableDelegate];
[self.attachmentTableView setDataSource:_attachmentDataSource]; [self.attachmentTableView setDataSource:_attachmentDataSource];
[self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]]; [self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]];
/* Set background to clearcolor so we can draw in the scrollview */ /* Set background to clearcolor so we can draw in the scrollview */
[self.customFieldsTableView setBackgroundColor:[NSColor clearColor]]; [self.customFieldsTableView setBackgroundColor:[NSColor clearColor]];
[self.customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:@"arrangedObjects" options:nil]; [self.customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil];
[self.customFieldsTableView setDelegate:_customFieldTableDelegate]; [self.customFieldsTableView setDelegate:_customFieldTableDelegate];
[self.windowAssociationsTableView setBackgroundColor:[NSColor clearColor]]; [self.windowAssociationsTableView setBackgroundColor:[NSColor clearColor]];
[self.windowAssociationsTableView setDelegate:_windowAssociationsTableDelegate]; [self.windowAssociationsTableView setDelegate:_windowAssociationsTableDelegate];
[self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:@"arrangedObjects" options:nil]; [self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil];
[self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil]; [self.passwordTextField bind:NSStringFromSelector(@selector(showPassword)) toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
[self.togglePassword bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil]; [self.togglePassword bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil];
} }
- (void)setupBindings:(MPDocument *)document { - (void)setupBindings:(MPDocument *)document {
[self bind:@"entry" toObject:document withKeyPath:@"selectedEntry" options:nil]; [self bind:NSStringFromSelector(@selector(entry)) toObject:document withKeyPath:NSStringFromSelector(@selector(selectedEntry)) options:nil];
} }
- (void)setEntry:(KPKEntry *)entry { - (void)setEntry:(KPKEntry *)entry {
@@ -336,16 +336,16 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_bindEntry { - (void)_bindEntry {
if(self.entry) { if(self.entry) {
[self.titleTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"title" options:nil]; [self.titleTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(title)) options:nil];
[self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"password" options:nil]; [self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(password)) options:nil];
[self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"username" options:nil]; [self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(username)) options:nil];
[self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"url" options:nil]; [self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(url)) options:nil];
[self.expiresCheckButton bind:NSTitleBinding [self.expiresCheckButton bind:NSTitleBinding
toObject:self.entry.timeInfo toObject:self.entry.timeInfo
withKeyPath:NSStringFromSelector(@selector(expiryTime)) withKeyPath:NSStringFromSelector(@selector(expiryTime))
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }]; options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
[self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:@"expires" options:nil]; [self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
[self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:@"tags" options:nil]; [self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(tags)) options:nil];
} }
else { else {
[self.titleTextField unbind:NSValueBinding]; [self.titleTextField unbind:NSValueBinding];
@@ -359,7 +359,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_bindAttachments { - (void)_bindAttachments {
if(self.entry) { if(self.entry) {
[_attachmentsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"binaries" options:nil]; [_attachmentsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(binaries)) options:nil];
} }
else if([_attachmentsController content] != nil){ else if([_attachmentsController content] != nil){
[_attachmentsController unbind:NSContentArrayBinding]; [_attachmentsController unbind:NSContentArrayBinding];
@@ -369,7 +369,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_bindCustomFields { - (void)_bindCustomFields {
if(self.entry) { if(self.entry) {
[_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"customAttributes" options:nil]; [_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(customAttributes)) options:nil];
} }
else if ([_customFieldsController content] != nil ) { else if ([_customFieldsController content] != nil ) {
[_customFieldsController unbind:NSContentArrayBinding]; [_customFieldsController unbind:NSContentArrayBinding];
@@ -379,10 +379,10 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
- (void)_bindAutotype { - (void)_bindAutotype {
if(self.entry) { if(self.entry) {
[self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" options:nil]; [self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil];
[self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" 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:@"defaultSequence" options:nil]; [self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(defaultKeystrokeSequence)) options:nil];
[_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:@"associations" options:nil]; [_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(associations)) options:nil];
} }
else { else {
[self.enableAutotypeCheckButton unbind:NSValueBinding]; [self.enableAutotypeCheckButton unbind:NSValueBinding];