Ignore:
Timestamp:
03/02/10 08:04:08 (15 years ago)
Author:
Nicholas Riley
Message:

Fix up date completion with field editor.

Still to do:

  • autocomplete still doesn't trigger in some cases when it should
  • move things into PSTimeDateEditor so they're usable in "until..."
File:
1 edited

Legend:

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

    r621 r622  
    2525
    2626#import "PSAlerts.h"
     27#import "PSDateFieldEditor.h"
    2728#import "PSDockBounceAlert.h"
    2829#import "PSScriptAlert.h"
     
    113114    [voice setDelegate: self]; // XXX why don't we do this in IB?  It should use the accessor...
    114115    [wakeUp setEnabled: [PSPowerManager autoWakeSupported]];
     116   
     117    dateFieldEditor = [[PSDateFieldEditor alloc] init];
     118    [dateFieldEditor setFieldEditor: YES];
     119    [dateFieldEditor setDelegate: timeDate];
    115120   
    116121    // XXX workaround for 10.1.x and 10.2.x bug which sets the first responder to the wrong field alternately, but it works if I set the initial first responder to nil... go figure.
     
    605610        [completions removeObjectAtIndex: i];
    606611    }
    607     NSLog(@"%@ %d %@", partialMatch, partialLength, completions);
    608612    return [completions autorelease];
    609613}
    610614
    611615@end
     616
     617@implementation PSAlarmSetController (NSWindowDelegate)
     618
     619- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client;
     620{
     621    if (client == timeDate)
     622        return dateFieldEditor;
     623
     624    return nil;
     625}
     626
     627@end
     628
    612629
    613630@implementation PSAlarmSetController (NSWindowNotifications)
     
    629646- (void)controlTextDidEndEditing:(NSNotification *)notification;
    630647{
    631     NSControl *control = [notification object];
    632 
    633     if (control != timeOfDay)
     648    if ([notification object] != timeOfDay)
    634649        return;
    635650   
     
    683698}
    684699
    685 // XXX need to override NSTextView; when completing with space or tab, we don't get a selector, which causes usability problems with tab and bugs with space
    686700- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
    687701{
Note: See TracChangeset for help on using the changeset viewer.