diff options
author | Teddy Wing | 2018-09-05 20:51:28 +0200 |
---|---|---|
committer | Teddy Wing | 2018-09-05 20:51:28 +0200 |
commit | d24637ebbadfd31826609fd638c5851d3ce29f98 (patch) | |
tree | b8e4037d0a5026ae00d2b2227976819a4aba5840 /CopyMailto | |
parent | 9d8676896db252f4b6c7364da66947504ee33d3b (diff) | |
download | Copy-Mailto-d24637ebbadfd31826609fd638c5851d3ce29f98.tar.bz2 |
Add label that displays the email address coming from `mailto`
It starts with `mailto:`, so we remove that with a substring method
call.
Diffstat (limited to 'CopyMailto')
-rw-r--r-- | CopyMailto/AppDelegate.h | 1 | ||||
-rw-r--r-- | CopyMailto/AppDelegate.m | 4 | ||||
-rw-r--r-- | CopyMailto/Base.lproj/MainMenu.xib | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/CopyMailto/AppDelegate.h b/CopyMailto/AppDelegate.h index b46e3ff..321d100 100644 --- a/CopyMailto/AppDelegate.h +++ b/CopyMailto/AppDelegate.h @@ -10,6 +10,7 @@ @interface AppDelegate : NSObject <NSApplicationDelegate> { IBOutlet NSWindow *_window; + IBOutlet NSTextField *_email_address; } - (void)handleURLEvent:(NSAppleEventDescriptor *)event diff --git a/CopyMailto/AppDelegate.m b/CopyMailto/AppDelegate.m index 213f403..6f3477d 100644 --- a/CopyMailto/AppDelegate.m +++ b/CopyMailto/AppDelegate.m @@ -8,6 +8,8 @@ #import "AppDelegate.h" +const NSUInteger MAILTO_INDEX = 7; + @implementation AppDelegate - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { @@ -28,7 +30,7 @@ { NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; - NSLog(@"%@", url); + [_email_address setStringValue:[url substringFromIndex:MAILTO_INDEX]]; } @end diff --git a/CopyMailto/Base.lproj/MainMenu.xib b/CopyMailto/Base.lproj/MainMenu.xib index 27b3521..c6b2415 100644 --- a/CopyMailto/Base.lproj/MainMenu.xib +++ b/CopyMailto/Base.lproj/MainMenu.xib @@ -15,6 +15,7 @@ <customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="Voe-Tx-rLC" customClass="AppDelegate"> <connections> + <outlet property="_email_address" destination="geG-ze-MSR" id="d4k-Jk-Tfb"/> <outlet property="_window" destination="QvC-M9-y7g" id="Hng-bF-TGq"/> </connections> </customObject> @@ -73,6 +74,17 @@ <view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ"> <rect key="frame" x="0.0" y="0.0" width="480" height="360"/> <autoresizingMask key="autoresizingMask"/> + <subviews> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="geG-ze-MSR"> + <rect key="frame" x="25" y="294" width="156" height="46"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Label" id="bWd-ek-Y6D"> + <font key="font" metaFont="system" size="15"/> + <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> </view> </window> </objects> |