SourceForge: timemon/timemon: changeset 186:1774fe56155b
Validate the Edit menu for deletion.
authorFrank <wixardy@ceresalto.ca>
Sat Sep 26 21:45:39 2009 -0400 (8 weeks ago)
changeset 1861774fe56155b
parent 185a6e288e7c6c9
child 1878204198ca120
Validate the Edit menu for deletion.
TMOutline.m
TMTableView.m
     1.1 --- a/TMOutline.m	Fri Sep 25 22:55:27 2009 -0400
     1.2 +++ b/TMOutline.m	Sat Sep 26 21:45:39 2009 -0400
     1.3 @@ -71,4 +71,17 @@
     1.4  	return [super textShouldEndEditing:textObject];
     1.5  }
     1.6  
     1.7 +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem;
     1.8 +{
     1.9 +	if (menuItem.action == @selector(delete:))
    1.10 +		return [self selectedRow] >= 0;
    1.11 +	
    1.12 +	return YES;
    1.13 +}
    1.14 +
    1.15 +- (IBAction)delete:(id)sender
    1.16 +{
    1.17 +	[[NSNotificationCenter defaultCenter] postNotificationName:@"TMDeleteProjectNotification" object:nil];
    1.18 +}
    1.19 +
    1.20  @end
     2.1 --- a/TMTableView.m	Fri Sep 25 22:55:27 2009 -0400
     2.2 +++ b/TMTableView.m	Sat Sep 26 21:45:39 2009 -0400
     2.3 @@ -36,5 +36,17 @@
     2.4  	[super keyDown:theEvent];
     2.5  }
     2.6  
     2.7 +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem;
     2.8 +{
     2.9 +	if (menuItem.action == @selector(delete:))
    2.10 +		return [self selectedRow] >= 0;
    2.11 +	
    2.12 +	return YES;
    2.13 +}
    2.14 +
    2.15 +- (IBAction)delete:(id)sender
    2.16 +{
    2.17 +	[[NSNotificationCenter defaultCenter] postNotificationName:@"TMDeleteEntryNotification" object:nil];
    2.18 +}
    2.19  
    2.20  @end