From d86e60c45ae26bd3451c6ddadc05b2c88a745138 Mon Sep 17 00:00:00 2001 From: elecpower Date: Mon, 25 Jul 2022 07:56:27 +1000 Subject: [PATCH] Offer to restart Companion after install on linux --- companion/src/updates/updatecompanion.cpp | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/companion/src/updates/updatecompanion.cpp b/companion/src/updates/updatecompanion.cpp index 2ddf3271c..16a316d28 100644 --- a/companion/src/updates/updatecompanion.cpp +++ b/companion/src/updates/updatecompanion.cpp @@ -69,15 +69,9 @@ UpdateCompanion::UpdateCompanion(QWidget * parent) : ap.flags = dfltParams->data.flags; } -#ifndef OS_SUPPORTED_INSTALLER -bool UpdateCompanion::asyncInstall() -{ - QMessageBox::warning(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_MSG); - return true; -} -#else bool UpdateCompanion::asyncInstall() { +#ifdef OS_SUPPORTED_INSTALLER //reportProgress(tr("Run application installer: %1").arg(g.runAppInstaller() ? tr("true") : tr("false")), QtDebugMsg); if (!g.runAppInstaller()) @@ -139,8 +133,13 @@ bool UpdateCompanion::asyncInstall() return false; } - return true; + if (QMessageBox::question(parentWidget(), CPN_STR_APP_NAME, "Restart Companion?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + QProcess::startDetached(fileName); + qApp->exit(); + } + #else + int ret = QMessageBox::question(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_QUESTION, QMessageBox::Yes | QMessageBox::No); if (ret == QMessageBox::Yes) { @@ -148,10 +147,15 @@ bool UpdateCompanion::asyncInstall() qApp->exit(); } +#endif // defined(__linux__) || defined(__linux) + return true; -#endif + +#else + QMessageBox::warning(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_MSG); + return true; +#endif // OS_SUPPORTED_INSTALLER } -#endif const QString UpdateCompanion::currentRelease() {