aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m3
-rw-r--r--Source/SPTableContent.m12
3 files changed, 11 insertions, 5 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 3ba923ff..69efe326 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -304,6 +304,7 @@ extern NSString *SPProcessListAutoRrefreshInterval;
extern NSString *SPFavoritesSortedBy;
extern NSString *SPFavoritesSortedInReverse;
extern NSString *SPAlwaysShowWindowTabBar;
+extern NSString *SPResetAutoIncrementAfterDeletionOfAllRows;
// Hidden Prefs
extern NSString *SPPrintWarningRowLimit;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 36a9a25b..cb5ea82f 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -134,7 +134,8 @@ NSString *SPProcessListEnableAutoRefresh = @"ProcessListEnableAutoRefres
NSString *SPProcessListAutoRrefreshInterval = @"ProcessListAutoRrefreshInterval";
NSString *SPFavoritesSortedBy = @"FavoritesSortedBy";
NSString *SPFavoritesSortedInReverse = @"FavoritesSortedInReverse";
-NSString *SPAlwaysShowWindowTabBar = @"WindowAlwaysShowTabBar";
+NSString *SPAlwaysShowWindowTabBar = @"WindowAlwaysShowTabBar";
+NSString *SPResetAutoIncrementAfterDeletionOfAllRows = @"ResetAutoIncrementAfterDeletionOfAllRows";
// Hidden Prefs
NSString *SPPrintWarningRowLimit = @"PrintWarningRowLimit";
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 15f4df31..bf03c66e 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1417,7 +1417,7 @@
// If table has PRIMARY KEY ask for resetting the auto increment after deletion if given
if(![[tableDataInstance statusValueForKey:@"Auto_increment"] isKindOfClass:[NSNull class]]) {
[alert setShowsSuppressionButton:YES];
- [[alert suppressionButton] setState:NSOnState];
+ [[alert suppressionButton] setState:([prefs boolForKey:SPResetAutoIncrementAfterDeletionOfAllRows]) ? NSOnState : NSOffState];
[[[alert suppressionButton] cell] setControlSize:NSSmallControlSize];
[[[alert suppressionButton] cell] setFont:[NSFont systemFontOfSize:11]];
[[alert suppressionButton] setTitle:NSLocalizedString(@"Reset AUTO_INCREMENT after deletion?", @"reset auto_increment after deletion of all rows message")];
@@ -1453,7 +1453,7 @@
// Order out current sheet to suppress overlapping of sheets
[[alert window] orderOut:nil];
- if ( [contextInfo isEqualToString:@"removeallrows"] ) {
+ if ( [contextInfo isEqualToString:@"removeallrows"] ) {
if ( returnCode == NSAlertDefaultReturn ) {
//check if the user is currently editing a row
if (isEditingRow) {
@@ -1461,15 +1461,19 @@
isEditingRow = NO;
// in case the delete fails, make sure we at least stay in a somewhat consistent state
[tableValues replaceRowAtIndex:currentlyEditingRow withRowContents:oldRow];
- currentlyEditingRow = -1;
+ currentlyEditingRow = -1;
}
[mySQLConnection queryString:[NSString stringWithFormat:@"DELETE FROM %@", [selectedTable backtickQuotedString]]];
if ( ![mySQLConnection queryErrored] ) {
// Reset auto increment if suppression button was ticked
- if([[alert suppressionButton] state] == NSOnState)
+ if([[alert suppressionButton] state] == NSOnState) {
[tableSourceInstance setAutoIncrementTo:@"1"];
+ [prefs setBool:YES forKey:SPResetAutoIncrementAfterDeletionOfAllRows];
+ } else {
+ [prefs setBool:NO forKey:SPResetAutoIncrementAfterDeletionOfAllRows];
+ }
[self reloadTable:self];