aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPAlertSheets.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPAlertSheets.m')
-rw-r--r--Source/SPAlertSheets.m18
1 files changed, 5 insertions, 13 deletions
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