aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-03-05 01:02:53 +0000
committerrowanbeentje <rowan@beent.je>2009-03-05 01:02:53 +0000
commitf0830d96692e40eaa45bd5b9ae1322a391d905a7 (patch)
treea62b6ccc9d96deb6984fada3a149db3613dd8262 /Source/TableDocument.m
parent04f87a1710d1379589c7e4d7e84cfbb9908ae468 (diff)
downloadsequelpro-f0830d96692e40eaa45bd5b9ae1322a391d905a7.tar.gz
sequelpro-f0830d96692e40eaa45bd5b9ae1322a391d905a7.tar.bz2
sequelpro-f0830d96692e40eaa45bd5b9ae1322a391d905a7.zip
Improves the table structure view to only save a row when properly deselected, and automatically reselecting the row for re-edit on error - resolves Issue #74.
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index a42c5d73..6d936800 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1190,12 +1190,26 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
- (IBAction)viewContent:(id)sender
{
+ // Cancel the selection if currently editing structure/a field and unable to save
+ if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
+ && ![tableSourceInstance saveRowOnDeselect]) {
+ [mainToolbar setSelectedItemIdentifier:@"SwitchToTableStructureToolbarItemIdentifier"];
+ return;
+ }
+
[tableTabView selectTabViewItemAtIndex:1];
[mainToolbar setSelectedItemIdentifier:@"SwitchToTableContentToolbarItemIdentifier"];
}
- (IBAction)viewQuery:(id)sender
{
+ // Cancel the selection if currently editing structure/a field and unable to save
+ if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
+ && ![tableSourceInstance saveRowOnDeselect]) {
+ [mainToolbar setSelectedItemIdentifier:@"SwitchToTableStructureToolbarItemIdentifier"];
+ return;
+ }
+
// Cancel the selection if currently editing a content row and unable to save
if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1
&& ![tableContentInstance saveRowOnDeselect]) {
@@ -1209,6 +1223,13 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
- (IBAction)viewStatus:(id)sender
{
+ // Cancel the selection if currently editing structure/a field and unable to save
+ if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
+ && ![tableSourceInstance saveRowOnDeselect]) {
+ [mainToolbar setSelectedItemIdentifier:@"SwitchToTableStructureToolbarItemIdentifier"];
+ return;
+ }
+
// Cancel the selection if currently editing a content row and unable to save
if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1
&& ![tableContentInstance saveRowOnDeselect]) {