From bde3083f478306221c6d1a8b4574aa29fb866b0a Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 25 Aug 2014 11:31:04 +0200 Subject: [PATCH] Updater now executes. --- src/gui/formupdate.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gui/formupdate.cpp b/src/gui/formupdate.cpp index 48a450e22..5b1efa84f 100755 --- a/src/gui/formupdate.cpp +++ b/src/gui/formupdate.cpp @@ -31,6 +31,10 @@ #include #include +#if defined(Q_OS_WIN) +#include +#endif + FormUpdate::FormUpdate(QWidget *parent) : QDialog(parent), m_downloader(NULL), m_readyToInstall(false), m_ui(new Ui::FormUpdate) { @@ -62,7 +66,7 @@ bool FormUpdate::isUpdateForThisSystem() const { } bool FormUpdate::isSelfUpdateSupported() const { -#if defined(Q_OS_WIN) || defined(Q_OS_OS2) +#if defined(Q_OS_WIN32) return true; #else return false; @@ -184,6 +188,7 @@ void FormUpdate::updateCompleted(QNetworkReply::NetworkError status, QByteArray } void FormUpdate::startUpdate() { +#if defined(Q_OS_WIN) QString url_file; bool update_for_this_system = isUpdateForThisSystem(); @@ -202,7 +207,14 @@ void FormUpdate::startUpdate() { qDebug("Preparing to launch external installer '%s'.", qPrintable(QDir::toNativeSeparators(m_updateFilePath))); - if (!QProcess::startDetached(m_updateFilePath)) { + long exec_result = (long) ShellExecute(NULL, + NULL, + reinterpret_cast(QDir::toNativeSeparators(m_updateFilePath).utf16()), + NULL, + NULL, + SW_NORMAL); + + if (exec_result <= 32) { qDebug("External updater was not launched due to error."); qApp->showGuiMessage(tr("Cannot update application"), @@ -242,4 +254,5 @@ void FormUpdate::startUpdate() { QSystemTrayIcon::Warning, this); } } +#endif }