mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 13:25:52 +03:00
Settings: Add warning when switching update channel
This commit is contained in:
parent
c4987aa641
commit
60d3696ccd
1 changed files with 39 additions and 10 deletions
|
@ -45,6 +45,7 @@
|
|||
#include <QNetworkProxy>
|
||||
#include <QDir>
|
||||
#include <QScopedValueRollback>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <private/qzipwriter_p.h>
|
||||
|
||||
|
@ -294,18 +295,46 @@ void GeneralSettings::slotUpdateInfo()
|
|||
|
||||
void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
|
||||
{
|
||||
if (channel == ConfigFile().updateChannel())
|
||||
return;
|
||||
|
||||
auto msgBox = new QMessageBox(
|
||||
QMessageBox::Warning,
|
||||
tr("Change update channel?"),
|
||||
tr("The update channel determines which client updates will be offered "
|
||||
"for installation. The \"stable\" channel contains only upgrades that "
|
||||
"are considered reliable, while the versions in the \"beta\" channel "
|
||||
"may contain newer features and bugfixes, but have not yet been tested "
|
||||
"thoroughly."
|
||||
"\n\n"
|
||||
"Note that this selects only what pool upgrades are taken from, and that "
|
||||
"there are no downgrades: So going back from the beta channel to "
|
||||
"the stable channel usually cannot be done immediately and means waiting "
|
||||
"for a stable version that is newer than the currently installed beta "
|
||||
"version."),
|
||||
QMessageBox::NoButton,
|
||||
this);
|
||||
msgBox->addButton(tr("Change update channel"), QMessageBox::AcceptRole);
|
||||
msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
|
||||
connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox](int result) {
|
||||
msgBox->deleteLater();
|
||||
if (result == QMessageBox::AcceptRole) {
|
||||
ConfigFile().setUpdateChannel(channel);
|
||||
auto *updater = qobject_cast<OCUpdater *>(Updater::instance());
|
||||
if (updater) {
|
||||
if (auto updater = qobject_cast<OCUpdater *>(Updater::instance())) {
|
||||
updater->setUpdateUrl(Updater::updateUrl());
|
||||
updater->checkForUpdate();
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
else if (auto *updater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
|
||||
else if (auto updater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
|
||||
updater->setUpdateUrl(Updater::updateUrl());
|
||||
updater->checkForUpdate();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
_ui->updateChannel->setCurrentText(ConfigFile().updateChannel());
|
||||
}
|
||||
});
|
||||
msgBox->open();
|
||||
}
|
||||
|
||||
void GeneralSettings::slotUpdateCheckNow()
|
||||
|
|
Loading…
Reference in a new issue