aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPAlertSheets.h3
-rw-r--r--Source/SPAlertSheets.m17
-rw-r--r--Source/SPDatabaseDocument.m3
-rw-r--r--Source/SPTableData.m21
4 files changed, 30 insertions, 14 deletions
diff --git a/Source/SPAlertSheets.h b/Source/SPAlertSheets.h
index f61d0e38..99e64e59 100644
--- a/Source/SPAlertSheets.h
+++ b/Source/SPAlertSheets.h
@@ -61,5 +61,6 @@ void SPOnewayAlertSheet(
NSString *title,
NSString *defaultButton,
NSWindow *docWindow,
- NSString *msg
+ NSString *msg,
+ NSAlertStyle alertStyle
);
diff --git a/Source/SPAlertSheets.m b/Source/SPAlertSheets.m
index 85afbdfb..d19da6df 100644
--- a/Source/SPAlertSheets.m
+++ b/Source/SPAlertSheets.m
@@ -149,12 +149,14 @@
* Because of that there is no way to set a delegate and callback method
* and there is only one default button.
* If nil is passed as the button title it will be changed to @"OK".
+ * If nil is passed as the window NSAlert will be modal
*/
void SPOnewayAlertSheet(
NSString *title,
NSString *defaultButton,
NSWindow *docWindow,
- NSString *msg)
+ NSString *msg,
+ NSAlertStyle alertStyle)
{
NSString *defaultText = (defaultButton)? defaultButton : NSLocalizedString(@"OK", @"OK button");
@@ -168,12 +170,17 @@ void SPOnewayAlertSheet(
// Set the informative message if supplied
if (msg) [alert setInformativeText:msg];
+
+ // Set style (Defaults to NSWarningAlertStyle)
+ [alert setAlertStyle:alertStyle];
// Run the alert
- [alert beginSheetModalForWindow:docWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
-
- // Ensure the alerting window is frontmost
- [docWindow makeKeyWindow];
+ if (docWindow) {
+ [alert beginSheetModalForWindow:docWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
+ [docWindow makeKeyWindow]; // Ensure the alerting window is frontmost
+ } else {
+ [alert runModal];
+ }
});
}
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 1793cf60..5c0553f8 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -6162,7 +6162,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
NSLocalizedString(@"Error", @"error"),
nil,
parentWindow,
- [NSString stringWithFormat:NSLocalizedString(@"Unable to select database %@.\nPlease check you have the necessary privileges to view the database, and that the database still exists.", @"message of panel when connection to db failed after selecting from popupbutton"), targetDatabaseName]
+ [NSString stringWithFormat:NSLocalizedString(@"Unable to select database %@.\nPlease check you have the necessary privileges to view the database, and that the database still exists.", @"message of panel when connection to db failed after selecting from popupbutton"), targetDatabaseName],
+ NSWarningAlertStyle
);
}
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 27dd4ea1..4ad3f028 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -492,7 +492,8 @@
NSLocalizedString(@"Error retrieving table information", @"error retrieving table information message"),
nil,
[NSApp mainWindow],
- errorMessage
+ errorMessage,
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
@@ -517,7 +518,8 @@
NSLocalizedString(@"Permission Denied", @"Permission Denied"),
nil,
[NSApp mainWindow],
- NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail")
+ NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail"),
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
@@ -849,7 +851,8 @@
NSLocalizedString(@"Error", @"error"),
nil,
[NSApp mainWindow],
- [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),[mySQLConnection lastErrorMessage]]
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),[mySQLConnection lastErrorMessage]],
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
}
@@ -866,7 +869,8 @@
NSLocalizedString(@"Permission Denied", @"Permission Denied"),
nil,
[NSApp mainWindow],
- NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail")
+ NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail"),
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
return nil;
@@ -885,7 +889,8 @@
NSLocalizedString(@"Error", @"error"),
nil,
[NSApp mainWindow],
- [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"), [mySQLConnection lastErrorMessage]]
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"), [mySQLConnection lastErrorMessage]],
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
}
@@ -996,7 +1001,8 @@
NSLocalizedString(@"Error", @"error"),
nil,
[NSApp mainWindow],
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving status data.\nMySQL said: %@", @"message of panel when retrieving view information failed"), [mySQLConnection lastErrorMessage]]
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving status data.\nMySQL said: %@", @"message of panel when retrieving view information failed"), [mySQLConnection lastErrorMessage]],
+ NSWarningAlertStyle
);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
}
@@ -1083,7 +1089,8 @@
NSLocalizedString(@"Error retrieving trigger information", @"error retrieving trigger information message"),
nil,
[NSApp mainWindow],
- [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving the trigger information for table '%@'. Please try again.\n\nMySQL said: %@", @"error retrieving table information informative message"), [tableListInstance tableName], [mySQLConnection lastErrorMessage]]
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving the trigger information for table '%@'. Please try again.\n\nMySQL said: %@", @"error retrieving table information informative message"), [tableListInstance tableName], [mySQLConnection lastErrorMessage]],
+ NSWarningAlertStyle
);
if (triggers) SPClear(triggers);
if (changeEncoding) [mySQLConnection restoreStoredEncoding];