Mercurial > trustbridge
changeset 1056:c7db2cc97bad
(issue44) Remove downloaded binaries after update
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 09 Sep 2014 17:04:10 +0200 |
parents | 9812983e7650 |
children | 126e5ce4d1d1 |
files | ui/mainwindow.cpp |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Tue Sep 09 17:03:46 2014 +0200 +++ b/ui/mainwindow.cpp Tue Sep 09 17:04:10 2014 +0200 @@ -379,6 +379,28 @@ QDateTime listInstalledLastMod = mSettings.value("List/installedDate").toDateTime(); QDateTime swInstalledLastMod = mSettings.value("Software/installedDate").toDateTime(); + QDateTime swAvailableLastMod = mSettings.value("Software/availableDate").toDateTime(); + + if (swAvailableLastMod.isValid()) { + qDebug() << "Installed an update: " << swInstalledLastMod << + " available " << swAvailableLastMod; + if (swInstalledLastMod == swAvailableLastMod) { + QString fileName = mSettings.value("Software/available").toString(); + if (fileName.isEmpty()) { + qDebug() << "Software marked as available but no filename set."; + } else { + if (QFile::remove(fileName)) { + qDebug() << "Removed: " << fileName; + } else { + qDebug() << "Failed to remove: " << fileName; + } + } + /* Clear out available data. */ + mSettings.remove("Software/available"); + mSettings.remove("Software/availableDate"); + } + } + QString listResource = QString::fromLatin1(LIST_RESOURCE); QString swResource = QString::fromLatin1(SW_RESOURCE);