Ignore:
Timestamp:
03/10/03 05:48:21 (21 years ago)
Author:
Nicholas Riley
Message:

PSTimer.m: Fix bug 15, leaking PSTimer from NSInvocation argument retention.

Read Me.rtfd: Updated release notes.

PSAlarm.[hm]: Removed obsolete comment. Changed 1m-59m times to
display without `0h'. Moved code from deserialization to -resetTimer
to be used for alarm deletion undo - fix bug 14.

PSAlarmsController.m: Fix bug 14 - implement _restoreAlarms:,
_removeAlarms and _undoManager. Need to add localized string.

PSAlarmAlertController.m: Fix bug 17, move alert triggering from
constructor to -performAlertsForAlarm: to avoid nested notifications
delivering in wrong order.

PSAlarms.[hm]: Fix bug 14 - implement -restoreAlarms, invokes [PSAlarm
resetTimer]. Clarified a comment. Uncommented some debug logging.

package-Pester.sh: Implemented partition map-less disk image, saves a
few K on distribution. Removed obsolete comments. Added agvtool
bump.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSAlarm.m

    r105 r113  
    3232static NSDictionary *locale;
    3333
    34 // XXX need to reset pending alarms after sleep, they "freeze" and never expire.
    35 
    3634@implementation PSAlarm
    3735
     
    137135    if (interval == 0) return nil;
    138136    if (interval < minute) return [NSString stringWithFormat: @"%us", (unsigned)interval];
     137    if (interval < hour) return [NSString stringWithFormat: @"%um", (unsigned)(interval / minute)];
    139138    if (interval < day) return [NSString stringWithFormat: @"%uh %um", (unsigned)(interval / hour), (unsigned)((interval % hour) / minute)];
    140139    if (interval < 2 * day) return @"One day";
     
    399398{
    400399    [timer invalidate]; [timer release]; timer = nil;
    401     [self setRepeating: NO];
     400}
     401
     402- (void)resetTimer;
     403{
     404    if (timer != nil || alarmType != PSAlarmSet)
     405        return;
     406
     407    alarmType = PSAlarmDate;
     408    if (![self isRepeating]) {
     409        [self setTimer];
     410    } else {
     411        // don't want to put this logic in setTimer or isValid because it can cause invalid alarms to be set (consider when someone clicks the "repeat" checkbox, then switches to a [nonrepeating, by design] date alarm, and enters a date that has passed: we do -not- want the alarm to magically morph into a repeating interval alarm)
     412        NSTimeInterval savedInterval = alarmInterval;
     413        if (![self setTimer]) {
     414            alarmType = PSAlarmInterval;
     415            [self setInterval: savedInterval];
     416            [self setTimer];
     417        }
     418    }
    402419}
    403420
     
    489506        [self setAlerts: alarmAlerts];
    490507        [alarmAlerts release];
    491         if (alarmType == PSAlarmSet) {
    492             alarmType = PSAlarmDate;
    493             // don't want to put this logic in setTimer or isValid because it can cause invalid alarms to be set (consider when someone clicks the "repeat" checkbox, then switches to a [nonrepeating, by design] date alarm, and enters a date that has passed: we do -not- want the alarm to magically morph into a repeating interval alarm)
    494             if (![self setTimer] && [self isRepeating]) {
    495                 alarmType = PSAlarmInterval;
    496                 [self setInterval: [[dict objectForRequiredKey: PLAlarmInterval] doubleValue]];
    497                 [self setTimer];
    498             }
    499         }
     508        [self resetTimer];
    500509        if (alarmType == PSAlarmExpired) {
    501510            [self setTimer];
Note: See TracChangeset for help on using the changeset viewer.