Ignore:
Timestamp:
02/23/03 04:55:07 (20 years ago)
Author:
Nicholas Riley
Message:

Pester 1.1b3

File:
1 edited

Legend:

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

    r53 r102  
    1111#import "PSAlarm.h"
    1212#import "PSNotifierAlert.h"
     13#import "PSSnoozeUntilController.h"
    1314#import "NJRIntervalField.h"
    1415
     
    2425@implementation PSAlarmNotifierController
    2526
    26 // XXX should use NSNonactivatingPanelMask on 10.2
     27// XXX should use NSNonactivatingPanelMask on 10.2?
    2728
    2829- (id)initWithAlarm:(PSAlarm *)anAlarm;
     
    3435        [messageField setStringValue: [alarm message]];
    3536        [dateField setStringValue: [alarm dateTimeString]];
    36         if (![snoozeIntervalField setInterval: [alarm snoozeInterval]] &&
    37             ![snoozeIntervalField setInterval: [[[NSUserDefaults standardUserDefaults] objectForKey: PSAlarmSnoozeInterval] doubleValue]])
    38             [snoozeIntervalField setInterval: 15 * 60]; // 15 minutes
     37        if (![self setSnoozeInterval: [alarm snoozeInterval]] &&
     38            ![self setSnoozeInterval: [[[NSUserDefaults standardUserDefaults] objectForKey: PSAlarmSnoozeInterval] doubleValue]])
     39            [self setSnoozeInterval: 15 * 60]; // 15 minutes
    3940        if ([alarm isRepeating]) {
    4041            [intervalField setStringValue:
     
    7576- (void)update:(id)sender;
    7677{
    77     canSnooze = [snoozeIntervalField interval] != 0;
     78    snoozeInterval = [snoozeIntervalField interval];
     79    canSnooze = (snoozeInterval > 0);
    7880    if (canSnooze) [nextDateField setStringValue: @"after snooze"];
    7981    [snoozeButton setEnabled: canSnooze];
     
    8991}
    9092
     93- (IBAction)snoozeUntil:(NSMenuItem *)sender;
     94{
     95    [PSSnoozeUntilController snoozeUntilControllerWithNotifierController: self];
     96}
     97
     98- (IBAction)snoozeIntervalUnitsChanged:(NSPopUpButton *)sender;
     99{
     100    if ([[sender selectedItem] tag] > 0) [self update: nil];
     101}
     102
     103- (NSTimeInterval)snoozeInterval;
     104{
     105    return snoozeInterval;
     106}
     107
     108- (BOOL)setSnoozeInterval:(NSTimeInterval)interval;
     109{
     110    snoozeInterval = interval;
     111    return [snoozeIntervalField setInterval: interval];
     112}
     113
    91114- (IBAction)snooze:(NSButton *)sender;
    92115{
    93     NSTimeInterval snoozeInterval = [snoozeIntervalField interval];
     116    snoozeInterval = [snoozeIntervalField interval];
    94117    [alarm setSnoozeInterval: snoozeInterval];
    95118    [[NSUserDefaults standardUserDefaults] setObject: [NSNumber numberWithDouble: snoozeInterval] forKey: PSAlarmSnoozeInterval];
    96119    [self close: sender];
     120}
     121
     122- (void)snoozeUntilDate:(NSCalendarDate *)date;
     123{
     124    [alarm setSnoozeInterval: [date timeIntervalSinceNow]];
     125    [self close: self];
    97126}
    98127
Note: See TracChangeset for help on using the changeset viewer.