fix: wrong InstalledTime for application

fallback to pre-value when it's valid.
This commit is contained in:
Ye ShanShan 2024-03-18 17:06:55 +08:00 committed by yeshanshan
parent f3134f7609
commit df502f8293

View File

@ -107,15 +107,16 @@ ApplicationService::ApplicationService(DesktopFile source,
qWarning() << "failed to set InstalledTime for" << appId << "at first launch"; qWarning() << "failed to set InstalledTime for" << appId << "at first launch";
} }
} else { } else {
auto newInstalledTime = QDateTime::currentMSecsSinceEpoch(); if (value.isNull()) {
auto ret = value.isNull() ? auto newInstalledTime = QDateTime::currentMSecsSinceEpoch();
storagePtr->createApplicationValue(appId, ApplicationPropertiesGroup, InstalledTime, newInstalledTime) : if (!storagePtr->createApplicationValue(appId, ApplicationPropertiesGroup, InstalledTime, newInstalledTime)) {
true; m_installedTime = -1;
if (!ret) { qWarning() << "failed to set InstalledTime for new apps:" << appId;
m_installedTime = -1; } else {
qWarning() << "failed to set InstalledTime for new apps:" << appId; m_installedTime = newInstalledTime;
}
} else { } else {
m_installedTime = newInstalledTime; m_installedTime = value.toLongLong();
} }
} }