From c77447d4910c286d427b4ee02ab8a87fd92710f2 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 8 Aug 2019 13:19:40 +0200 Subject: [PATCH] Use new global notification area for update information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of using a modal dialog box. Fixes: QTCREATORBUG-22817 Change-Id: I129827b7f715b6e739ea09275bf43c64eb3d4e3f Reviewed-by: André Hartmann Reviewed-by: Eike Ziller --- src/plugins/updateinfo/updateinfoplugin.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 549efee091e..7fcd36111c5 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -55,6 +55,7 @@ namespace { static const char LastCheckDateKey[] = "LastCheckDate"; static const quint32 OneMinute = 60000; static const quint32 OneHour = 3600000; + static const char InstallUpdates[] = "UpdateInfo.InstallUpdates"; } using namespace Core; @@ -168,11 +169,20 @@ void UpdateInfoPlugin::checkForUpdatesFinished() stopCheckForUpdates(); if (!document.isNull() && document.firstChildElement().hasChildNodes()) { + // progress details are shown until user interaction for the "no updates" case, + // so we can show the "No updates found" text, but if we have updates we don't + // want to keep it around + if (d->m_progress) + d->m_progress->setKeepOnFinish(FutureProgress::HideOnFinish); emit newUpdatesAvailable(true); - if (QMessageBox::question(ICore::dialogParent(), tr("Qt Updater"), - tr("New updates are available. Do you want to start the update?")) - == QMessageBox::Yes) + Core::InfoBarEntry info(InstallUpdates, + tr("New updates are available. Do you want to start the update?")); + info.setCustomButtonInfo(tr("Start Update"), [this] { + Core::ICore::infoBar()->removeInfo(InstallUpdates); startUpdater(); + }); + Core::ICore::infoBar()->unsuppressInfo(InstallUpdates); + Core::ICore::infoBar()->addInfo(info); } else { emit newUpdatesAvailable(false); if (d->m_progress)