diff options
author | rowanbeentje <rowan@beent.je> | 2010-01-09 20:30:30 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-01-09 20:30:30 +0000 |
commit | c2da83b99ca6db2e2d78b7cd79d4618e359c523a (patch) | |
tree | 6749904fe5a7b08cc6d90da8ef1637a9a7b39b93 /Source/TableContent.m | |
parent | cc560367f6f3c0e1a25d7762aae906772ad3ff28 (diff) | |
download | sequelpro-c2da83b99ca6db2e2d78b7cd79d4618e359c523a.tar.gz sequelpro-c2da83b99ca6db2e2d78b7cd79d4618e359c523a.tar.bz2 sequelpro-c2da83b99ca6db2e2d78b7cd79d4618e359c523a.zip |
Improve row deselection and error handling in Table Source and Content views:
- Change the error dialog buttons to "Edit row" and "Discard changes" instead of "OK" and "Cancel"
- Correctly refocus the deselected row
- Edit the first cell in the row after errors.
- Fix row deselection and error handling on the Table Source view
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index 04f8fb2a..7a034c5f 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1840,7 +1840,7 @@ // Report errors which have occurred } else { - NSBeginAlertSheet(NSLocalizedString(@"Couldn't write row", @"Couldn't write row error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addrow", + NSBeginAlertSheet(NSLocalizedString(@"Couldn't write row", @"Couldn't write row error"), NSLocalizedString(@"Edit row", @"Edit row button"), NSLocalizedString(@"Discard changes", @"discard changes button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addrow", [NSString stringWithFormat:NSLocalizedString(@"MySQL said:\n\n%@", @"message of panel when error while adding row to db"), [mySQLConnection getLastErrorMessage]]); return NO; } @@ -1869,8 +1869,7 @@ return YES; } - // Saving failed - reselect the old row and return failure. - [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:currentlyEditingRow] byExtendingSelection:NO]; + // Saving failed - return failure. isSavingRow = NO; return NO; } @@ -2033,11 +2032,10 @@ [[sheet window] orderOut:self]; if ( [contextInfo isEqualToString:@"addrow"] ) { - [sheet orderOut:self]; if ( returnCode == NSAlertDefaultReturn ) { - //problem: reenter edit mode doesn't function - [tableContentView editColumn:0 row:[tableContentView selectedRow] withEvent:nil select:YES]; + [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:currentlyEditingRow] byExtendingSelection:NO]; + [tableContentView performSelector:@selector(keyDown:) withObject:[NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[tableWindow windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x24] afterDelay:0.0]; } else { if ( !isEditingNewRow ) { [tableValues replaceObjectAtIndex:[tableContentView selectedRow] |