diff options
| author | ShadowLightz | 2014-06-14 14:08:03 +0200 |
|---|---|---|
| committer | ShadowLightz | 2014-06-14 14:08:03 +0200 |
| commit | 7d3604820ec26cdc2a4d72f96ecda7eb65f78f12 (patch) | |
| tree | 94991edee74e14ccffc7866f178400a952b4ce87 /MASShortcutView.m | |
| parent | ea5a30fe6d52fdc77c907ca044367008a5b5a7e5 (diff) | |
| download | MASShortcut-7d3604820ec26cdc2a4d72f96ecda7eb65f78f12.tar.bz2 | |
Replace depr. NSRunCriticalAlertPanel with NSAlert
- Now using modern API
- The dialog is now shown as a modal sheet, which suits better
- The alert style is changed to NSWarningAlertStyle,
- NSCriticalAlertStyle was not required
Diffstat (limited to 'MASShortcutView.m')
| -rw-r--r-- | MASShortcutView.m | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/MASShortcutView.m b/MASShortcutView.m index 9f1b7f4..82f4b4b 100644 --- a/MASShortcutView.m +++ b/MASShortcutView.m @@ -380,12 +380,17 @@ void *kUserDataHint = &kUserDataHint; [weakSelf activateEventMonitoring:NO]; NSString *format = NSLocalizedString(@"The key combination %@ cannot be used", @"Title for alert when shortcut is already used"); - NSRunCriticalAlertPanel([NSString stringWithFormat:format, shortcut], @"%@", - NSLocalizedString(@"OK", @"Alert button when shortcut is already used"), - nil, nil, error.localizedDescription); - weakSelf.shortcutPlaceholder = nil; - [weakSelf activateResignObserver:YES]; - [weakSelf activateEventMonitoring:YES]; + NSAlert* alert = [[NSAlert alloc]init]; + alert.messageText = [NSString stringWithFormat:format, shortcut]; + alert.informativeText = error.localizedDescription; + alert.alertStyle = NSWarningAlertStyle; + weakSelf.recording = NO; + [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { + weakSelf.shortcutPlaceholder = nil; + [weakSelf activateResignObserver:YES]; + [weakSelf activateEventMonitoring:YES]; + weakSelf.recording = YES; + }]; } else { weakSelf.shortcutValue = shortcut; |
