Force update available to false if an update is running

master
Simon Stürz 2018-04-27 08:11:40 +02:00 committed by Michael Zanetti
parent 746aa66e4d
commit de3b7b4204
1 changed files with 7 additions and 1 deletions

View File

@ -243,7 +243,7 @@ void SnapdControl::onLoadRunningChangesFinished()
QString changeStatus = changeMap.value("status").toString();
QString changeSummary = changeMap.value("summary").toString();
// If there is a change kind "doing" or "Do"
// If there is a change kind "Doing" or "Do"
if ( (changeStatus == "Doing" || changeStatus == "Do") && m_updateChangeKinds.contains(changeKind)) {
// Set the status of the current running change
updateRunning = true;
@ -251,10 +251,16 @@ void SnapdControl::onLoadRunningChangesFinished()
updateStatus = changeSummary;
qCDebug(dcSnapd()).noquote() << "Current change:" << changeId << (changeReady ? "ready" : "not ready") << changeStatus << changeKind << changeSummary;
// TODO: calculate the overall percentage of the update process (Do + Doing / Done)
}
}
}
// If currently an update is running, lets force update available to false if set to true
if (updateRunning && device()->stateValue(snapdControlUpdateAvailableStateTypeId).toBool()) {
device()->setStateValue(snapdControlUpdateAvailableStateTypeId, false);
}
device()->setStateValue(snapdControlUpdateRunningStateTypeId, updateRunning);
device()->setStateValue(snapdControlStatusStateTypeId, updateStatus);
}