From 47b27a6d2b5d3cd7fa7152d2679283e7fba3e82d Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 25 Aug 2010 15:35:33 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20tooltip=20about=20non-editable=20wh?= =?UTF-8?q?ile=20keyboard=20navigation=20and=20trying=20to=20modify=20a=20?= =?UTF-8?q?cell=20=E2=80=A2=20in=20Custom=20Query=20table=20after=20field?= =?UTF-8?q?=20editor=20sheet=20dismissing=20preserve=20the=20the=20edited?= =?UTF-8?q?=20field=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCustomQuery.m | 3 +++ Source/SPTableContent.m | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 435cb016..82b40465 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -3499,6 +3499,9 @@ // Call the field editor sheet [self tableView:customQueryView shouldEditTableColumn:NSArrayObjectAtIndex([customQueryView tableColumns], column) row:row]; + // Reset the field editor + [customQueryView editColumn:column row:row withEvent:nil select:YES]; + return NO; } diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 777eaf7f..86a960e5 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -235,7 +235,10 @@ } // Update display if necessary - [[tableContentView onMainThread] setNeedsDisplay:YES]; + if (!NSEqualRects(selectionViewportToRestore, NSZeroRect)) + [[tableContentView onMainThread] setNeedsDisplayInRect:selectionViewportToRestore]; + else + [[tableContentView onMainThread] setNeedsDisplay:YES]; // Post the notification that the query is finished [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; @@ -3734,10 +3737,35 @@ row = [tableContentView editedRow]; column = [tableContentView editedColumn]; + NSInteger numberOfPossibleUpdateRows = [self fieldEditStatusForRow:row andColumn:[NSArrayObjectAtIndex([tableContentView tableColumns], column) identifier]]; + if([tableContentView isCellEditingMode] && numberOfPossibleUpdateRows != 1) { + NSPoint pos = [[tableDocumentInstance parentWindow] convertBaseToScreen:[tableContentView convertPoint:[tableContentView frameOfCellAtColumn:column row:row].origin toView:nil]]; + pos.y -= 20; + switch(numberOfPossibleUpdateRows) { + case -1: + [SPTooltip showWithObject:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database") + atLocation:pos + ofType:@"text"]; + break; + case 0: + [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. No matching record found.\nReload table or try to add a primary key field or more fields\nin the view declaration of '%@' to identify\nfield origin unambiguously.", @"Table Content result editing error - could not identify original row"), selectedTable] + atLocation:pos + ofType:@"text"]; + break; + + case 1: + break; + + default: + [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. Couldn't identify field origin unambiguously (%ld match%@).", @"Table Content result editing error - could not match row being edited uniquely"), (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""] + atLocation:pos + ofType:@"text"]; + } - if([tableContentView isCellEditingMode] && [self fieldEditStatusForRow:row andColumn:[NSArrayObjectAtIndex([tableContentView tableColumns], column) identifier]] != 1) return NO; + } + NSString *fieldType; // Check if current edited field is a blob -- cgit v1.2.3