diff options
-rw-r--r-- | Source/SPAlertSheets.h | 1 | ||||
-rw-r--r-- | Source/SPAlertSheets.m | 18 | ||||
-rw-r--r-- | Source/SPCustomQuery.m | 3 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 6 | ||||
-rw-r--r-- | Source/SPEditorPreferencePane.m | 3 |
5 files changed, 9 insertions, 22 deletions
diff --git a/Source/SPAlertSheets.h b/Source/SPAlertSheets.h index c92b635d..8bc74971 100644 --- a/Source/SPAlertSheets.h +++ b/Source/SPAlertSheets.h @@ -39,7 +39,6 @@ modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo - msg:(NSString *)msg infoText:(NSString *)infoText returnCode:(NSInteger *)returnCode; diff --git a/Source/SPAlertSheets.m b/Source/SPAlertSheets.m index 258aac6d..fc98dc7c 100644 --- a/Source/SPAlertSheets.m +++ b/Source/SPAlertSheets.m @@ -53,7 +53,6 @@ modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo - msg:(NSString *)msg infoText:(NSString *)infoText returnCode:(NSInteger *)returnCode { @@ -69,7 +68,6 @@ modalDelegate:modalDelegate didEndSelector:didEndSelector contextInfo:contextInfo - msg:msg infoText:infoText returnCode:returnCode]; } @@ -93,43 +91,37 @@ aButton = [alert addButtonWithTitle:alternateButton]; [aButton setTag:NSAlertAlternateReturn]; } + if (otherButton) { aButton = [alert addButtonWithTitle:otherButton]; [aButton setTag:NSAlertOtherReturn]; } // Set alert style - [alert setAlertStyle:NSWarningAlertStyle]; - if(alertStyle) - [alert setAlertStyle:alertStyle]; + [alert setAlertStyle:alertStyle ? alertStyle : NSWarningAlertStyle]; // Set the informative message if supplied if (infoText) [alert setInformativeText:infoText]; - // Set the informative message if supplied - if (msg) [alert setMessageText:msg]; - // Run the alert on the main thread [alert beginSheetModalForWindow:docWindow modalDelegate:modalDelegate didEndSelector:didEndSelector contextInfo:contextInfo]; // wait for the sheet NSModalSession session = [NSApp beginModalSessionForWindow:[alert window]]; + for (;;) { // Since the returnCode can only be -1, 0, or 1 // run the session until returnCode was changed in // the didEndSelector method of the calling class - if(returnCode != &initialReturnCode) - break; + if (returnCode != &initialReturnCode) break; // Execute code on DefaultRunLoop [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; // Break the run loop if sheet was closed - if ([NSApp runModalSession:session] != NSRunContinuesResponse - || ![[alert window] isVisible]) - break; + if ([NSApp runModalSession:session] != NSRunContinuesResponse || ![[alert window] isVisible]) break; // Execute code on DefaultRunLoop [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 4150d5a4..6f79948d 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -754,7 +754,7 @@ if (![mySQLConnection lastQueryWasCancelled]) { [tableDocumentInstance setTaskIndicatorShouldAnimate:NO]; - [SPAlertSheets beginWaitingAlertSheetWithTitle:@"title" + [SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"MySQL Error", @"mysql error message") defaultButton:NSLocalizedString(@"Run All", @"run all button") alternateButton:NSLocalizedString(@"Continue", @"continue button") otherButton:NSLocalizedString(@"Stop", @"stop button") @@ -763,7 +763,6 @@ modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"runAllContinueStopSheet" - msg:NSLocalizedString(@"MySQL Error", @"mysql error message") infoText:[mySQLConnection lastErrorMessage] returnCode:&runAllContinueStopSheetReturnCode]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 128ec297..50993583 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -875,7 +875,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; // Inform the user that we don't support copying objects other than tables and ask them if they'd like to proceed if ([tablesListInstance hasNonTableObjects]) { - [SPAlertSheets beginWaitingAlertSheetWithTitle:@"" + [SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"Only Partially Supported", @"partial copy database support message") defaultButton:NSLocalizedString(@"Continue", "continue button") alternateButton:NSLocalizedString(@"Cancel", @"cancel button") otherButton:nil @@ -884,7 +884,6 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:SPConfirmCopyDatabaseAction - msg:NSLocalizedString(@"Only Partially Supported", @"partial copy database support message") infoText:[NSString stringWithFormat:NSLocalizedString(@"Duplicating the database '%@' is only partially supported as it contains objects other tables (i.e. views, procedures, functions, etc.), which will not be copied.\n\nWould you like to continue?", @"partial copy database support informative message"), selectedDatabase] returnCode:&confirmCopyDatabaseReturnCode]; @@ -3371,7 +3370,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; if(!spf || ![spf count] || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - [SPAlertSheets beginWaitingAlertSheetWithTitle:@"title" + [SPAlertSheets beginWaitingAlertSheetWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:NSLocalizedString(@"Ignore", @"ignore button") otherButton:nil @@ -3380,7 +3379,6 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"saveDocPrefSheetStatus" - msg:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")] infoText:[NSString stringWithFormat:NSLocalizedString(@"Connection data file “%@” couldn't be read. Please try to save the document under a different name.", @"message error while reading connection data file and suggesting to save it under a differnet name"), [fileName lastPathComponent]] returnCode:&saveDocPrefSheetStatus]; diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m index 7eaecf47..0428984a 100644 --- a/Source/SPEditorPreferencePane.m +++ b/Source/SPEditorPreferencePane.m @@ -749,7 +749,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; [[NSColorPanel sharedColorPanel] close]; - [SPAlertSheets beginWaitingAlertSheetWithTitle:@"title" + [SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"Unsaved Theme", @"unsaved theme message") defaultButton:NSLocalizedString(@"Proceed", @"proceed button") alternateButton:NSLocalizedString(@"Cancel", @"cancel button") otherButton:nil @@ -758,7 +758,6 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; modalDelegate:self didEndSelector:@selector(checkForUnsavedThemeDidEndSheet:returnCode:contextInfo:) contextInfo:nil - msg:NSLocalizedString(@"Unsaved Theme", @"unsaved theme message") infoText:NSLocalizedString(@"The current color theme is unsaved. Do you want to proceed without saving it?", @"unsaved theme informative message") returnCode:&checkForUnsavedThemeSheetStatus]; |