mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
auto-updater(Windows): fix failed connection
Now that the settings are not loaded on start, the updatemanager signals need to be moved to the main window component. Gitlab: #1056 Change-Id: I17e750ef1417e8bfca7d06976f14a1d75492cec5
This commit is contained in:
parent
c454a85c25
commit
8bdce956bf
4 changed files with 82 additions and 53 deletions
|
@ -260,6 +260,72 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
function presentUpdateInfoDialog(infoText) {
|
||||
viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"commoncomponents/SimpleMessageDialog.qml",
|
||||
{
|
||||
title: JamiStrings.updateDialogTitle,
|
||||
infoText: infoText,
|
||||
buttonTitles: [JamiStrings.optionOk],
|
||||
buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue],
|
||||
buttonCallBacks: []
|
||||
})
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: UpdateManager
|
||||
|
||||
function onUpdateDownloadStarted() {
|
||||
viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"settingsview/components/UpdateDownloadDialog.qml",
|
||||
{title: JamiStrings.updateDialogTitle})
|
||||
}
|
||||
|
||||
function onUpdateCheckReplyReceived(ok, found) {
|
||||
if (!ok) {
|
||||
presentUpdateInfoDialog(JamiStrings.updateCheckError)
|
||||
return
|
||||
}
|
||||
if (!found) {
|
||||
presentUpdateInfoDialog(JamiStrings.updateNotFound)
|
||||
} else {
|
||||
viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"commoncomponents/SimpleMessageDialog.qml",
|
||||
{
|
||||
title: JamiStrings.updateDialogTitle,
|
||||
infoText: JamiStrings.updateFound,
|
||||
buttonTitles: [JamiStrings.optionUpgrade, JamiStrings.optionLater],
|
||||
buttonStyles: [
|
||||
SimpleMessageDialog.ButtonStyle.TintedBlue,
|
||||
SimpleMessageDialog.ButtonStyle.TintedBlue
|
||||
],
|
||||
buttonCallBacks: [function() {UpdateManager.applyUpdates()}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function onUpdateErrorOccurred(error) {
|
||||
presentUpdateInfoDialog((function () {
|
||||
switch(error){
|
||||
case NetWorkManager.ACCESS_DENIED:
|
||||
return JamiStrings.genericError
|
||||
case NetWorkManager.DISCONNECTED:
|
||||
return JamiStrings.networkDisconnected
|
||||
case NetWorkManager.NETWORK_ERROR:
|
||||
return JamiStrings.updateNetworkError
|
||||
case NetWorkManager.SSL_ERROR:
|
||||
return JamiStrings.updateSSLError
|
||||
case NetWorkManager.CANCELED:
|
||||
return JamiStrings.updateDownloadCanceled
|
||||
default: return {}
|
||||
}
|
||||
})())
|
||||
}
|
||||
}
|
||||
|
||||
onClosing: root.close()
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
|
@ -133,54 +133,19 @@ SettingsPageBase {
|
|||
toolTipText: JamiStrings.betaInstall
|
||||
text: JamiStrings.betaInstall
|
||||
|
||||
onClicked: presentConfirmInstallDialog(JamiStrings.confirmBeta, true)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: UpdateManager
|
||||
|
||||
function errorToString(error) {
|
||||
switch(error){
|
||||
case NetWorkManager.ACCESS_DENIED:
|
||||
return JamiStrings.genericError
|
||||
case NetWorkManager.DISCONNECTED:
|
||||
return JamiStrings.networkDisconnected
|
||||
case NetWorkManager.NETWORK_ERROR:
|
||||
return JamiStrings.updateNetworkError
|
||||
case NetWorkManager.SSL_ERROR:
|
||||
return JamiStrings.updateSSLError
|
||||
case NetWorkManager.CANCELED:
|
||||
return JamiStrings.updateDownloadCanceled
|
||||
default: return {}
|
||||
}
|
||||
}
|
||||
|
||||
function onUpdateDownloadStarted() {
|
||||
viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"settingsview/components/UpdateDownloadDialog.qml",
|
||||
{title: JamiStrings.updateDialogTitle})
|
||||
}
|
||||
|
||||
function onUpdateCheckReplyReceived(ok, found) {
|
||||
if (!ok) {
|
||||
presentInfoDialog(JamiStrings.updateCheckError)
|
||||
return
|
||||
}
|
||||
if (!found) {
|
||||
presentInfoDialog(JamiStrings.updateNotFound)
|
||||
} else {
|
||||
presentConfirmInstallDialog(JamiStrings.updateFound, false)
|
||||
}
|
||||
}
|
||||
|
||||
function onUpdateDownloadErrorOccurred(error) {
|
||||
presentInfoDialog(errorToString(error))
|
||||
}
|
||||
|
||||
function onUpdateCheckErrorOccurred(error) {
|
||||
presentInfoDialog(errorToString(error))
|
||||
}
|
||||
onClicked: viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"commoncomponents/SimpleMessageDialog.qml",
|
||||
{
|
||||
title: JamiStrings.updateDialogTitle,
|
||||
infoText: JamiStrings.confirmBeta,
|
||||
buttonTitles: [JamiStrings.optionUpgrade, JamiStrings.optionLater],
|
||||
buttonStyles: [
|
||||
SimpleMessageDialog.ButtonStyle.TintedBlue,
|
||||
SimpleMessageDialog.ButtonStyle.TintedBlue
|
||||
],
|
||||
buttonCallBacks: [function() {UpdateManager.applyUpdates(true)}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Savoir-faire Linux Inc.
|
||||
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -63,7 +62,7 @@ struct UpdateManager::Impl : public QObject
|
|||
connect(&parent_,
|
||||
&NetWorkManager::errorOccured,
|
||||
&parent_,
|
||||
&UpdateManager::updateCheckErrorOccurred);
|
||||
&UpdateManager::updateErrorOccurred);
|
||||
|
||||
cleanUpdateFiles();
|
||||
QUrl versionUrl {isBeta ? QUrl::fromUserInput(baseUrlString_ + betaVersionSubUrl)
|
||||
|
@ -95,7 +94,7 @@ struct UpdateManager::Impl : public QObject
|
|||
connect(&parent_,
|
||||
&NetWorkManager::errorOccured,
|
||||
&parent_,
|
||||
&UpdateManager::updateDownloadErrorOccurred);
|
||||
&UpdateManager::updateErrorOccurred);
|
||||
connect(&parent_, &NetWorkManager::statusChanged, this, [this](GetStatus status) {
|
||||
switch (status) {
|
||||
case GetStatus::STARTED:
|
||||
|
|
|
@ -46,10 +46,9 @@ public:
|
|||
|
||||
Q_SIGNALS:
|
||||
void updateCheckReplyReceived(bool ok, bool found = false);
|
||||
void updateCheckErrorOccurred(GetError error);
|
||||
void updateErrorOccurred(const NetWorkManager::GetError& error);
|
||||
void updateDownloadStarted();
|
||||
void updateDownloadProgressChanged(qint64 bytesRead, qint64 totalBytes);
|
||||
void updateDownloadErrorOccurred(GetError error);
|
||||
void updateDownloadFinished();
|
||||
void appCloseRequested();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue