diff options
author | Teddy Wing | 2018-09-06 00:10:03 +0200 |
---|---|---|
committer | Teddy Wing | 2018-09-06 00:10:03 +0200 |
commit | d35983a3ace2d869aa478d107f475ca835b66e50 (patch) | |
tree | 810aae10eb11011af94a03f191776d6bbbb14702 /CopyMailto | |
parent | 4e2eea2beb2705e028226fe0300d17a7e223ec3c (diff) | |
download | Copy-Mailto-d35983a3ace2d869aa478d107f475ca835b66e50.tar.bz2 |
Rename the project directory "CopyMailto" -> "Copy Mailto"
Diffstat (limited to 'CopyMailto')
-rw-r--r-- | CopyMailto/AppDelegate.h | 20 | ||||
-rw-r--r-- | CopyMailto/AppDelegate.m | 42 | ||||
-rw-r--r-- | CopyMailto/Assets.xcassets/AppIcon.appiconset/Contents.json | 58 | ||||
-rw-r--r-- | CopyMailto/Base.lproj/MainMenu.xib | 125 | ||||
-rw-r--r-- | CopyMailto/CopyMailto.entitlements | 5 | ||||
-rw-r--r-- | CopyMailto/DefaultURLHandler.h | 15 | ||||
-rw-r--r-- | CopyMailto/DefaultURLHandler.m | 24 | ||||
-rw-r--r-- | CopyMailto/Info.plist | 43 | ||||
-rw-r--r-- | CopyMailto/QuitButton.h | 16 | ||||
-rw-r--r-- | CopyMailto/QuitButton.m | 22 | ||||
-rw-r--r-- | CopyMailto/main.m | 19 |
11 files changed, 0 insertions, 389 deletions
diff --git a/CopyMailto/AppDelegate.h b/CopyMailto/AppDelegate.h deleted file mode 100644 index 7ba86b3..0000000 --- a/CopyMailto/AppDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// AppDelegate.h -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -@interface AppDelegate : NSObject <NSApplicationDelegate> { - IBOutlet NSWindow *_window; - IBOutlet NSTextField *_email_address; -} - -- (void)handleURLEvent:(NSAppleEventDescriptor *)event - withReplyEvent: (NSAppleEventDescriptor *)replyEvent; -- (IBAction)copyEmailToClipboard:(id)sender; - -@end diff --git a/CopyMailto/AppDelegate.m b/CopyMailto/AppDelegate.m deleted file mode 100644 index 752b716..0000000 --- a/CopyMailto/AppDelegate.m +++ /dev/null @@ -1,42 +0,0 @@ -// -// AppDelegate.m -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import "AppDelegate.h" - -const NSUInteger MAILTO_INDEX = 7; - -@implementation AppDelegate - -- (void)applicationWillFinishLaunching:(NSNotification *)aNotification { - [[NSAppleEventManager sharedAppleEventManager] - setEventHandler:self - andSelector:@selector(handleURLEvent:withReplyEvent:) - forEventClass:kInternetEventClass - andEventID:kAEGetURL]; -} - -- (void)handleURLEvent:(NSAppleEventDescriptor *)event - withReplyEvent: (NSAppleEventDescriptor *)replyEvent -{ - NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] - stringValue]; - [_email_address setStringValue:[url substringFromIndex:MAILTO_INDEX]]; -} - -- (IBAction)copyEmailToClipboard:(id)sender -{ - NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; - [pasteboard clearContents]; - [pasteboard writeObjects: - [NSArray arrayWithObject: - [_email_address stringValue]]]; - - [NSApp terminate:self]; -} - -@end diff --git a/CopyMailto/Assets.xcassets/AppIcon.appiconset/Contents.json b/CopyMailto/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 2db2b1c..0000000 --- a/CopyMailto/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/CopyMailto/Base.lproj/MainMenu.xib b/CopyMailto/Base.lproj/MainMenu.xib deleted file mode 100644 index 263596f..0000000 --- a/CopyMailto/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct"> - <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <objects> - <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> - <connections> - <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/> - </connections> - </customObject> - <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> - <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> - <customObject id="YLy-65-1bz" customClass="NSFontManager"/> - <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6"> - <items> - <menuItem title="Copy Mailto" id="1Xt-HY-uBw"> - <modifierMask key="keyEquivalentModifierMask"/> - <menu key="submenu" title="Copy Mailto" systemMenu="apple" id="uQy-DD-JDr"> - <items> - <menuItem title="About Copy Mailto" id="5kV-Vb-QxS"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/> - </connections> - </menuItem> - <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/> - <menuItem title="Services" id="NMo-om-nkz"> - <modifierMask key="keyEquivalentModifierMask"/> - <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/> - </menuItem> - <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/> - <menuItem title="Hide Copy Mailto" keyEquivalent="h" id="Olw-nP-bQN"> - <connections> - <action selector="hide:" target="-1" id="PnN-Uc-m68"/> - </connections> - </menuItem> - <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO"> - <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> - <connections> - <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/> - </connections> - </menuItem> - <menuItem title="Show All" id="Kd2-mp-pUS"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/> - </connections> - </menuItem> - <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/> - <menuItem title="Quit Copy Mailto" keyEquivalent="q" id="4sb-4s-VLi"> - <connections> - <action selector="terminate:" target="-1" id="Te7-pn-YzF"/> - </connections> - </menuItem> - </items> - </menu> - </menuItem> - </items> - </menu> - <window title="Copy Mailto" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="QvC-M9-y7g"> - <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> - <windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/> - <rect key="contentRect" x="601" y="496" width="480" height="121"/> - <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> - <view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ"> - <rect key="frame" x="0.0" y="0.0" width="480" height="121"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" id="geG-ze-MSR"> - <rect key="frame" x="18" y="57" width="444" height="19"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Email address" 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> - <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" id="ifM-I2-w4c"> - <rect key="frame" x="18" y="84" width="221" height="17"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Copy email address to clipboard?" id="fXp-NT-DzM"> - <font key="font" metaFont="systemBold"/> - <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <button verticalHuggingPriority="750" misplaced="YES" id="kh0-Tv-Cj9"> - <rect key="frame" x="394" y="13" width="72" height="32"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="push" title="Copy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ujL-03-vyZ"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> - <string key="keyEquivalent" base64-UTF8="YES"> -DQ -</string> - </buttonCell> - <connections> - <action selector="copyEmailToClipboard:" target="Voe-Tx-rLC" id="uX1-7A-IwJ"/> - </connections> - </button> - <button verticalHuggingPriority="750" misplaced="YES" id="dF9-KQ-ymU" customClass="QuitButton"> - <rect key="frame" x="328" y="13" width="66" height="32"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="push" title="Quit" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="aJz-qw-lxS"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> - </buttonCell> - <connections> - <action selector="terminate:" target="-2" id="ChX-uc-Yql"/> - </connections> - </button> - </subviews> - </view> - <point key="canvasLocation" x="132" y="42.5"/> - </window> - </objects> -</document> diff --git a/CopyMailto/CopyMailto.entitlements b/CopyMailto/CopyMailto.entitlements deleted file mode 100644 index 0c67376..0000000 --- a/CopyMailto/CopyMailto.entitlements +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict/> -</plist> diff --git a/CopyMailto/DefaultURLHandler.h b/CopyMailto/DefaultURLHandler.h deleted file mode 100644 index dc09ffc..0000000 --- a/CopyMailto/DefaultURLHandler.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// DefaultURLHandler.h -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import <Foundation/Foundation.h> - -@interface DefaultURLHandler : NSObject - -+ (OSStatus)setDefaultURLHandler; - -@end diff --git a/CopyMailto/DefaultURLHandler.m b/CopyMailto/DefaultURLHandler.m deleted file mode 100644 index 424a0ee..0000000 --- a/CopyMailto/DefaultURLHandler.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// DefaultURLHandler.m -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import "DefaultURLHandler.h" - -@implementation DefaultURLHandler - -+ (OSStatus)setDefaultURLHandler { - CFStringRef scheme = (CFStringRef)@"mailto"; - CFStringRef bundle_identifier = (__bridge CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; - - OSStatus status = LSSetDefaultHandlerForURLScheme(scheme, bundle_identifier); - - CFRelease(scheme); - - return status; -} - -@end diff --git a/CopyMailto/Info.plist b/CopyMailto/Info.plist deleted file mode 100644 index 9e3f4b1..0000000 --- a/CopyMailto/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>$(DEVELOPMENT_LANGUAGE)</string> - <key>CFBundleExecutable</key> - <string>$(EXECUTABLE_NAME)</string> - <key>CFBundleIconFile</key> - <string></string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>$(PRODUCT_NAME)</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleVersion</key> - <string>1</string> - <key>LSMinimumSystemVersion</key> - <string>$(MACOSX_DEPLOYMENT_TARGET)</string> - <key>NSHumanReadableCopyright</key> - <string>Copyright © 2018 tw. All rights reserved.</string> - <key>NSMainNibFile</key> - <string>MainMenu</string> - <key>NSPrincipalClass</key> - <string>NSApplication</string> - <key>CFBundleURLTypes</key> - <array> - <dict> - <key>CFBundleURLName</key> - <string>com.teddywing.CopyMailto</string> - <key>CFBundleURLSchemes</key> - <array> - <string>mailto</string> - </array> - </dict> - </array> -</dict> -</plist> diff --git a/CopyMailto/QuitButton.h b/CopyMailto/QuitButton.h deleted file mode 100644 index 73c2e9d..0000000 --- a/CopyMailto/QuitButton.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// QuitButton.h -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import <Cocoa/Cocoa.h> -#import <Carbon/Carbon.h> - -@interface QuitButton : NSButton - -- (void)keyDown:(NSEvent *)theEvent; - -@end diff --git a/CopyMailto/QuitButton.m b/CopyMailto/QuitButton.m deleted file mode 100644 index 8b8bb52..0000000 --- a/CopyMailto/QuitButton.m +++ /dev/null @@ -1,22 +0,0 @@ -// -// QuitButton.m -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import "QuitButton.h" - -@implementation QuitButton - -// Quit the application on "q" or "Escape" -- (void)keyDown:(NSEvent *)theEvent -{ - if ([[theEvent characters] isEqualToString:@"q"] || - [theEvent keyCode] == kVK_Escape) { - [NSApp terminate:self]; - } -} - -@end diff --git a/CopyMailto/main.m b/CopyMailto/main.m deleted file mode 100644 index e61f04e..0000000 --- a/CopyMailto/main.m +++ /dev/null @@ -1,19 +0,0 @@ -// -// main.m -// CopyMailto -// -// Created by tw on 9/5/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -#import "DefaultURLHandler.h" - -int main(int argc, const char * argv[]) { - if (argc == 2 && strcmp(argv[1], "--set-url-handler") == 0) { - return [DefaultURLHandler setDefaultURLHandler]; - } - - return NSApplicationMain(argc, argv); -} |