switch(error)
{
case QNetworkReply::ConnectionRefusedError:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Connection refused by the server"), true);
break;
case QNetworkReply::RemoteHostClosedError:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Connection closed by the server"), true);
break;
case QNetworkReply::HostNotFoundError:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Remote server not found"), true);
break;
case QNetworkReply::TimeoutError:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Connection timed out"), true);
break;
case SituareError::SESSION_EXPIRED:
m_ui->loginFailed();
break;
case SituareError::LOGIN_FAILED:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Invalid E-mail address or password"), true);
+ m_ui->loginFailed();
break;
case SituareError::UPDATE_FAILED:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Update failed, please try again"), true);
break;
case SituareError::DATA_RETRIEVAL_FAILED:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Data retrieval failed, please try again"), true);
break;
case SituareError::ADDRESS_RETRIEVAL_FAILED:
m_ui->buildInformationBox(tr("GPS initialization failed"), true);
break;
case SituareError::UNKNOWN_REPLY:
+ m_ui->toggleProgressIndicator(false);
m_ui->buildInformationBox(tr("Unknown server response"), true);
break;
case SituareError::INVALID_JSON:
m_facebookAuthenticator->clearAccountInformation(false); // clean all
break;
default:
+ m_ui->toggleProgressIndicator(false);
qCritical() << "QNetworkReply::NetworkError :" << error;
break;
}
connect(m_facebookAuthenticator, SIGNAL(newLoginRequest()),
m_ui, SLOT(startLoginProcess()));
- connect(m_facebookAuthenticator, SIGNAL(loginFailure()),
- m_ui, SLOT(loginFailed()));
-
connect(m_facebookAuthenticator, SIGNAL(saveCookiesRequest()),
m_ui, SLOT(saveCookies()));
clearAccountInformation(true);
if(m_freshLogin) {
emit error(SituareError::LOGIN_FAILED);
- emit loginFailure();
} else {
m_freshLogin = true;
emit error(SituareError::SESSION_EXPIRED);
} else {
qDebug() << "totally wrong webPage";
// we should not get a wrong page at this point
- emit loginFailure();
+ emit error(SituareError::LOGIN_FAILED);
}
} else {
qDebug() << " Loading of page failed invalid URL" << endl;
// we should not get a wrong page at this point
- emit loginFailure();
+ emit error(SituareError::LOGIN_FAILED);
}
return found;
}
m_errorShown(false),
m_loggedIn(false),
m_refresh(false),
+ m_progressIndicatorCount(0),
m_ownLocationCrosshair(0),
m_email(),
m_password(),
qDebug() << __PRETTY_FUNCTION__;
clearCookieJar();
-
- toggleProgressIndicator(false);
-
startLoginProcess();
}
qDebug() << __PRETTY_FUNCTION__;
#ifdef Q_WS_MAEMO_5
- setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
+ if(value) {
+ m_progressIndicatorCount++;
+ setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
+ } else {
+ if(m_progressIndicatorCount > 0)
+ m_progressIndicatorCount--;
+
+ if(m_progressIndicatorCount == 0)
+ setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
+ }
#else
Q_UNUSED(value);
#endif // Q_WS_MAEMO_5
if(reply->error() != QNetworkReply::OperationCanceledError &&
reply->error() != QNetworkReply::NoError) {
emit error(reply->error());
- toggleProgressIndicator(false);
}
}
void buildInformationBox(const QString &message, bool modal=false);
/**
- * @brief Slot to intercept signal when login has failed (loginFailure signal)
+ * @brief Slot for failed login
*
*/
void loginFailed();
bool m_loggedIn; ///< Indicates login state
bool m_refresh; ///< Indicates when webpage is refreshed
+ int m_progressIndicatorCount; ///< Indicates the number of progress indicator calls
QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
QAction *m_gpsToggleAct; ///< Action to trigger gps toggle