Skip to content
Permalink
Browse files

Remove duplicate setting of sheet title/message.

  • Loading branch information
stuconnolly committed Mar 23, 2017
1 parent d37a2f4 commit 30d36cbe3be216742156fffded790bf95bfc2622
Showing with 9 additions and 22 deletions.
  1. +0 −1 Source/SPAlertSheets.h
  2. +5 −13 Source/SPAlertSheets.m
  3. +1 −2 Source/SPCustomQuery.m
  4. +2 −4 Source/SPDatabaseDocument.m
  5. +1 −2 Source/SPEditorPreferencePane.m
@@ -39,7 +39,6 @@
modalDelegate:(id)modalDelegate
didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo
msg:(NSString *)msg
infoText:(NSString *)infoText
returnCode:(NSInteger *)returnCode;

@@ -53,7 +53,6 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
modalDelegate:(id)modalDelegate
didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo
msg:(NSString *)msg
infoText:(NSString *)infoText
returnCode:(NSInteger *)returnCode
{
@@ -69,7 +68,6 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
modalDelegate:modalDelegate
didEndSelector:didEndSelector
contextInfo:contextInfo
msg:msg
infoText:infoText
returnCode:returnCode];
}
@@ -93,43 +91,37 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
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
@@ -754,7 +754,7 @@ - (void)performQueriesTask:(NSDictionary *)taskArguments
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 @@ - (void)performQueriesTask:(NSDictionary *)taskArguments
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:@"runAllContinueStopSheet"
msg:NSLocalizedString(@"MySQL Error", @"mysql error message")
infoText:[mySQLConnection lastErrorMessage]
returnCode:&runAllContinueStopSheetReturnCode];

@@ -875,7 +875,7 @@ - (IBAction)copyDatabase:(id)sender

// 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 @@ - (IBAction)copyDatabase:(id)sender
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 @@ - (BOOL)saveDocumentWithFilePath:(NSString *)fileName inBackground:(BOOL)saveInB

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 @@ - (BOOL)saveDocumentWithFilePath:(NSString *)fileName inBackground:(BOOL)saveInB
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];

@@ -749,7 +749,7 @@ - (BOOL)_checkForUnsavedTheme

[[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 @@ - (BOOL)_checkForUnsavedTheme
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];

0 comments on commit 30d36cb

Please sign in to comment.
You can’t perform that action at this time.