Skip to content
Snippets Groups Projects
Commit 51cfef2f authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

updatemanager: use msiexec to launch update installer

Change-Id: I605cc425b600b08dac809f0d38d366279140895d
parent 7611cb61
No related branches found
No related tags found
No related merge requests found
...@@ -138,7 +138,6 @@ Q_SIGNALS: ...@@ -138,7 +138,6 @@ Q_SIGNALS:
void selectedConvUidChanged(); void selectedConvUidChanged();
void restoreAppRequested(); void restoreAppRequested();
void notificationClicked(); void notificationClicked();
void quitEngineRequested();
void conversationUpdated(const QString& convId, const QString& accountId); void conversationUpdated(const QString& convId, const QString& accountId);
void draftSaved(const QString& convId); void draftSaved(const QString& convId);
void base64SwarmAvatarChanged(); void base64SwarmAvatarChanged();
......
...@@ -177,13 +177,6 @@ MainApplication::init() ...@@ -177,13 +177,6 @@ MainApplication::init()
screenInfo_.setCurrentFocusWindow(this->focusWindow()); screenInfo_.setCurrentFocusWindow(this->focusWindow());
}); });
QObject::connect(
lrcInstance_.get(),
&LRCInstance::quitEngineRequested,
this,
[this] { Q_EMIT engine_->quit(); },
Qt::DirectConnection);
auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath); auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath);
auto screenshotPath = settingsManager_->getValue(Settings::Key::ScreenshotPath); auto screenshotPath = settingsManager_->getValue(Settings::Key::ScreenshotPath);
auto allowTransferFromTrusted = settingsManager_->getValue(Settings::Key::AutoAcceptFiles) auto allowTransferFromTrusted = settingsManager_->getValue(Settings::Key::AutoAcceptFiles)
......
...@@ -36,12 +36,12 @@ SimpleMessageDialog { ...@@ -36,12 +36,12 @@ SimpleMessageDialog {
Connections { Connections {
target: UpdateManager target: UpdateManager
function onDownloadProgressChanged(bytesRead, totalBytes) { function onUpdateErrorOccurred(error) {
downloadDialog.setDownloadProgress(bytesRead, totalBytes); downloadDialog.close();
} }
function onUpdateDownloadErrorOccurred(error) { function onDownloadProgressChanged(bytesRead, totalBytes) {
downloadDialog.close(); downloadDialog.setDownloadProgress(bytesRead, totalBytes);
} }
function onUpdateDownloadFinished() { function onUpdateDownloadFinished() {
......
...@@ -95,12 +95,12 @@ struct UpdateManager::Impl : public QObject ...@@ -95,12 +95,12 @@ struct UpdateManager::Impl : public QObject
&NetworkManager::errorOccured, &NetworkManager::errorOccured,
&parent_, &parent_,
&UpdateManager::updateErrorOccurred); &UpdateManager::updateErrorOccurred);
connect(&parent_, &UpdateManager::statusChanged, this, [this](GetStatus status) { connect(&parent_, &UpdateManager::statusChanged, this, [this](Status status) {
switch (status) { switch (status) {
case GetStatus::STARTED: case Status::STARTED:
Q_EMIT parent_.updateDownloadStarted(); Q_EMIT parent_.updateDownloadStarted();
break; break;
case GetStatus::FINISHED: case Status::FINISHED:
Q_EMIT parent_.updateDownloadFinished(); Q_EMIT parent_.updateDownloadFinished();
break; break;
default: default:
...@@ -116,14 +116,15 @@ struct UpdateManager::Impl : public QObject ...@@ -116,14 +116,15 @@ struct UpdateManager::Impl : public QObject
[this, downloadUrl](bool success, const QString& errorMessage) { [this, downloadUrl](bool success, const QString& errorMessage) {
Q_UNUSED(success) Q_UNUSED(success)
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
lrcInstance_->finish();
Q_EMIT lrcInstance_->quitEngineRequested();
auto args = QString(" /passive /norestart WIXNONUILAUNCH=1");
QProcess process; QProcess process;
process.start("powershell ", auto basePath = tempPath_ + QDir::separator();
QStringList() << tempPath_ + "\\" + downloadUrl.fileName() << "/L*V" auto msiPath = QDir::toNativeSeparators(basePath + downloadUrl.fileName());
<< tempPath_ + "\\jami_x64_install.log" + args); auto logPath = QDir::toNativeSeparators(basePath + "jami_x64_install.log");
process.waitForFinished(); process.startDetached("msiexec",
QStringList() << "/i" << msiPath << "/passive"
<< "/norestart"
<< "WIXNONUILAUNCH=1"
<< "/L*V" << logPath);
}, },
tempPath_); tempPath_);
}; };
...@@ -313,10 +314,10 @@ UpdateManager::downloadFile(const QUrl& url, ...@@ -313,10 +314,10 @@ UpdateManager::downloadFile(const QUrl& url,
resetDownload(); resetDownload();
} }
onDoneCallback(success, errorMessage); onDoneCallback(success, errorMessage);
Q_EMIT statusChanged(GetStatus::FINISHED); Q_EMIT statusChanged(Status::FINISHED);
}); });
Q_EMIT statusChanged(GetStatus::STARTED); Q_EMIT statusChanged(Status::STARTED);
} }
void void
......
...@@ -36,8 +36,8 @@ public: ...@@ -36,8 +36,8 @@ public:
QObject* parent = nullptr); QObject* parent = nullptr);
~UpdateManager(); ~UpdateManager();
enum GetStatus { STARTED, FINISHED }; enum Status { STARTED, FINISHED };
Q_ENUM(GetStatus) Q_ENUM(Status)
Q_INVOKABLE void checkForUpdates(bool quiet = false); Q_INVOKABLE void checkForUpdates(bool quiet = false);
Q_INVOKABLE void applyUpdates(bool beta = false); Q_INVOKABLE void applyUpdates(bool beta = false);
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
const QString& filePath); const QString& filePath);
Q_SIGNALS: Q_SIGNALS:
void statusChanged(GetStatus status); void statusChanged(UpdateManager::Status status);
void downloadProgressChanged(qint64 bytesRead, qint64 totalBytes); void downloadProgressChanged(qint64 bytesRead, qint64 totalBytes);
void updateCheckReplyReceived(bool ok, bool found = false); void updateCheckReplyReceived(bool ok, bool found = false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment