changes requested by reviewer
This commit is contained in:
parent
f6bdaa9da9
commit
39b52a4f7e
@ -48,8 +48,7 @@ void IntegrationPluginTado::startPairing(ThingPairingInfo *info)
|
|||||||
// Checking the internet connection
|
// Checking the internet connection
|
||||||
NetworkAccessManager *network = hardwareManager()->networkManager();
|
NetworkAccessManager *network = hardwareManager()->networkManager();
|
||||||
QNetworkReply *reply = network->get(QNetworkRequest(QUrl("https://my.tado.com/api/v2")));
|
QNetworkReply *reply = network->get(QNetworkRequest(QUrl("https://my.tado.com/api/v2")));
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, info] {
|
connect(reply, &QNetworkReply::finished, info, [reply, info] {
|
||||||
reply->deleteLater();
|
|
||||||
|
|
||||||
if (reply->error() == QNetworkReply::NetworkError::HostNotFoundError) {
|
if (reply->error() == QNetworkReply::NetworkError::HostNotFoundError) {
|
||||||
info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("Tado server is not reachable."));
|
info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("Tado server is not reachable."));
|
||||||
@ -57,6 +56,7 @@ void IntegrationPluginTado::startPairing(ThingPairingInfo *info)
|
|||||||
info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter the login credentials for your Tado account."));
|
info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter the login credentials for your Tado account."));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &QNetworkReply::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginTado::confirmPairing(ThingPairingInfo *info, const QString &username, const QString &password)
|
void IntegrationPluginTado::confirmPairing(ThingPairingInfo *info, const QString &username, const QString &password)
|
||||||
@ -240,9 +240,9 @@ void IntegrationPluginTado::onConnectionChanged(bool connected)
|
|||||||
Tado *tado = static_cast<Tado*>(sender());
|
Tado *tado = static_cast<Tado*>(sender());
|
||||||
|
|
||||||
if (m_asyncDeviceSetup.contains(tado)) {
|
if (m_asyncDeviceSetup.contains(tado)) {
|
||||||
// thing setup failed, try as lon as ThingSetupInfo is valid.
|
//Thing setup failed, try as long as ThingSetupInfo is valid.
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
QTimer::singleShot(2000, [tado, this]{
|
QTimer::singleShot(2000, tado, [tado, this]{
|
||||||
if(m_asyncDeviceSetup.contains(tado)){
|
if(m_asyncDeviceSetup.contains(tado)){
|
||||||
//Check once more if the ThingSetupInfo is still valid
|
//Check once more if the ThingSetupInfo is still valid
|
||||||
pluginStorage()->beginGroup(m_asyncDeviceSetup.value(tado)->thing()->id().toString());
|
pluginStorage()->beginGroup(m_asyncDeviceSetup.value(tado)->thing()->id().toString());
|
||||||
@ -283,7 +283,7 @@ void IntegrationPluginTado::onAuthenticationStatusChanged(bool authenticated)
|
|||||||
thing->setStateValue(tadoConnectionLoggedInStateTypeId, authenticated);
|
thing->setStateValue(tadoConnectionLoggedInStateTypeId, authenticated);
|
||||||
|
|
||||||
if (!authenticated) {
|
if (!authenticated) {
|
||||||
QTimer::singleShot(5000, [this, tado, thing] {
|
QTimer::singleShot(5000, tado, [this, tado, thing] {
|
||||||
if (!tado->connected()) {
|
if (!tado->connected()) {
|
||||||
pluginStorage()->beginGroup(thing->id().toString());
|
pluginStorage()->beginGroup(thing->id().toString());
|
||||||
QString password = pluginStorage()->value("password").toString();
|
QString password = pluginStorage()->value("password").toString();
|
||||||
@ -309,7 +309,7 @@ void IntegrationPluginTado::onRequestExecuted(QUuid requestId, bool success)
|
|||||||
|
|
||||||
void IntegrationPluginTado::onTokenReceived(Tado::Token token)
|
void IntegrationPluginTado::onTokenReceived(Tado::Token token)
|
||||||
{
|
{
|
||||||
Q_UNUSED(token);
|
Q_UNUSED(token)
|
||||||
|
|
||||||
qCDebug(dcTado()) << "Token received";
|
qCDebug(dcTado()) << "Token received";
|
||||||
Tado *tado = static_cast<Tado*>(sender());
|
Tado *tado = static_cast<Tado*>(sender());
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.1" language="de_DE">
|
<TS version="2.1" language="de">
|
||||||
<context>
|
<context>
|
||||||
<name>IntegrationPluginTado</name>
|
<name>IntegrationPluginTado</name>
|
||||||
<message>
|
<message>
|
||||||
Loading…
x
Reference in New Issue
Block a user