aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-03-11 02:10:25 +0000
committerrowanbeentje <rowan@beent.je>2009-03-11 02:10:25 +0000
commite8d8d6cc38cc92b7201806ed42db50a4c4b324ea (patch)
tree9446cf7d2cc8feb724ff52dc7b6c1e8d594b3917 /Source/TableContent.m
parentfdc31ea623c0c212e34bcf7d11c20b429e76ddf1 (diff)
downloadsequelpro-e8d8d6cc38cc92b7201806ed42db50a4c4b324ea.tar.gz
sequelpro-e8d8d6cc38cc92b7201806ed42db50a4c4b324ea.tar.bz2
sequelpro-e8d8d6cc38cc92b7201806ed42db50a4c4b324ea.zip
- Increment trunk version number to 0.9.4
- Improves on r370 and r375 by preventing actions triggered by the save from triggering saves themselves - Improves further on r370 and r375 by committing any current edits before saving - Additional comments
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 156ce5c8..3443a73f 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1323,14 +1323,22 @@
- (BOOL)saveRowOnDeselect
{
- // If no rows are currently being edited, return success at once.
- if (!isEditingRow) return YES;
+ // If no rows are currently being edited, or a save is in progress, return success at once.
+ if (!isEditingRow || isSavingRow) return YES;
+ isSavingRow = YES;
+
+ // Save any edits which have been made but not saved to the table yet.
+ [tableWindow endEditingFor:nil];
// Attempt to save the row, and return YES if the save succeeded.
- if ([self addRowToDB]) return YES;
+ if ([self addRowToDB]) {
+ isSavingRow = NO;
+ return YES;
+ }
// Saving failed - reselect the old row and return failure.
[tableContentView selectRow:currentlyEditingRow byExtendingSelection:NO];
+ isSavingRow = NO;
return NO;
}
@@ -1669,6 +1677,9 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
+
+ // Catch editing events in the row and if the row isn't currently being edited,
+ // start an edit. This allows edits including enum changes to save correctly.
if ( !isEditingRow ) {
[oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
isEditingRow = YES;