diff --git a/src/app/MainApplicationWindow.qml b/src/app/MainApplicationWindow.qml index 31fe17bd89af114d98491ec70c0f8822b7631c14..55776ccac3f4e9544b83e886c67020051ed2e49d 100644 --- a/src/app/MainApplicationWindow.qml +++ b/src/app/MainApplicationWindow.qml @@ -335,10 +335,6 @@ ApplicationWindow { var errorStr = translateErrorToString(error); presentUpdateInfoDialog(errorStr); } - - function onInstallErrorOccurred(errorMsg) { - presentUpdateInfoDialog(errorMsg); - } } onClosing: root.close() diff --git a/src/app/appversionmanager.cpp b/src/app/appversionmanager.cpp index ba6cd6730ccf76c9e0703a38996730e8644bac75..8284765eca0e677a65ada7cf25501c4a0627be02 100644 --- a/src/app/appversionmanager.cpp +++ b/src/app/appversionmanager.cpp @@ -44,7 +44,6 @@ struct AppVersionManager::Impl : public QObject , parent_(parent) , lrcInstance_(instance) , baseUrlString_(url.isEmpty() ? downloadUrl : url) - , tempPath_(QDir::tempPath()) , updateTimer_(new QTimer(this)) { connect(updateTimer_, &QTimer::timeout, this, [this] { @@ -105,41 +104,20 @@ struct AppVersionManager::Impl : public QObject parent_.replyId_ = parent_.downloadFile( downloadUrl, lastDownloadReplyId, - [this, downloadUrl](bool success, const QString& errorMessage) { + [downloadUrl](bool success, const QString& errorMessage) { Q_UNUSED(success) Q_UNUSED(errorMessage) QProcess process; - auto basePath = tempPath_ + QDir::separator(); + auto basePath = QDir::tempPath() + QDir::separator(); auto msiPath = QDir::toNativeSeparators(basePath + downloadUrl.fileName()); auto logPath = QDir::toNativeSeparators(basePath + "jami_x64_install.log"); - connect(&process, &QProcess::errorOccurred, this, [&](QProcess::ProcessError error) { - QString errorMsg; - if (error == QProcess::ProcessError::Timedout) { - errorMsg = tr("The installer process has timed out."); - } else { - errorMsg = process.readAllStandardError(); - if (errorMsg.isEmpty()) - errorMsg = tr("The installer process has failed."); - } - Q_EMIT parent_.installErrorOccurred(errorMsg); - }); - connect(&process, - &QProcess::finished, - this, - [&](int exitCode, QProcess::ExitStatus exitStatus) { - if (exitStatus != QProcess::ExitStatus::NormalExit || exitCode != 0) { - auto errorMsg = process.readAllStandardOutput(); - Q_EMIT parent_.installErrorOccurred(errorMsg); - } - }); - process.start("msiexec", - QStringList() << "/i" << msiPath << "/passive" - << "/norestart" - << "WIXNONUILAUNCH=1" - << "/L*V" << logPath); - process.waitForFinished(); + process.startDetached("msiexec", + QStringList() << "/i" << msiPath << "/passive" + << "/norestart" + << "WIXNONUILAUNCH=1" + << "/L*V" << logPath); }, - tempPath_); + QDir::tempPath()); }; void cancelUpdate() @@ -179,7 +157,6 @@ struct AppVersionManager::Impl : public QObject LRCInstance* lrcInstance_ {nullptr}; QString baseUrlString_; - QString tempPath_; QTimer* updateTimer_; }; diff --git a/src/app/appversionmanager.h b/src/app/appversionmanager.h index e2a2539ed610d556a33dae61dcaafb06a960488c..84e0095c524cf44991c64c5e75a5e0a4c473944f 100644 --- a/src/app/appversionmanager.h +++ b/src/app/appversionmanager.h @@ -48,7 +48,6 @@ Q_SIGNALS: void updateCheckReplyReceived(bool ok, bool found = false); void updateDownloadProgressChanged(qint64 bytesRead, qint64 totalBytes); void networkErrorOccurred(const NetworkManager::GetError& error); - void installErrorOccurred(const QString& errorMsg); private: int replyId_; diff --git a/src/app/networkmanager.cpp b/src/app/networkmanager.cpp index dc31bd21b62d0aa8cdab85ef6cbf55ae1def7602..c66284b5f9f22c9d6e35bc213e2135993ae4de27 100644 --- a/src/app/networkmanager.cpp +++ b/src/app/networkmanager.cpp @@ -155,7 +155,7 @@ NetworkManager::downloadFile(const QUrl& url, const QFileInfo fileInfo(url.path()); const QString fileName = fileInfo.fileName(); auto& file = files_[uuid]; - file = new QFile(filePath + fileName + extension); + file = new QFile(filePath + QDir::separator() + fileName + extension); if (!file->open(QIODevice::WriteOnly)) { Q_EMIT errorOccurred(GetError::ACCESS_DENIED); files_.remove(uuid); diff --git a/src/app/networkmanager.h b/src/app/networkmanager.h index dc8b27333f61041a7863d61d21d3a998e0c34144..3433546fd28d1a0273a557975c3531ef1c71dd7d 100644 --- a/src/app/networkmanager.h +++ b/src/app/networkmanager.h @@ -23,6 +23,7 @@ #include <QMap> #include <QString> #include <QNetworkReply> + #include <random> class QNetworkAccessManager; diff --git a/src/app/pluginadapter.cpp b/src/app/pluginadapter.cpp index ccc23df89d85175a72421eacaa7b5b08435e398d..f5bd1ab37b4337fc9f65877868e749326a721c42 100644 --- a/src/app/pluginadapter.cpp +++ b/src/app/pluginadapter.cpp @@ -44,8 +44,6 @@ PluginAdapter::PluginAdapter(LRCInstance* instance, , pluginListModel_(new PluginListModel(instance, this)) , lrcInstance_(instance) , settingsManager_(settingsManager) - , tempPath_(QDir::tempPath()) - { QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginStoreListModel_, "PluginStoreListModel"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginListModel_, "PluginListModel") diff --git a/src/app/pluginadapter.h b/src/app/pluginadapter.h index f79d35384d9f92818134dccd70cdcdc34dd0aee6..afd02c263a59092d5b2df6b12c20dc0884edee1d 100644 --- a/src/app/pluginadapter.h +++ b/src/app/pluginadapter.h @@ -81,6 +81,5 @@ private: LRCInstance* lrcInstance_; AppSettingsManager* settingsManager_; std::mutex mtx_; - QString tempPath_; QString baseUrl_; }; diff --git a/src/app/pluginversionmanager.cpp b/src/app/pluginversionmanager.cpp index e6a177e7f34a83572bbbdfe7f666cabda7caa4c4..a08518fc39e6cb45f1f9ec6fb3c5232584bc156f 100644 --- a/src/app/pluginversionmanager.cpp +++ b/src/app/pluginversionmanager.cpp @@ -35,7 +35,6 @@ public: , parent_(parent) , settingsManager_(new AppSettingsManager(this)) , lrcInstance_(instance) - , tempPath_(QDir::tempPath()) , updateTimer_(new QTimer(this)) { connect(updateTimer_, &QTimer::timeout, this, [this] { checkForUpdates(); }); @@ -133,9 +132,9 @@ public: return; } QThreadPool::globalInstance()->start([this, pluginId] { - auto res = lrcInstance_->pluginModel().installPlugin(QDir(tempPath_).filePath( - pluginId + ".jpl"), - true); + auto res = lrcInstance_->pluginModel() + .installPlugin(QDir(QDir::tempPath()).filePath(pluginId + ".jpl"), + true); if (res) { parent_.versionStatusChanged(pluginId, PluginStatus::Role::INSTALLED); } else { @@ -144,7 +143,7 @@ public: }); parent_.versionStatusChanged(pluginId, PluginStatus::Role::INSTALLING); }, - tempPath_ + '/'); + QDir::tempPath()); Q_EMIT parent_.versionStatusChanged(pluginId, PluginStatus::Role::DOWNLOADING); } @@ -161,7 +160,6 @@ public: PluginVersionManager& parent_; AppSettingsManager* settingsManager_ {nullptr}; LRCInstance* lrcInstance_ {nullptr}; - QString tempPath_; QTimer* updateTimer_; };