diff --git a/SandboxiePlus/SandMan/OnlineUpdater.cpp b/SandboxiePlus/SandMan/OnlineUpdater.cpp index 02caad34..8e738564 100644 --- a/SandboxiePlus/SandMan/OnlineUpdater.cpp +++ b/SandboxiePlus/SandMan/OnlineUpdater.cpp @@ -46,6 +46,11 @@ COnlineUpdater::COnlineUpdater(QObject *parent) : QObject(parent) m_CheckMode = eInit; + int iUpdate = 0; + QString UpdateStr = ParseVersionStr(theConf->GetString("Updater/PendingUpdate"), &iUpdate); + if (!IsVersionNewer(UpdateStr) && (UpdateStr != GetCurrentVersion() || iUpdate <= GetCurrentUpdate())) + theConf->SetValue("Updater/PendingUpdate", ""); // seams update has been applied + bool bIsInstallerReady = false; QString FilePath = theConf->GetString("Updater/InstallerPath"); if (!FilePath.isEmpty() && QFile::exists(FilePath)) { @@ -255,7 +260,6 @@ void COnlineUpdater::OnUpdateData(const QVariantMap& Data, const QVariantMap& Pa m_UpdateData = Data; bool PendingUpdate = HandleUpdate(); - theConf->SetValue("Updater/PendingUpdate", PendingUpdate); theGUI->UpdateLabel(); if (PendingUpdate) { @@ -275,11 +279,14 @@ void COnlineUpdater::OnUpdateData(const QVariantMap& Data, const QVariantMap& Pa bool COnlineUpdater::HandleUpdate() { + QString PendingUpdate; + bool bNewRelease = false; QVariantMap Release = m_UpdateData["release"].toMap(); QString ReleaseStr = Release["version"].toString(); if (IsVersionNewer(ReleaseStr)) { if (m_CheckMode == eManual || !m_IgnoredUpdates.contains(ReleaseStr)) { + PendingUpdate = ReleaseStr; bNewRelease = true; } } @@ -296,6 +303,8 @@ bool COnlineUpdater::HandleUpdate() theConf->SetValue("Updater/CurrentUpdate", MakeVersionStr(Update)); // cache result else { + if(PendingUpdate.isEmpty()) + PendingUpdate = UpdateStr; if (m_CheckMode == eManual || !m_IgnoredUpdates.contains(UpdateStr)) { bNewUpdate = true; } @@ -303,6 +312,8 @@ bool COnlineUpdater::HandleUpdate() } } + theConf->SetValue("Updater/PendingUpdate", PendingUpdate); + // // special case: updates allowed be to installed, but releases only allowed to be download // solution: apply updates silently, then prompt to install new release, else prioritize installing new releases over updating the existing one diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 42da5964..b76a4952 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -185,6 +185,10 @@ CSandMan::CSandMan(QWidget *parent) m_bConnectPending = false; m_bStopPending = false; + + m_pUpdater = new COnlineUpdater(this); + + m_pMainWidget = new QWidget(this); m_pMenuBar = menuBar(); @@ -246,8 +250,6 @@ CSandMan::CSandMan(QWidget *parent) m_pPopUpWindow->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop); m_pProgressDialog->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop); - m_pUpdater = new COnlineUpdater(this); - //connect(theAPI, SIGNAL(LogMessage(const QString&, bool)), this, SLOT(OnLogMessage(const QString&, bool))); connect(theAPI, SIGNAL(LogSbieMessage(quint32, const QStringList&, quint32)), this, SLOT(OnLogSbieMessage(quint32, const QStringList&, quint32))); connect(theAPI, SIGNAL(NotAuthorized(bool, bool&)), this, SLOT(OnNotAuthorized(bool, bool&)), Qt::DirectConnection); @@ -777,19 +779,19 @@ void CSandMan::UpdateLabel() QString LabelText; QString LabelTip; - if (theConf->GetBool("Updater/PendingUpdate")) + if (!theConf->GetString("Updater/PendingUpdate").isEmpty()) { QString FilePath = theConf->GetString("Updater/InstallerPath"); if (!FilePath.isEmpty() && QFile::exists(FilePath)) { - LabelText = tr("There is a new Sandboxie-Plus release ready"); + LabelText = tr("There is a new Sandboxie-Plus release %1 ready").arg(theConf->GetString("Updater/InstallerVersion")); LabelTip = tr("Click to run installer"); } else if (!theConf->GetString("Updater/UpdateVersion").isEmpty()){ - LabelText = tr("There is a new Sandboxie-Plus update ready"); + LabelText = tr("There is a new Sandboxie-Plus update %1 ready").arg(theConf->GetString("Updater/UpdateVersion")); LabelTip = tr("Click to apply update"); } else { - LabelText = tr("There is a new build of Sandboxie-Plus available"); + LabelText = tr("There is a new Sandboxie-Plus update v%1 available").arg(theConf->GetString("Updater/PendingUpdate")); LabelTip = tr("Click to download update"); }