diff options
| -rw-r--r-- | MASShortcut+UserDefaults.m | 9 | ||||
| -rw-r--r-- | MASShortcut.m | 11 | ||||
| -rw-r--r-- | MASShortcutView+UserDefaults.m | 5 | ||||
| -rw-r--r-- | MASShortcutView.m | 9 |
4 files changed, 31 insertions, 3 deletions
diff --git a/MASShortcut+UserDefaults.m b/MASShortcut+UserDefaults.m index af3b5af..28fd633 100644 --- a/MASShortcut+UserDefaults.m +++ b/MASShortcut+UserDefaults.m @@ -3,7 +3,7 @@ @interface MASShortcutHotKey : NSObject @property (nonatomic, readonly) NSString *userDefaultsKey; -@property (nonatomic, readonly) void (^handler)(); +@property (nonatomic, readonly, copy) void (^handler)(); @property (nonatomic, readonly) EventHotKeyRef carbonHotKey; @property (nonatomic, readonly) UInt32 carbonHotKeyID; @@ -48,6 +48,13 @@ @implementation MASShortcutHotKey +@synthesize carbonHotKeyID = _carbonHotKeyID; +@synthesize handler = _handler; +@synthesize userDefaultsKey = _userDefaultsKey; +@synthesize carbonHotKey = _carbonHotKey; + +#pragma mark - + - (id)initWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler { self = [super init]; diff --git a/MASShortcut.m b/MASShortcut.m index 4835920..5915d5d 100644 --- a/MASShortcut.m +++ b/MASShortcut.m @@ -8,6 +8,11 @@ NSString *const kMASShortcutModifierFlags = @"ModifierFlags"; NSUInteger _modifierFlags; // 0 if empty } +@synthesize modifierFlags = _modifierFlags; +@synthesize keyCode = _keyCode; + +#pragma mark - + - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeInteger:(self.keyCode != NSNotFound ? (NSInteger)self.keyCode : - 1) forKey:kMASShortcutKeyCode]; @@ -223,7 +228,8 @@ NSString *const kMASShortcutModifierFlags = @"ModifierFlags"; if (outError) { NSString *format = NSLocalizedString(@"This shortcut cannot be used used because it is already used by the menu item ‘%@’.", @"Message for alert when shortcut is already used"); - NSDictionary *info = @{ NSLocalizedDescriptionKey : [NSString stringWithFormat:format, menuItem.title] }; + NSDictionary *info = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:format, menuItem.title] + forKey:NSLocalizedDescriptionKey]; *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:info]; } return YES; @@ -251,7 +257,8 @@ NSString *const kMASShortcutModifierFlags = @"ModifierFlags"; @"keyboard shortcut.\nIf you really want to use this key combination, most shortcuts " @"can be changed in the Keyboard & Mouse panel in System Preferences.", @"Message for alert when shortcut is already used by the system"); - *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:@{ NSLocalizedDescriptionKey : description }]; + NSDictionary *info = [NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey]; + *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:info]; } return YES; } diff --git a/MASShortcutView+UserDefaults.m b/MASShortcutView+UserDefaults.m index 133453e..1b1b8e5 100644 --- a/MASShortcutView+UserDefaults.m +++ b/MASShortcutView+UserDefaults.m @@ -39,6 +39,11 @@ void *kDefaultsObserver = &kDefaultsObserver; BOOL _internalShortcutChange; } +@synthesize userDefaultsKey = _userDefaultsKey; +@synthesize shortcutView = _shortcutView; + +#pragma mark - + - (id)initWithShortcutView:(MASShortcutView *)shortcutView userDefaultsKey:(NSString *)userDefaultsKey { self = [super init]; diff --git a/MASShortcutView.m b/MASShortcutView.m index 00bea5b..3d88783 100644 --- a/MASShortcutView.m +++ b/MASShortcutView.m @@ -27,6 +27,15 @@ NSTrackingArea *_hintArea; } +@synthesize enabled = _enabled; +@synthesize hinting = _hinting; +@synthesize shortcutValue = _shortcutValue; +@synthesize shortcutPlaceholder = _shortcutPlaceholder; +@synthesize shortcutValueChange = _shortcutValueChange; +@synthesize recording = _recording; + +#pragma mark - + - (id)initWithFrame:(CGRect)frameRect { self = [super initWithFrame:frameRect]; |
