Properly display status string for changes in updater

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-02-23 13:05:07 +01:00 committed by Matthieu Gallien
parent 40f7da0106
commit 5f87f6687c
2 changed files with 14 additions and 16 deletions

View File

@ -45,6 +45,8 @@ signals:
private:
std::unique_ptr<SparkleInterface> _interface;
QString _statusString;
friend class SparkleInterface;
};
} // namespace OCC

View File

@ -38,8 +38,9 @@ public:
[delegate release];
}
void statusChanged()
void statusChanged(const QString &statusString)
{
q->_statusString = statusString;
emit q->statusChanged();
}
@ -78,9 +79,10 @@ private:
return YES;
}
- (void)notifyChange
- (void)notifyChange:(const QString&)statusString
{
_owner->statusChanged();
qCDebug(OCC::lcUpdater) << statusString;
_owner->statusChanged(statusString);
}
// Sent when a valid update is found by the update driver.
@ -88,16 +90,14 @@ private:
{
Q_UNUSED(updater)
Q_UNUSED(update)
qCDebug(OCC::lcUpdater) << "Found a valid update.";
[self notifyChange];
[self notifyChange:QStringLiteral("Found a valid update.")];
}
// Sent when a valid update is not found.
- (void)updaterDidNotFindUpdate:(SUUpdater *)update
{
Q_UNUSED(update)
qCDebug(OCC::lcUpdater) << "No valid update found.";
[self notifyChange];
[self notifyChange:QStringLiteral("No valid update found.")];
}
// Sent immediately before installing the specified update.
@ -105,24 +105,21 @@ private:
{
Q_UNUSED(updater)
Q_UNUSED(update)
qCDebug(OCC::lcUpdater) << "About to install update.";
[self notifyChange];
[self notifyChange:QStringLiteral("About to install update.")];
}
- (void)updater:(SUUpdater *)updater didAbortWithError:(NSError *)error
{
Q_UNUSED(updater)
qCDebug(OCC::lcUpdater) << error.description;
[self notifyChange];
const QString message(QStringLiteral("Aborted with error: ") + QString::fromNSString(error.description));
[self notifyChange:message];
}
- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast
{
Q_UNUSED(updater)
Q_UNUSED(appcast)
qCDebug(OCC::lcUpdater) << "Finished loading appcast.";
[self notifyChange];
[self notifyChange:QStringLiteral("Finished loading appcast.")];
}
@ -200,8 +197,7 @@ void SparkleUpdater::backgroundCheckForUpdate()
QString SparkleUpdater::statusString()
{
// FIXME Show the real state depending on the callbacks
return QString();
return _statusString;
}
} // namespace OCC