Changeset 364 for trunk/Cocoa/Pester/Source/PSAlarmSetController.m
- Timestamp:
- 11/28/07 01:29:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSAlarmSetController.m
r363 r364 18 18 #import "NJRQTMediaPopUpButton.h" 19 19 #import "NJRSoundManager.h" 20 #import "NJRValidatingField.h" 20 21 #import "NJRVoicePopUpButton.h" 21 22 #import "NSString-NJRExtensions.h" … … 87 88 { 88 89 NSDictionary *plAlerts = [defaults dictionaryForKey: PSAlertsSelected]; 89 PSAlerts *alerts ;90 PSAlerts *alerts = nil; 90 91 if (plAlerts == nil) { 91 92 alerts = [[PSAlerts alloc] initWithPesterVersion1Alerts]; 92 93 } else { 93 NS_DURING94 @try { 94 95 alerts = [[PSAlerts alloc] initWithPropertyList: plAlerts]; 95 NS_HANDLER 96 NSRunAlertPanel(@"Unable to restore alerts", @"Pester could not restore recent alert information for one or more alerts in the Set Alarm window. The default set of alerts will be used instead.\n\n%@", nil, nil, nil, [ localException reason]);96 } @catch (NSException *exception) { 97 NSRunAlertPanel(@"Unable to restore alerts", @"Pester could not restore recent alert information for one or more alerts in the Set Alarm window. The default set of alerts will be used instead.\n\n%@", nil, nil, nil, [exception reason]); 97 98 alerts = [[PSAlerts alloc] initWithPesterVersion1Alerts]; 98 NS_ENDHANDLER99 } 99 100 } 100 101 [self _readAlerts: alerts]; … … 199 200 old = [inAtMatrix cellWithTag: isInterval]; 200 201 NSAssert(new != old, @"in and at buttons should be distinct!"); 202 203 if (sender != nil) { 204 // XXX validation doesn't work properly for date/time, so we just universally cancel editing now 205 if (![[self window] makeFirstResponder: nil] && !isInterval) { 206 // This works fine synchronously only if you're using the keyboard shortcut to switch in/at. Directly activating the button, a delayed invocation is necessary. 207 NSInvocation *i = [NSInvocation invocationWithMethodSignature: 208 [inAtMatrix methodSignatureForSelector: @selector(selectCellWithTag:)]]; 209 int tag = [old tag]; 210 [i setSelector: @selector(selectCellWithTag:)]; 211 [i setTarget: inAtMatrix]; 212 [i setArgument: &tag atIndex: 2]; 213 [NSTimer scheduledTimerWithTimeInterval: 0 invocation: i repeats: NO]; 214 return; 215 } 216 } 217 201 218 [old setKeyEquivalent: [new keyEquivalent]]; 202 219 [old setKeyEquivalentModifierMask: [new keyEquivalentModifierMask]]; … … 211 228 [timeCalendarButton setEnabled: !isInterval]; 212 229 if (sender != nil) 213 214 if (!isInterval) {// need to do this every time the controls are enabled230 [[self window] makeFirstResponder: isInterval ? (NSTextField *)timeInterval : timeOfDay]; 231 if (!isInterval) // need to do this every time the controls are enabled 215 232 [timeOfDay setNextKeyView: timeDate]; 216 }217 233 // NSLog(@"UPDATING FROM inAtChanged"); 218 234 [self update: nil]; … … 337 353 { 338 354 BOOL playSoundSelected = [playSound intValue]; 339 BOOL canRepeat = playSoundSelected ? [sound canRepeat] : NO;340 [sound setEnabled: NO]; //playSoundSelected]; // XXX temporary for 1.1b5355 BOOL canRepeat = playSoundSelected; // ? [sound canRepeat] : NO; // XXX temporary for 1.1b6 356 [sound setEnabled: playSoundSelected]; 341 357 [soundRepetitions setEnabled: canRepeat]; 342 358 [soundVolumeButton setEnabled: canRepeat && [sound hasAudio]]; … … 344 360 [soundRepetitionsLabel setTextColor: canRepeat ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; 345 361 if (playSoundSelected && sender == playSound) { 346 [[self window] makeFirstResponder: sound ];362 [[self window] makeFirstResponder: soundRepetitions]; // sound]; // XXX temporary for 1.1b6 347 363 } 348 364 } … … 437 453 438 454 [alerts removeAlerts]; 439 NS_DURING455 @try { 440 456 // dock bounce alert 441 457 if ([bounceDockIcon state] == NSOnState) … … 467 483 // speech alert 468 484 if ([doSpeak intValue]) 469 [alerts addAlert: [PSSpeechAlert alertWithVoice: [ voice titleOfSelectedItem]]];485 [alerts addAlert: [PSSpeechAlert alertWithVoice: [[voice selectedItem] representedObject]]]; 470 486 // wake alert 471 487 if ([wakeUp intValue]) 472 488 [alerts addAlert: [PSWakeAlert alert]]; 473 489 [[NSUserDefaults standardUserDefaults] setObject: [alerts propertyListRepresentation] forKey: PSAlertsSelected]; 474 NS_HANDLER475 [self setStatus: [localException reason]];476 NS_VALUERETURN(NO, BOOL);477 NS_ENDHANDLER490 } @catch (NSException *exception) { 491 [self setStatus: [exception reason]]; 492 return NO; 493 } 478 494 return YES; 479 495 } … … 540 556 if (control == timeInterval) 541 557 [timeInterval handleDidFailToFormatString: string errorDescription: error label: @"alarm interval"]; 558 else if (control == soundRepetitions) 559 [soundRepetitions handleDidFailToFormatString: string errorDescription: error label: @"alert repetitions"]; 542 560 return NO; 543 561 }
Note:
See TracChangeset
for help on using the changeset viewer.