From: Claudio Cambra Date: Thu, 27 Oct 2022 12:30:33 +0000 (+0200) Subject: Fix macOS autoupdater settings X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~181^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=16532375da5ecb7676d1502cde7a2316e261425b;p=nextcloud-desktop.git Fix macOS autoupdater settings Signed-off-by: Claudio Cambra --- diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 8834c3567..6a5164a26 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -262,20 +262,27 @@ void GeneralSettings::loadMiscSettings() #if defined(BUILD_UPDATER) void GeneralSettings::slotUpdateInfo() { - if (ConfigFile().skipUpdateCheck() || !Updater::instance()) { + const auto updater = Updater::instance(); + if (ConfigFile().skipUpdateCheck() || !updater) { // updater disabled on compile _ui->updatesGroupBox->setVisible(false); return; } + if (updater) { + connect(_ui->updateButton, &QAbstractButton::clicked, this, + &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection); + connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this, + &GeneralSettings::slotToggleAutoUpdateCheck, Qt::UniqueConnection); + _ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck()); + } + // Note: the sparkle-updater is not an OCUpdater - auto *ocupdater = qobject_cast(Updater::instance()); + auto *ocupdater = qobject_cast(updater); if (ocupdater) { connect(ocupdater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection); connect(_ui->restartButton, &QAbstractButton::clicked, ocupdater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection); connect(_ui->restartButton, &QAbstractButton::clicked, qApp, &QApplication::quit, Qt::UniqueConnection); - connect(_ui->updateButton, &QAbstractButton::clicked, this, &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection); - connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleAutoUpdateCheck); QString status = ocupdater->statusString(OCUpdater::UpdateStatusStringFormat::Html); Theme::replaceLinkColorStringBackgroundAware(status); @@ -291,14 +298,11 @@ void GeneralSettings::slotUpdateInfo() _ui->updateButton->setEnabled(ocupdater->downloadState() != OCUpdater::CheckingServer && ocupdater->downloadState() != OCUpdater::Downloading && ocupdater->downloadState() != OCUpdater::DownloadComplete); - - _ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck()); } #if defined(Q_OS_MAC) && defined(HAVE_SPARKLE) - else if (auto sparkleUpdater = qobject_cast(Updater::instance())) { + else if (auto sparkleUpdater = qobject_cast(updater)) { _ui->updateStateLabel->setText(sparkleUpdater->statusString()); _ui->restartButton->setVisible(false); - connect(_ui->updateButton, &QAbstractButton::clicked, this, &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection); } #endif