Changeset 53 for trunk/Cocoa/Pester/Source/PSApplication.m
- Timestamp:
- 01/02/03 05:30:03 (21 years ago)
- Location:
- trunk/Cocoa/Pester/Source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source
- Property svn:ignore
-
old new 1 1 build 2 .gdb_history
-
- Property svn:ignore
-
trunk/Cocoa/Pester/Source/PSApplication.m
r34 r53 21 21 [[NSNotificationCenter defaultCenter] addObserver: [PSAlarmAlertController class] selector: @selector(controllerWithTimerExpiredNotification:) name: PSAlarmTimerExpiredNotification object: nil]; 22 22 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(nextAlarmDidChange:) name: PSAlarmsNextAlarmDidChangeNotification object: nil]; 23 // XXX exception handling 23 24 [PSAlarms setUp]; 24 25 [self setDelegate: self]; … … 71 72 { 72 73 PSAlarm *alarm = [timer userInfo]; 73 NSTimeInterval alarmInterval;74 NSTimeInterval timeRemaining; 74 75 NSString *tileString; 75 76 if (timer == nil) alarm = [[PSAlarms allAlarms] nextAlarm]; 76 77 if (alarm == nil) return; 77 78 tileString = [alarm timeRemainingString]; 79 timeRemaining = [alarm timeRemaining]; // want to err on the side of timeRemaining being smaller, otherwise ÇexpiredÈ can appear 78 80 { 79 81 NSMutableDictionary *atts = [NSMutableDictionary dictionary]; … … 117 119 [tile release]; 118 120 } 119 alarmInterval = [alarm interval]; 120 // NSLog(@"_updateDockTile > time remaining %@ (%.0lf), last time interval %.0lf", tileString, alarmInterval, dockUpdateInterval); 121 if (alarmInterval > 61) { 122 NSTimeInterval nextUpdate = ((unsigned long long)alarmInterval) % 60; 121 // NSLog(@"_updateDockTile > time remaining %@ (%.6lf), last time interval %.6lf", tileString, timeRemaining, dockUpdateInterval); 122 if (timeRemaining > 61) { 123 NSTimeInterval nextUpdate = ((unsigned long long)timeRemaining) % 60; 123 124 if (nextUpdate <= 1) nextUpdate = 60; 124 125 [self _resetUpdateTimer]; … … 126 127 // NSLog(@"_updateDockTile > set timer for %.0lf seconds", nextUpdate); 127 128 } else if (timer == nil || dockUpdateInterval > 1) { 128 [self _resetUpdateTimer]; 129 [self _resetUpdateTimer]; 129 130 [self _setUpdateTimerForInterval: 1 alarm: alarm repeats: YES]; 130 131 // NSLog(@"_updateDockTile > set timer for 1 second"); 131 } else if ( alarmInterval < 2) {132 } else if (timeRemaining <= 1) { 132 133 [self _resetUpdateTimer]; 133 134 } … … 182 183 @implementation PSApplication (NSApplicationNotifications) 183 184 185 - (void)applicationDidFinishLaunching:(NSNotification *)notification; 186 { 187 // XXX import panel will not be frontmost window if you switch to another app while Pester is launching; Mac OS X bug? 188 PSAlarms *allAlarms = [PSAlarms allAlarms]; 189 unsigned version1AlarmCount = [allAlarms countOfVersion1Alarms]; 190 if (version1AlarmCount > 0) { 191 int answer = NSRunAlertPanel(@"Import alarms from older Pester version?", @"Pester found %u alarm%@ created with an older version. These alarms must be converted for use with this version of Pester, and will be unavailable in previous versions after conversion. New alarms created with this version of Pester will not appear in Pester version 1.1a3 or earlier.", 192 @"Import", @"Discard", @"DonÕt Import", 193 version1AlarmCount, version1AlarmCount == 1 ? @"" : @"s"); 194 switch (answer) { 195 case NSAlertDefaultReturn: 196 NS_DURING 197 [allAlarms importVersion1Alarms]; 198 NS_HANDLER 199 NSRunAlertPanel(@"Error occurred importing alarms", @"Pester was unable to convert some alarms created with an older version. Those alarms which could be read have been converted. The previous-format alarms have been retained; try using an older version of Pester to read them.\n\n%@", nil, nil, nil, [localException reason]); 200 NS_VOIDRETURN; 201 NS_ENDHANDLER 202 case NSAlertAlternateReturn: 203 NSLog(@"discard"); 204 // [allAlarms discardVersion1Alarms]; 205 break; 206 case NSAlertOtherReturn: 207 NSLog(@"donÕt import"); 208 break; 209 } 210 } 211 } 212 184 213 - (void)applicationWillTerminate:(NSNotification *)notification; 185 214 {
Note:
See TracChangeset
for help on using the changeset viewer.