From a5f4c3274ac06be78f78200ae486037e9b1a8910 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 19 Jul 2010 22:26:22 +0000 Subject: - Clean up SPDataImport, removing unused methods and cleaning up order and methods - Improve error handling when the connecting dies during import (previous the sheet would stay open) - Fix localised strings for error messages (label and text the wrong way round) - Improve comments --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 2 ++ Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'Frameworks') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index 66f76083..adcecb05 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -141,6 +141,7 @@ BOOL useKeepAlive; BOOL isDisconnecting; + BOOL userTriggeredDisconnect; NSInteger connectionTimeout; CGFloat keepAliveInterval; @@ -227,6 +228,7 @@ - (void)disconnect; - (BOOL)reconnect; - (BOOL)isConnected; +- (BOOL)userTriggeredDisconnect; - (BOOL)checkConnection; - (BOOL)pingConnection; void pingConnectionTask(void *ptr); diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 143152d2..56073806 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -118,6 +118,7 @@ static BOOL sTruncateLongFieldInLogs = YES; serverVersionString = nil; mTimeZone = nil; isDisconnecting = NO; + userTriggeredDisconnect = NO; automaticReconnectAttempts = 0; pingFailureCount = 0; @@ -395,6 +396,7 @@ static BOOL sTruncateLongFieldInLogs = YES; } mConnected = YES; + userTriggeredDisconnect = NO; connectionStartTime = mach_absolute_time(); lastKeepAliveTime = 0; automaticReconnectAttempts = 0; @@ -598,6 +600,7 @@ static BOOL sTruncateLongFieldInLogs = YES; switch (failureDecision) { case MCPConnectionCheckDisconnect: [self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")]; + userTriggeredDisconnect = YES; [reconnectionPool release]; return NO; default: @@ -618,6 +621,15 @@ static BOOL sTruncateLongFieldInLogs = YES; return mConnected; } +/** + * Returns YES if the user chose to disconnect at the last "connection failure" + * prompt, NO otherwise. + */ +- (BOOL)userTriggeredDisconnect +{ + return userTriggeredDisconnect; +} + /** * Checks if the connection to the server is still on. * If not, tries to reconnect (changing no parameters from the MYSQL pointer). @@ -670,6 +682,7 @@ static BOOL sTruncateLongFieldInLogs = YES; case MCPConnectionCheckDisconnect: if (mConnected) [self disconnect]; [self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")]; + userTriggeredDisconnect = YES; return NO; // 'Retry' has been selected - return a recursive call. -- cgit v1.2.3