Maked setHost() and setPassword() deprecated. Some bug fixes.

This commit is contained in:
Tőkés Attila 2012-10-28 21:48:04 +02:00
parent 34883564f5
commit 949e1ee82a
2 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,9 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection
authMethod(AuthPlain), authMethod(AuthPlain),
connectionTimeout(5000), connectionTimeout(5000),
responseTimeout(5000), responseTimeout(5000),
isReadyConnected(false) isReadyConnected(false),
isAuthenticated(false),
isMailSent(false)
{ {
setConnectionType(connectionType); setConnectionType(connectionType);
@ -80,6 +82,7 @@ void SmtpClient::setAuthMethod(AuthMethod method)
/** /**
* @brief Sets the host of connection. * @brief Sets the host of connection.
* @deprecated Use the constructor.
*/ */
void SmtpClient::setHost(QString &host) void SmtpClient::setHost(QString &host)
{ {
@ -89,6 +92,7 @@ void SmtpClient::setHost(QString &host)
/** /**
* @brief Sets the connection port to the specified value. * @brief Sets the connection port to the specified value.
* @param port * @param port
* @deprecated Use the constructor.
*/ */
void SmtpClient::setPort(int port) void SmtpClient::setPort(int port)
{ {
@ -212,6 +216,7 @@ bool SmtpClient::login(const QString &user, const QString &password, AuthMethod
this->user = user; this->user = user;
this->password = password; this->password = password;
this->authMethod = method; this->authMethod = method;
clearUserDataAfterLogin = true;
return login(); return login();
} }
@ -407,6 +412,10 @@ void SmtpClient::changeState(ClientState state) {
case _READY_Authenticated: case _READY_Authenticated:
isAuthenticated = true; isAuthenticated = true;
if (clearUserDataAfterLogin) {
password = ""; user = "";
clearUserDataAfterLogin = false;
}
changeState(ReadyState); changeState(ReadyState);
emit authenticated(); emit authenticated();
break; break;

View File

@ -169,6 +169,7 @@ protected:
QString user; QString user;
QString password; QString password;
AuthMethod authMethod; AuthMethod authMethod;
bool clearUserDataAfterLogin;
int connectionTimeout; int connectionTimeout;
int responseTimeout; int responseTimeout;