#include "configfile.h"
#include "owncloudsetupwizard.h"
#include "accountmanager.h"
+#include "guiutility.h"
#if defined(BUILD_UPDATER)
#include "updater/updater.h"
connect(_ui->updateButton, &QAbstractButton::clicked, this, &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection);
connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleAutoUpdateCheck);
- QString status = ocupdater->statusString();
+ QString status = ocupdater->statusString(OCUpdater::UpdateStatusStringFormat::Html);
Theme::replaceLinkColorStringBackgroundAware(status);
+
+ _ui->updateStateLabel->setOpenExternalLinks(false);
+ connect(_ui->updateStateLabel, &QLabel::linkActivated, this, [](const QString &link) {
+ Utility::openBrowser(QUrl(link));
+ });
_ui->updateStateLabel->setText(status);
_ui->restartButton->setVisible(ocupdater->downloadState() == OCUpdater::DownloadComplete);
}
}
-QString OCUpdater::statusString() const
+QString OCUpdater::statusString(UpdateStatusStringFormat format) const
{
QString updateVersion = _updateInfo.versionString();
return tr("Downloading %1. Please wait …").arg(updateVersion);
case DownloadComplete:
return tr("%1 available. Restart application to start the update.").arg(updateVersion);
- case DownloadFailed:
+ case DownloadFailed: {
+ if (format == UpdateStatusStringFormat::Html) {
+ return tr("Could not download update. Please open <a href='%1'>%1</a> to download the update manually.").arg(_updateInfo.web());
+ }
return tr("Could not download update. Please open %1 to download the update manually.").arg(_updateInfo.web());
+ }
case DownloadTimedOut:
return tr("Could not check for new updates.");
- case UpdateOnlyAvailableThroughSystem:
+ case UpdateOnlyAvailableThroughSystem: {
+ if (format == UpdateStatusStringFormat::Html) {
+ return tr("New %1 is available. Please open <a href='%2'>%2</a> to download the update.").arg(updateVersion, _updateInfo.web());
+ }
return tr("New %1 is available. Please open %2 to download the update.").arg(updateVersion, _updateInfo.web());
+ }
case CheckingServer:
return tr("Checking update server …");
case Unknown:
DownloadFailed,
DownloadTimedOut,
UpdateOnlyAvailableThroughSystem };
+
+ enum UpdateStatusStringFormat {
+ PlainText,
+ Html,
+ };
explicit OCUpdater(const QUrl &url);
void setUpdateUrl(const QUrl &url);
void checkForUpdate() override;
- QString statusString() const;
+ QString statusString(UpdateStatusStringFormat format = PlainText) const;
int downloadState() const;
void setDownloadState(DownloadState state);