diff options
author | rowanbeentje <rowan@beent.je> | 2009-03-11 02:10:25 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-03-11 02:10:25 +0000 |
commit | e8d8d6cc38cc92b7201806ed42db50a4c4b324ea (patch) | |
tree | 9446cf7d2cc8feb724ff52dc7b6c1e8d594b3917 /Source/TableSource.m | |
parent | fdc31ea623c0c212e34bcf7d11c20b429e76ddf1 (diff) | |
download | sequelpro-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/TableSource.m')
-rw-r--r-- | Source/TableSource.m | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m index c66f5972..5d1c8e43 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -565,14 +565,22 @@ fetches the result as an array with a dictionary for each row in it */ - (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 already 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. [tableSourceView selectRow:currentlyEditingRow byExtendingSelection:NO]; + isSavingRow = NO; return NO; } |