aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-04-17 18:19:32 +0000
committerstuconnolly <stuart02@gmail.com>2009-04-17 18:19:32 +0000
commit6646f022ec631d24afe58e8fbe4a7824f4a9c498 (patch)
tree1582920aa2805a8b6f8751eee94eaa26fbfe1edc
parent0be6e77f9b561db628c9ea5b8ddaef4f165d6b7c (diff)
downloadsequelpro-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.
-rw-r--r--Interfaces/English.lproj/Localizable.stringsbin33234 -> 34298 bytes
-rw-r--r--Source/TableDocument.m20
-rw-r--r--Source/TableDump.m4
-rw-r--r--Source/TablesList.m27
4 files changed, 31 insertions, 20 deletions
diff --git a/Interfaces/English.lproj/Localizable.strings b/Interfaces/English.lproj/Localizable.strings
index 7bc7a52d..bba6709a 100644
--- a/Interfaces/English.lproj/Localizable.strings
+++ b/Interfaces/English.lproj/Localizable.strings
Binary files differ
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 850ee443..851213e7 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -497,10 +497,9 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
* if contextInfo == removedatabase -> tries to remove the selected database
*/
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
-{
- [sheet orderOut:self];
-
+{
if ([contextInfo isEqualToString:@"connect"]) {
+ [sheet orderOut:self];
[self connectToDB:nil];
return;
}
@@ -680,10 +679,19 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
{
if ([chooseDatabaseButton indexOfSelectedItem] == 0)
return;
+
if (![tablesListInstance selectionShouldChangeInTableView:nil])
return;
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, nil, @selector(sheetDidEnd:returnCode:contextInfo:), @"removedatabase", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the database %@?", @"message of panel asking for confirmation for deleting db"), [self database]]);
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete database '%@'?", @"delete database message"), [self database]]
+ defaultButton:NSLocalizedString(@"Delete", @"delete button")
+ alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
+ otherButton:nil
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the database '%@'. This operation cannot be undone.", @"delete database informative message"), [self database]]];
+
+ [alert setAlertStyle:NSCriticalAlertStyle];
+
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removedatabase"];
}
#pragma mark Console methods
@@ -1604,10 +1612,10 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[toolbarItem setToolTip:NSLocalizedString(@"Show or hide the console which shows all MySQL commands performed by Sequel Pro", @"tooltip for toolbar item for show/hide console")];
if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) {
- [toolbarItem setLabel:NSLocalizedString(@"Hide Console", @"toolbar item for hide console")];
+ [toolbarItem setLabel:NSLocalizedString(@"Hide Console", @"Hide Console")];
[toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]];
} else {
- [toolbarItem setLabel:NSLocalizedString(@"Show Console", @"toolbar item for showconsole")];
+ [toolbarItem setLabel:NSLocalizedString(@"Show Console", @"Show Console")];
[toolbarItem setImage:[NSImage imageNamed:@"showconsole"]];
}
diff --git a/Source/TableDump.m b/Source/TableDump.m
index b32c1fae..ff79129d 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -410,7 +410,7 @@
}
if (errorStr) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"Title of error alert"),
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"Error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil,
tableWindow, self,
@@ -536,7 +536,7 @@
[singleProgressBar setIndeterminate:NO];
if([importArray count] == 0){
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"Title of error alert"),
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"Error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil,
tableWindow, self,
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];
}
}