From 93c8b122f50fe8760e2f9dd5ba4157528d71f3c0 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 11 Apr 2009 10:55:35 +0000 Subject: - Tweak code to use the new UseKeepAlive preference value - Update a few pref checks which were using the old pref values still - Resort preference defaults to match layout in prefs, restore old default values for some keys - Restore missing defaults for new editor properties --- Source/CMMCPConnection.h | 1 + Source/CMMCPConnection.m | 7 ++++--- Source/CustomQuery.m | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'Source') diff --git a/Source/CMMCPConnection.h b/Source/CMMCPConnection.h index bdda78ec..8473c962 100644 --- a/Source/CMMCPConnection.h +++ b/Source/CMMCPConnection.h @@ -47,6 +47,7 @@ NSString *connectionSocket; float lastQueryExecutionTime; int connectionTimeout; + BOOL useKeepAlive; float keepAliveInterval; NSTimer *keepAliveTimer; diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m index 9f8c78fa..99b72e42 100644 --- a/Source/CMMCPConnection.m +++ b/Source/CMMCPConnection.m @@ -67,9 +67,10 @@ static void forcePingTimeout(int signalNumber); connectionPort = 0; connectionSocket = nil; keepAliveTimer = nil; - connectionTimeout = [[[NSUserDefaults standardUserDefaults] objectForKey:@"connectionTimeout"] intValue]; + connectionTimeout = [[[NSUserDefaults standardUserDefaults] objectForKey:@"ConnectionTimeout"] intValue]; if (!connectionTimeout) connectionTimeout = 10; - keepAliveInterval = [[[NSUserDefaults standardUserDefaults] objectForKey:@"keepAliveInterval"] doubleValue]; + useKeepAlive = [[[NSUserDefaults standardUserDefaults] objectForKey:@"UseKeepAlive"] doubleValue]; + keepAliveInterval = [[[NSUserDefaults standardUserDefaults] objectForKey:@"KeepAliveInterval"] doubleValue]; if (!keepAliveInterval) keepAliveInterval = 0; lastKeepAliveSuccess = nil; lastQueryExecutionTime = 0; @@ -637,7 +638,7 @@ static void forcePingTimeout(int signalNumber) lastKeepAliveSuccess = nil; } - if (keepAliveInterval) { + if (useKeepAlive && keepAliveInterval) { keepAliveTimer = [NSTimer scheduledTimerWithTimeInterval:keepAliveInterval target:self diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index ba9349f9..9dbd5a20 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -490,7 +490,7 @@ sets the tableView columns corresponding to the mysql-result [theCol setResizingMask:NSTableColumnUserResizingMask]; NSTextFieldCell *dataCell = [[[NSTextFieldCell alloc] initTextCell:@""] autorelease]; [dataCell setEditable:NO]; - if ( [prefs boolForKey:@"useMonospacedFonts"] ) { + if ( [prefs boolForKey:@"UseMonospacedFonts"] ) { [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]]; } else { [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; @@ -636,7 +636,7 @@ sets the connection (received from TableDocument) and makes things that have to [queryFavoritesView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]]; while ( (column = [enumerator nextObject]) ) { - if ( [prefs boolForKey:@"useMonospacedFonts"] ) { + if ( [prefs boolForKey:@"UseMonospacedFonts"] ) { [[column dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]]; } else { [[column dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; @@ -716,7 +716,7 @@ inserts the query in the textView and performs query return [tmp autorelease]; } if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] ) - return [prefs objectForKey:@"nullValue"]; + return [prefs objectForKey:@"NullValue"]; return [theRow objectAtIndex:[theIdentifier intValue]]; } else if ( aTableView == queryFavoritesView ) { @@ -875,7 +875,7 @@ opens sheet with value when double clicking on a field } [theValue autorelease]; } else if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] ) { - theValue = [prefs objectForKey:@"nullValue"]; + theValue = [prefs objectForKey:@"NullValue"]; } else { theValue = [theRow objectAtIndex:[theIdentifier intValue]]; } -- cgit v1.2.3