Skip to content

Commit 30d36cb

Browse files
committed
Remove duplicate setting of sheet title/message.
1 parent d37a2f4 commit 30d36cb

5 files changed

Lines changed: 9 additions & 22 deletions

File tree

Source/SPAlertSheets.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
modalDelegate:(id)modalDelegate
4040
didEndSelector:(SEL)didEndSelector
4141
contextInfo:(void *)contextInfo
42-
msg:(NSString *)msg
4342
infoText:(NSString *)infoText
4443
returnCode:(NSInteger *)returnCode;
4544

Source/SPAlertSheets.m

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
5353
modalDelegate:(id)modalDelegate
5454
didEndSelector:(SEL)didEndSelector
5555
contextInfo:(void *)contextInfo
56-
msg:(NSString *)msg
5756
infoText:(NSString *)infoText
5857
returnCode:(NSInteger *)returnCode
5958
{
@@ -69,7 +68,6 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
6968
modalDelegate:modalDelegate
7069
didEndSelector:didEndSelector
7170
contextInfo:contextInfo
72-
msg:msg
7371
infoText:infoText
7472
returnCode:returnCode];
7573
}
@@ -93,43 +91,37 @@ + (void)beginWaitingAlertSheetWithTitle:(NSString *)title
9391
aButton = [alert addButtonWithTitle:alternateButton];
9492
[aButton setTag:NSAlertAlternateReturn];
9593
}
94+
9695
if (otherButton) {
9796
aButton = [alert addButtonWithTitle:otherButton];
9897
[aButton setTag:NSAlertOtherReturn];
9998
}
10099

101100
// Set alert style
102-
[alert setAlertStyle:NSWarningAlertStyle];
103-
if(alertStyle)
104-
[alert setAlertStyle:alertStyle];
101+
[alert setAlertStyle:alertStyle ? alertStyle : NSWarningAlertStyle];
105102

106103
// Set the informative message if supplied
107104
if (infoText) [alert setInformativeText:infoText];
108105

109-
// Set the informative message if supplied
110-
if (msg) [alert setMessageText:msg];
111-
112106
// Run the alert on the main thread
113107
[alert beginSheetModalForWindow:docWindow modalDelegate:modalDelegate didEndSelector:didEndSelector contextInfo:contextInfo];
114108

115109
// wait for the sheet
116110
NSModalSession session = [NSApp beginModalSessionForWindow:[alert window]];
111+
117112
for (;;) {
118113

119114
// Since the returnCode can only be -1, 0, or 1
120115
// run the session until returnCode was changed in
121116
// the didEndSelector method of the calling class
122-
if(returnCode != &initialReturnCode)
123-
break;
117+
if (returnCode != &initialReturnCode) break;
124118

125119
// Execute code on DefaultRunLoop
126120
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
127121
beforeDate:[NSDate distantFuture]];
128122

129123
// Break the run loop if sheet was closed
130-
if ([NSApp runModalSession:session] != NSRunContinuesResponse
131-
|| ![[alert window] isVisible])
132-
break;
124+
if ([NSApp runModalSession:session] != NSRunContinuesResponse || ![[alert window] isVisible]) break;
133125

134126
// Execute code on DefaultRunLoop
135127
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode

Source/SPCustomQuery.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ - (void)performQueriesTask:(NSDictionary *)taskArguments
754754
if (![mySQLConnection lastQueryWasCancelled]) {
755755

756756
[tableDocumentInstance setTaskIndicatorShouldAnimate:NO];
757-
[SPAlertSheets beginWaitingAlertSheetWithTitle:@"title"
757+
[SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"MySQL Error", @"mysql error message")
758758
defaultButton:NSLocalizedString(@"Run All", @"run all button")
759759
alternateButton:NSLocalizedString(@"Continue", @"continue button")
760760
otherButton:NSLocalizedString(@"Stop", @"stop button")
@@ -763,7 +763,6 @@ - (void)performQueriesTask:(NSDictionary *)taskArguments
763763
modalDelegate:self
764764
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
765765
contextInfo:@"runAllContinueStopSheet"
766-
msg:NSLocalizedString(@"MySQL Error", @"mysql error message")
767766
infoText:[mySQLConnection lastErrorMessage]
768767
returnCode:&runAllContinueStopSheetReturnCode];
769768

Source/SPDatabaseDocument.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ - (IBAction)copyDatabase:(id)sender
875875

876876
// Inform the user that we don't support copying objects other than tables and ask them if they'd like to proceed
877877
if ([tablesListInstance hasNonTableObjects]) {
878-
[SPAlertSheets beginWaitingAlertSheetWithTitle:@""
878+
[SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"Only Partially Supported", @"partial copy database support message")
879879
defaultButton:NSLocalizedString(@"Continue", "continue button")
880880
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
881881
otherButton:nil
@@ -884,7 +884,6 @@ - (IBAction)copyDatabase:(id)sender
884884
modalDelegate:self
885885
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
886886
contextInfo:SPConfirmCopyDatabaseAction
887-
msg:NSLocalizedString(@"Only Partially Supported", @"partial copy database support message")
888887
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]
889888
returnCode:&confirmCopyDatabaseReturnCode];
890889

@@ -3371,7 +3370,7 @@ - (BOOL)saveDocumentWithFilePath:(NSString *)fileName inBackground:(BOOL)saveInB
33713370

33723371
if(!spf || ![spf count] || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
33733372

3374-
[SPAlertSheets beginWaitingAlertSheetWithTitle:@"title"
3373+
[SPAlertSheets beginWaitingAlertSheetWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
33753374
defaultButton:NSLocalizedString(@"OK", @"OK button")
33763375
alternateButton:NSLocalizedString(@"Ignore", @"ignore button")
33773376
otherButton:nil
@@ -3380,7 +3379,6 @@ - (BOOL)saveDocumentWithFilePath:(NSString *)fileName inBackground:(BOOL)saveInB
33803379
modalDelegate:self
33813380
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
33823381
contextInfo:@"saveDocPrefSheetStatus"
3383-
msg:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
33843382
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]]
33853383
returnCode:&saveDocPrefSheetStatus];
33863384

Source/SPEditorPreferencePane.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ - (BOOL)_checkForUnsavedTheme
749749

750750
[[NSColorPanel sharedColorPanel] close];
751751

752-
[SPAlertSheets beginWaitingAlertSheetWithTitle:@"title"
752+
[SPAlertSheets beginWaitingAlertSheetWithTitle:NSLocalizedString(@"Unsaved Theme", @"unsaved theme message")
753753
defaultButton:NSLocalizedString(@"Proceed", @"proceed button")
754754
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
755755
otherButton:nil
@@ -758,7 +758,6 @@ - (BOOL)_checkForUnsavedTheme
758758
modalDelegate:self
759759
didEndSelector:@selector(checkForUnsavedThemeDidEndSheet:returnCode:contextInfo:)
760760
contextInfo:nil
761-
msg:NSLocalizedString(@"Unsaved Theme", @"unsaved theme message")
762761
infoText:NSLocalizedString(@"The current color theme is unsaved. Do you want to proceed without saving it?", @"unsaved theme informative message")
763762
returnCode:&checkForUnsavedThemeSheetStatus];
764763

0 commit comments

Comments
 (0)