diff options
author | stuconnolly <stuart02@gmail.com> | 2009-04-17 18:19:32 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-04-17 18:19:32 +0000 |
commit | 6646f022ec631d24afe58e8fbe4a7824f4a9c498 (patch) | |
tree | 1582920aa2805a8b6f8751eee94eaa26fbfe1edc /Source/TablesList.m | |
parent | 0be6e77f9b561db628c9ea5b8ddaef4f165d6b7c (diff) | |
download | sequelpro-6646f022ec631d24afe58e8fbe4a7824f4a9c498.tar.gz sequelpro-6646f022ec631d24afe58e8fbe4a7824f4a9c498.tar.bz2 sequelpro-6646f022ec631d24afe58e8fbe4a7824f4a9c498.zip |
- Update delete table and database warning messages to be more user friendly (issue #192).
- Also make these messages have a style of critical to indicate the potential loss of data as a result of performing the operation.
- Updated Localizable.strings to accommodate new dialog messages.
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r-- | Source/TablesList.m | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m index ef1f3531..6d0925db 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -213,21 +213,25 @@ */ - (IBAction)removeTable:(id)sender { - if ( ![tablesListView numberOfSelectedRows] ) + if (![tablesListView numberOfSelectedRows]) return; + [tableWindow endEditingFor:nil]; + + NSAlert *alert = [NSAlert alertWithMessageText:@"" defaultButton:NSLocalizedString(@"Delete", @"delete button") alternateButton:NSLocalizedString(@"Cancel", @"cancel button") otherButton:nil informativeTextWithFormat:@""]; - if ( [tablesListView numberOfSelectedRows] == 1 ) { - NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, - @selector(sheetDidEnd:returnCode:contextInfo:), nil, - @"removeRow", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the table %@?", @"message of panel asking for confirmation for deleting table"), - [tables objectAtIndex:[tablesListView selectedRow]]]); - } else { - NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, - @selector(sheetDidEnd:returnCode:contextInfo:), nil, - @"removeRow", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the selected tables?", @"message of panel asking for confirmation for deleting tables"), - [tables objectAtIndex:[tablesListView selectedRow]]]); + [alert setAlertStyle:NSCriticalAlertStyle]; + + if ([tablesListView numberOfSelectedRows] == 1) { + [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete table '%@'?", @"delete table message"), [tables objectAtIndex:[tablesListView selectedRow]]]]; + [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the table '%@'. This operation cannot be undone.", @"delete table informative message"), [tables objectAtIndex:[tablesListView selectedRow]]]]; + } + else { + [alert setMessageText:NSLocalizedString(@"Delete selected tables?", @"delete tables message")]; + [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete the selected tables. This operation cannot be undone.", @"delete tables informative message")]; } + + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeRow"]; } /** @@ -343,7 +347,6 @@ alertSheetOpened = NO; } else if ( [contextInfo isEqualToString:@"removeRow"] ) { if ( returnCode == NSAlertDefaultReturn ) { - [sheet orderOut:self]; [self removeTable]; } } |