source: releases/Pester/1.1b6/Source/PSAlert.m@ 517

Last change on this file since 517 was 61, checked in by Nicholas Riley, 22 years ago

Pester 1.1b1.

PSPowerManager: Fixed delegate method selectors to better reflect what
is going on (Apple's docs in IOKit Fundamentals help with this; the
kIOMessage*Sleep constants are really poorly named).

VERSION: Updated for 1.1b1.

PSSpeechAlert.h: Fixed company name.

PSAlert.[hm]: Added -prepareForAlarm: to support PSWakeAlert.

PSTimer.[hm]: Replacement for NSTimer that works properly across
sleep/wake cycles and will schedule wake timers.

PSAlerts.[hm]: Added -prepareForAlarm: to support PSWakeAlert.

Read Me.rtfd: Updated for 1.1b1.

PSAlarm.[hm]: Added -setWakeUp:, invoke -[PSAlerts prepareForAlarm],
replaced alarm timer NSTimer with PSTimer.

PSApplication.[hm]: Replaced dock update timer NSTimer with PSTimer.
Uncovered some issues, need to fix later. Enable alarm discard for
beta release.

PSWakeAlert.[hm]: Shared alert implementation for wakeup. Doesn't do
anything at trigger time, but uses new preparation interface to work
at alarm set time (should work for repeating alarms too, but I didn't
bother to test...)

PSAlarmSetController.m: Added support for PSWakeAlert. Save default
alert information on quit. Removed debug statements on hide/unhide;
it works fine regardless of whether the app is explicitly hidden or
the window hides itself.

PSAlarms.m: PSTimer support - invoke +[PSTimer setUp] to initialize
timer list.

File size: 2.0 KB
Line 
1//
2// PSAlert.m
3// Pester
4//
5// Created by Nicholas Riley on Sat Oct 26 2002.
6// Copyright (c) 2002 Nicholas Riley. All rights reserved.
7//
8
9#import "PSAlert.h"
10#import "NSDictionary-NJRExtensions.h"
11
12NSString * const PSAlertCreationException = @"PSAlertCreationException";
13
14NSString * const PSAlarmAlertCompletedNotification = @"PSAlarmAlertCompletedNotification";
15
16// property list keys
17static NSString * const PLAlertClass = @"class"; // NSString
18
19@implementation PSAlert
20
21+ (PSAlert *)alert;
22{
23 NSAssert(NO, @"Class is abstract");
24 return nil;
25}
26
27- (void)prepareForAlarm:(PSAlarm *)alarm;
28{
29 return;
30}
31
32- (void)triggerForAlarm:(PSAlarm *)alarm;
33{
34 NSAssert(NO, @"Class is abstract");
35}
36
37- (BOOL)requiresPesterFrontmost;
38{
39 return NO;
40}
41
42- (void)completedForAlarm:(PSAlarm *)alarm;
43{
44 [[NSNotificationCenter defaultCenter] postNotificationName: PSAlarmAlertCompletedNotification object: alarm userInfo: [NSDictionary dictionaryWithObject: self forKey: @"alert"]];
45}
46
47- (NSAttributedString *)actionDescription;
48{
49 NSAssert(NO, @"Class is abstract");
50 return nil;
51}
52
53#pragma mark property list serialization (Pester 1.1)
54
55- (NSDictionary *)propertyListRepresentation;
56{
57 return [NSDictionary dictionaryWithObject: NSStringFromClass([self class]) forKey: PLAlertClass];
58}
59
60- (id)initWithPropertyList:(NSDictionary *)dict;
61{
62 if ( (self = [self init]) != nil) {
63 IMP myImp = [self methodForSelector: _cmd];
64 NSString *clsString = [dict objectForRequiredKey: PLAlertClass];
65 Class cls = NSClassFromString(clsString);
66 NSAssert1(cls != nil, @"Alert class %@ is not available", clsString);
67 [super release];
68 self = [cls alloc];
69 if (self != nil) {
70 IMP subImp = [self methodForSelector: @selector(initWithPropertyList:)];
71 NSAssert1(subImp != myImp, @"No implementation of initWithPropertyList: for alert class %@", clsString);
72 self = [self initWithPropertyList: dict];
73 }
74 }
75 return self;
76}
77
78@end
Note: See TracBrowser for help on using the repository browser.