Using (class) properties

This commit is contained in:
Michael Starke
2018-09-25 11:16:33 +02:00
parent bfe08b5510
commit 009d198421
2 changed files with 9 additions and 8 deletions

View File

@@ -42,10 +42,10 @@
- (void)registerNotificationsForDocument:(MPDocument *)document { - (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self [NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(_didAddGroup:) selector:@selector(_didAddGroup:)
name:MPDocumentDidAddGroupNotification name:MPDocumentDidAddGroupNotification
object:document]; object:document];
} }
- (void)viewDidAppear { - (void)viewDidAppear {
@@ -129,8 +129,8 @@
options:nil]; options:nil];
} }
- (IBAction)toggleExpire:(NSButton*)sender { - (IBAction)toggleExpire:(NSButton*)sender {
KPKGroup *group = [self representedObject]; KPKGroup *group = self.representedObject;
if([sender state] == NSOnState && [group.timeInfo.expirationDate isEqualToDate:[NSDate distantFuture]]) { if(sender.state == NSOnState && [group.timeInfo.expirationDate isEqualToDate:NSDate.distantFuture]) {
[NSApp sendAction:self.expireDateSelectButton.action to:nil from:self.expireDateSelectButton]; [NSApp sendAction:self.expireDateSelectButton.action to:nil from:self.expireDateSelectButton];
} }
} }
@@ -139,7 +139,8 @@
- (void)_didAddGroup:(NSNotification *)notification { - (void)_didAddGroup:(NSNotification *)notification {
if(!self.titleTextField.window) { if(!self.titleTextField.window) {
self.focusTitleOnceViewAppears = true; self.focusTitleOnceViewAppears = true;
} else { }
else {
[self.titleTextField becomeFirstResponder]; [self.titleTextField becomeFirstResponder];
} }
} }

View File

@@ -53,7 +53,7 @@
} }
- (void)awakeFromNib { - (void)awakeFromNib {
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController]; NSUserDefaultsController *defaultsController = NSUserDefaultsController.sharedUserDefaultsController;
NSString *enableGlobalAutotypeKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableGlobalAutotype]; NSString *enableGlobalAutotypeKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableGlobalAutotype];
NSString *quicklookKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableQuicklookPreview]; NSString *quicklookKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableQuicklookPreview];
[self.enableGlobalAutotypeCheckBox bind:NSValueBinding toObject:defaultsController withKeyPath:enableGlobalAutotypeKeyPath options:nil]; [self.enableGlobalAutotypeCheckBox bind:NSValueBinding toObject:defaultsController withKeyPath:enableGlobalAutotypeKeyPath options:nil];