From c193919cacda828749f7a25cded79bf0ab870190 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 1 Sep 2009 16:07:46 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixes=20for=20Query=20Favorite=20Manager:?= =?UTF-8?q?=20-=20renamed=20"Save"=20button=20to=20"Apply=20Changes"=20to?= =?UTF-8?q?=20make=20it=20clear=20what=20will=20be=20done=20by=20clicking?= =?UTF-8?q?=20at=20it=20-=20suppress=20context=20menu=20and=20selection=20?= =?UTF-8?q?while=20right-clicking=20at=20a=20header=20-=20while=20in=20cel?= =?UTF-8?q?l=20editing=20ESC=20will=20abort=20the=20editing=20(not=20close?= =?UTF-8?q?=20the=20sheet)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPQueryFavoriteManager.h | 1 + Source/SPQueryFavoriteManager.m | 22 ++++++++++++++++++++-- Source/SPTableView.m | 5 +++++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPQueryFavoriteManager.h b/Source/SPQueryFavoriteManager.h index 820f2a1a..28a625d5 100644 --- a/Source/SPQueryFavoriteManager.h +++ b/Source/SPQueryFavoriteManager.h @@ -59,6 +59,7 @@ enum sp_favorite_types NSMutableString *pendingQueryString; NSUInteger selectedRowBeforeChangingSelection; + BOOL isTableCellEditing; } - (id)initWithDelegate:(id)managerDelegate; diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index e49dbb13..5ad6644d 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -303,6 +303,13 @@ - (IBAction)closeQueryManagerSheet:(id)sender { + // First check for ESC if pressed while inline editing + if(![sender tag] && isTableCellEditing) { + [favoritesTableView abortEditing]; + isTableCellEditing = NO; + return; + } + [NSApp endSheet:[self window] returnCode:0]; [[self window] orderOut:self]; @@ -485,7 +492,12 @@ */ - (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - return ([[favoriteProperties objectAtIndex:rowIndex] intValue] == SP_FAVORITETYPE_HEADER) ? NO : YES; + if([[favoriteProperties objectAtIndex:rowIndex] intValue] == SP_FAVORITETYPE_HEADER) { + return NO; + } else { + isTableCellEditing = YES; + return YES; + } } /* @@ -495,7 +507,13 @@ { return ([[favoriteProperties objectAtIndex:rowIndex] intValue] == SP_FAVORITETYPE_HEADER) ? YES : NO; } - +/* + * Detect if inline editing was done - then ESC to close the sheet will be activate + */ +- (void)controlTextDidEndEditing:(NSNotification *)aNotification +{ + isTableCellEditing = NO; +} /* * Changes in the name text field will be saved in data source directly * to update the table view accordingly diff --git a/Source/SPTableView.m b/Source/SPTableView.m index 38cd949e..801a528b 100644 --- a/Source/SPTableView.m +++ b/Source/SPTableView.m @@ -23,6 +23,7 @@ // More info at #import "SPTableView.h" +#import "SPQueryFavoriteManager.h" #import "SPArrayAdditions.h" @implementation SPTableView @@ -46,6 +47,10 @@ if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"tableTypes"], row) intValue] == -1) return nil; } + if([[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]) { + if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"favoriteProperties"], row) intValue] == SP_FAVORITETYPE_HEADER) + return nil; + } [self selectRow:row byExtendingSelection:NO]; [[self window] makeFirstResponder:self]; -- cgit v1.2.3