2013-07-04 21:59:40 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Daniel Molkentin <danimo@owncloud.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
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2013-07-04 21:59:40 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "generalsettings.h"
|
|
|
|
#include "ui_generalsettings.h"
|
|
|
|
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "theme.h"
|
2014-11-10 01:25:57 +03:00
|
|
|
#include "configfile.h"
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "application.h"
|
2014-11-10 01:25:57 +03:00
|
|
|
#include "configfile.h"
|
2015-03-27 13:46:03 +03:00
|
|
|
#include "owncloudsetupwizard.h"
|
2015-09-03 07:14:49 +03:00
|
|
|
#include "accountmanager.h"
|
2014-01-29 13:38:12 +04:00
|
|
|
|
2020-03-09 03:48:07 +03:00
|
|
|
#if defined(BUILD_UPDATER)
|
2014-01-29 13:38:12 +04:00
|
|
|
#include "updater/updater.h"
|
|
|
|
#include "updater/ocupdater.h"
|
2018-04-27 10:10:38 +03:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
// FIXME We should unify those, but Sparkle does everything behind the scene transparently
|
|
|
|
#include "updater/sparkleupdater.h"
|
|
|
|
#endif
|
2020-03-09 03:48:07 +03:00
|
|
|
#endif
|
|
|
|
|
2015-03-27 13:46:03 +03:00
|
|
|
#include "ignorelisteditor.h"
|
2019-09-08 18:33:34 +03:00
|
|
|
#include "common/utility.h"
|
2020-10-05 20:45:40 +03:00
|
|
|
#include "logger.h"
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2014-08-29 19:07:31 +04:00
|
|
|
#include "config.h"
|
|
|
|
|
2018-08-02 09:36:03 +03:00
|
|
|
#include "legalnotice.h"
|
|
|
|
|
2020-10-05 20:45:40 +03:00
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMessageBox>
|
2013-07-04 21:59:40 +04:00
|
|
|
#include <QNetworkProxy>
|
2013-08-14 18:35:36 +04:00
|
|
|
#include <QDir>
|
2017-01-26 12:00:19 +03:00
|
|
|
#include <QScopedValueRollback>
|
2018-05-18 15:45:29 +03:00
|
|
|
#include <QMessageBox>
|
2019-09-08 19:42:40 +03:00
|
|
|
|
2020-10-05 20:45:40 +03:00
|
|
|
#include <private/qzipwriter_p.h>
|
|
|
|
|
2019-09-08 20:46:08 +03:00
|
|
|
#define QTLEGACY (QT_VERSION < QT_VERSION_CHECK(5,9,0))
|
|
|
|
|
2019-09-08 20:22:40 +03:00
|
|
|
#if !(QTLEGACY)
|
2019-09-08 16:40:49 +03:00
|
|
|
#include <QOperatingSystemVersion>
|
2019-09-08 19:42:40 +03:00
|
|
|
#endif
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2020-10-05 20:45:40 +03:00
|
|
|
namespace {
|
|
|
|
struct ZipEntry {
|
|
|
|
QString localFilename;
|
|
|
|
QString zipFilename;
|
|
|
|
};
|
|
|
|
|
|
|
|
ZipEntry fileInfoToZipEntry(const QFileInfo &info)
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
info.absoluteFilePath(),
|
|
|
|
info.fileName()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
ZipEntry fileInfoToLogZipEntry(const QFileInfo &info)
|
|
|
|
{
|
|
|
|
auto entry = fileInfoToZipEntry(info);
|
|
|
|
entry.zipFilename.prepend(QStringLiteral("logs/"));
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZipEntry syncFolderToZipEntry(OCC::Folder *f)
|
|
|
|
{
|
|
|
|
const auto journalPath = f->journalDb()->databaseFilePath();
|
|
|
|
const auto journalInfo = QFileInfo(journalPath);
|
|
|
|
return fileInfoToZipEntry(journalInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<ZipEntry> createFileList()
|
|
|
|
{
|
|
|
|
auto list = QVector<ZipEntry>();
|
|
|
|
OCC::ConfigFile cfg;
|
|
|
|
|
|
|
|
list.append(fileInfoToZipEntry(QFileInfo(cfg.configFile())));
|
|
|
|
|
|
|
|
const auto logger = OCC::Logger::instance();
|
|
|
|
|
|
|
|
if (!logger->logDir().isEmpty()) {
|
|
|
|
list.append({QString(), QStringLiteral("logs")});
|
|
|
|
|
|
|
|
QDir dir(logger->logDir());
|
|
|
|
const auto infoList = dir.entryInfoList(QDir::Files);
|
|
|
|
std::transform(std::cbegin(infoList), std::cend(infoList),
|
|
|
|
std::back_inserter(list),
|
|
|
|
fileInfoToLogZipEntry);
|
|
|
|
} else if (!logger->logFile().isEmpty()) {
|
|
|
|
list.append(fileInfoToZipEntry(QFileInfo(logger->logFile())));
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto folders = OCC::FolderMan::instance()->map().values();
|
|
|
|
std::transform(std::cbegin(folders), std::cend(folders),
|
|
|
|
std::back_inserter(list),
|
|
|
|
syncFolderToZipEntry);
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
void createDebugArchive(const QString &filename)
|
|
|
|
{
|
|
|
|
const auto entries = createFileList();
|
|
|
|
|
|
|
|
QZipWriter zip(filename);
|
|
|
|
for (const auto &entry : entries) {
|
|
|
|
if (entry.localFilename.isEmpty()) {
|
|
|
|
zip.addDirectory(entry.zipFilename);
|
|
|
|
} else {
|
|
|
|
QFile file(entry.localFilename);
|
|
|
|
if (!file.open(QFile::ReadOnly)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
zip.addFile(entry.zipFilename, &file);
|
|
|
|
}
|
|
|
|
}
|
2020-10-05 20:45:47 +03:00
|
|
|
|
|
|
|
zip.addFile("__nextcloud_client_parameters.txt", QCoreApplication::arguments().join(' ').toUtf8());
|
2020-10-05 22:56:42 +03:00
|
|
|
|
|
|
|
const auto buildInfo = QString(OCC::Theme::instance()->about() + "\n\n" + OCC::Theme::instance()->aboutDetails());
|
|
|
|
zip.addFile("__nextcloud_client_buildinfo.txt", buildInfo.toUtf8());
|
2020-10-05 20:45:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2017-05-17 11:55:42 +03:00
|
|
|
GeneralSettings::GeneralSettings(QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, _ui(new Ui::GeneralSettings)
|
2013-07-04 21:59:40 +04:00
|
|
|
{
|
|
|
|
_ui->setupUi(this);
|
|
|
|
|
2018-02-15 22:21:08 +03:00
|
|
|
connect(_ui->serverNotificationsCheckBox, &QAbstractButton::toggled,
|
|
|
|
this, &GeneralSettings::slotToggleOptionalServerNotifications);
|
|
|
|
_ui->serverNotificationsCheckBox->setToolTip(tr("Server notifications that require attention."));
|
|
|
|
|
2017-10-19 17:37:51 +03:00
|
|
|
connect(_ui->showInExplorerNavigationPaneCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotShowInExplorerNavigationPane);
|
2013-07-05 03:01:23 +04:00
|
|
|
|
2019-12-09 23:00:34 +03:00
|
|
|
// Rename 'Explorer' appropriately on non-Windows
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
QString txt = _ui->showInExplorerNavigationPaneCheckBox->text();
|
|
|
|
txt.replace(QString::fromLatin1("Explorer"), QString::fromLatin1("Finder"));
|
|
|
|
_ui->showInExplorerNavigationPaneCheckBox->setText(txt);
|
|
|
|
#endif
|
|
|
|
|
2018-10-16 20:18:01 +03:00
|
|
|
if(Utility::hasSystemLaunchOnStartup(Theme::instance()->appName())) {
|
|
|
|
_ui->autostartCheckBox->setChecked(true);
|
|
|
|
_ui->autostartCheckBox->setDisabled(true);
|
|
|
|
_ui->autostartCheckBox->setToolTip(tr("You cannot disable autostart because system-wide autostart is enabled."));
|
|
|
|
} else {
|
2020-12-15 17:02:33 +03:00
|
|
|
const bool hasAutoStart = Utility::hasLaunchOnStartup(Theme::instance()->appName());
|
|
|
|
// make sure the binary location is correctly set
|
|
|
|
slotToggleLaunchOnStartup(hasAutoStart);
|
|
|
|
_ui->autostartCheckBox->setChecked(hasAutoStart);
|
2018-10-16 20:18:01 +03:00
|
|
|
connect(_ui->autostartCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleLaunchOnStartup);
|
|
|
|
}
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
// setup about section
|
|
|
|
QString about = Theme::instance()->about();
|
2018-08-02 09:36:03 +03:00
|
|
|
_ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
|
|
|
_ui->aboutLabel->setText(about);
|
|
|
|
_ui->aboutLabel->setOpenExternalLinks(true);
|
|
|
|
|
|
|
|
// About legal notice
|
|
|
|
connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice);
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
loadMiscSettings();
|
2019-12-09 22:47:42 +03:00
|
|
|
// updater info now set in: customizeStyle
|
|
|
|
//slotUpdateInfo();
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
// misc
|
2017-09-20 11:14:48 +03:00
|
|
|
connect(_ui->monoIconsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
|
|
|
|
connect(_ui->crashreporterCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
|
|
|
|
connect(_ui->newFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
|
2017-09-20 12:48:13 +03:00
|
|
|
connect(_ui->newFolderLimitSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &GeneralSettings::saveMiscSettings);
|
2017-09-20 11:14:48 +03:00
|
|
|
connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
|
2013-08-14 18:35:36 +04:00
|
|
|
|
2014-08-29 19:07:31 +04:00
|
|
|
#ifndef WITH_CRASHREPORTER
|
|
|
|
_ui->crashreporterCheckBox->setVisible(false);
|
|
|
|
#endif
|
2013-08-14 18:35:36 +04:00
|
|
|
|
2017-10-19 17:37:51 +03:00
|
|
|
// Hide on non-Windows, or WindowsVersion < 10.
|
|
|
|
// The condition should match the default value of ConfigFile::showInExplorerNavigationPane.
|
|
|
|
#ifdef Q_OS_WIN
|
2019-09-08 18:33:34 +03:00
|
|
|
#if QTLEGACY
|
|
|
|
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS10)
|
2019-09-08 19:42:40 +03:00
|
|
|
#else
|
|
|
|
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows10)
|
2019-09-08 18:33:34 +03:00
|
|
|
#endif
|
|
|
|
_ui->showInExplorerNavigationPaneCheckBox->setVisible(false);
|
2020-03-01 06:03:29 +03:00
|
|
|
#else
|
|
|
|
// Hide on non-Windows
|
|
|
|
_ui->showInExplorerNavigationPaneCheckBox->setVisible(false);
|
2017-10-19 17:37:51 +03:00
|
|
|
#endif
|
|
|
|
|
2015-09-09 16:52:22 +03:00
|
|
|
/* Set the left contents margin of the layout to zero to make the checkboxes
|
|
|
|
* align properly vertically , fixes bug #3758
|
|
|
|
*/
|
2020-05-29 16:07:05 +03:00
|
|
|
int m0 = 0;
|
|
|
|
int m1 = 0;
|
|
|
|
int m2 = 0;
|
|
|
|
int m3 = 0;
|
2017-05-17 11:55:42 +03:00
|
|
|
_ui->horizontalLayout_3->getContentsMargins(&m0, &m1, &m2, &m3);
|
|
|
|
_ui->horizontalLayout_3->setContentsMargins(0, m1, m2, m3);
|
2015-09-09 16:52:22 +03:00
|
|
|
|
2013-08-14 18:35:36 +04:00
|
|
|
// OEM themes are not obliged to ship mono icons, so there
|
|
|
|
// is no point in offering an option
|
2016-10-10 13:38:05 +03:00
|
|
|
_ui->monoIconsCheckBox->setVisible(Theme::instance()->monoIconsAvailable());
|
2015-03-27 13:46:03 +03:00
|
|
|
|
2017-09-20 11:14:48 +03:00
|
|
|
connect(_ui->ignoredFilesButton, &QAbstractButton::clicked, this, &GeneralSettings::slotIgnoreFilesEditor);
|
2020-10-05 20:45:40 +03:00
|
|
|
connect(_ui->debugArchiveButton, &QAbstractButton::clicked, this, &GeneralSettings::slotCreateDebugArchive);
|
2017-01-26 12:00:19 +03:00
|
|
|
|
|
|
|
// accountAdded means the wizard was finished and the wizard might change some options.
|
2017-09-20 11:14:48 +03:00
|
|
|
connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings);
|
2019-12-09 22:47:42 +03:00
|
|
|
|
|
|
|
customizeStyle();
|
2013-07-04 21:59:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
GeneralSettings::~GeneralSettings()
|
|
|
|
{
|
|
|
|
delete _ui;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:55:42 +03:00
|
|
|
QSize GeneralSettings::sizeHint() const
|
|
|
|
{
|
2020-05-27 15:36:07 +03:00
|
|
|
return {
|
|
|
|
ownCloudGui::settingsDialogSize().width(),
|
|
|
|
QWidget::sizeHint().height()
|
|
|
|
};
|
2015-07-20 19:15:45 +03:00
|
|
|
}
|
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
void GeneralSettings::loadMiscSettings()
|
|
|
|
{
|
2017-01-26 12:00:19 +03:00
|
|
|
QScopedValueRollback<bool> scope(_currentlyLoading, true);
|
2014-11-10 00:30:29 +03:00
|
|
|
ConfigFile cfgFile;
|
2013-07-04 21:59:40 +04:00
|
|
|
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
2018-02-15 22:21:08 +03:00
|
|
|
_ui->serverNotificationsCheckBox->setChecked(cfgFile.optionalServerNotifications());
|
2017-10-19 17:37:51 +03:00
|
|
|
_ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
|
2014-08-28 18:19:17 +04:00
|
|
|
_ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
|
2015-07-27 10:54:20 +03:00
|
|
|
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
|
2015-07-07 17:28:48 +03:00
|
|
|
_ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
|
|
|
|
_ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
|
2017-01-24 12:16:10 +03:00
|
|
|
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
|
|
|
|
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
2013-07-04 21:59:40 +04:00
|
|
|
}
|
|
|
|
|
2020-03-09 03:48:07 +03:00
|
|
|
#if defined(BUILD_UPDATER)
|
2014-01-15 14:08:42 +04:00
|
|
|
void GeneralSettings::slotUpdateInfo()
|
|
|
|
{
|
2018-05-18 15:17:13 +03:00
|
|
|
if (ConfigFile().skipUpdateCheck() || !Updater::instance()) {
|
2018-04-27 10:10:38 +03:00
|
|
|
// updater disabled on compile
|
|
|
|
_ui->updatesGroupBox->setVisible(false);
|
|
|
|
return;
|
2016-03-03 15:20:10 +03:00
|
|
|
}
|
|
|
|
|
2018-04-27 10:10:38 +03:00
|
|
|
// Note: the sparkle-updater is not an OCUpdater
|
|
|
|
auto *ocupdater = qobject_cast<OCUpdater *>(Updater::instance());
|
|
|
|
if (ocupdater) {
|
|
|
|
connect(ocupdater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection);
|
|
|
|
connect(_ui->restartButton, &QAbstractButton::clicked, ocupdater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection);
|
2017-09-20 12:48:13 +03:00
|
|
|
connect(_ui->restartButton, &QAbstractButton::clicked, qApp, &QApplication::quit, Qt::UniqueConnection);
|
2020-03-09 03:17:02 +03:00
|
|
|
connect(_ui->updateButton, &QAbstractButton::clicked, this, &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection);
|
|
|
|
connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleAutoUpdateCheck);
|
2019-12-09 22:47:42 +03:00
|
|
|
|
2018-04-27 10:10:38 +03:00
|
|
|
QString status = ocupdater->statusString();
|
2019-12-09 22:47:42 +03:00
|
|
|
Theme::replaceLinkColorStringBackgroundAware(status);
|
|
|
|
_ui->updateStateLabel->setText(status);
|
|
|
|
|
2018-04-27 10:10:38 +03:00
|
|
|
_ui->restartButton->setVisible(ocupdater->downloadState() == OCUpdater::DownloadComplete);
|
2020-03-09 03:17:02 +03:00
|
|
|
|
2018-04-27 10:10:38 +03:00
|
|
|
_ui->updateButton->setEnabled(ocupdater->downloadState() != OCUpdater::CheckingServer &&
|
|
|
|
ocupdater->downloadState() != OCUpdater::Downloading &&
|
|
|
|
ocupdater->downloadState() != OCUpdater::DownloadComplete);
|
2020-03-09 03:17:02 +03:00
|
|
|
|
|
|
|
_ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck());
|
2018-04-27 10:10:38 +03:00
|
|
|
}
|
2018-06-02 15:58:33 +03:00
|
|
|
#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE)
|
2018-04-27 10:10:38 +03:00
|
|
|
else if (auto sparkleUpdater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
|
|
|
|
_ui->updateStateLabel->setText(sparkleUpdater->statusString());
|
|
|
|
_ui->restartButton->setVisible(false);
|
2014-01-15 14:08:42 +04:00
|
|
|
}
|
2018-04-27 10:10:38 +03:00
|
|
|
#endif
|
|
|
|
|
2018-05-18 15:17:13 +03:00
|
|
|
// Channel selection
|
|
|
|
_ui->updateChannel->setCurrentIndex(ConfigFile().updateChannel() == "beta" ? 1 : 0);
|
|
|
|
connect(_ui->updateChannel, &QComboBox::currentTextChanged,
|
|
|
|
this, &GeneralSettings::slotUpdateChannelChanged, Qt::UniqueConnection);
|
2014-01-15 14:08:42 +04:00
|
|
|
}
|
|
|
|
|
2018-04-26 12:24:30 +03:00
|
|
|
void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
|
|
|
|
{
|
2018-05-18 15:45:29 +03:00
|
|
|
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);
|
2020-05-26 12:51:35 +03:00
|
|
|
auto acceptButton = msgBox->addButton(tr("Change update channel"), QMessageBox::AcceptRole);
|
2018-05-18 15:45:29 +03:00
|
|
|
msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
|
2020-05-26 12:51:35 +03:00
|
|
|
connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox, acceptButton] {
|
2018-05-18 15:45:29 +03:00
|
|
|
msgBox->deleteLater();
|
2020-05-26 12:51:35 +03:00
|
|
|
if (msgBox->clickedButton() == acceptButton) {
|
2018-05-18 15:45:29 +03:00
|
|
|
ConfigFile().setUpdateChannel(channel);
|
|
|
|
if (auto updater = qobject_cast<OCUpdater *>(Updater::instance())) {
|
|
|
|
updater->setUpdateUrl(Updater::updateUrl());
|
|
|
|
updater->checkForUpdate();
|
|
|
|
}
|
2018-06-02 15:58:33 +03:00
|
|
|
#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE)
|
2018-05-18 15:45:29 +03:00
|
|
|
else if (auto updater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
|
|
|
|
updater->setUpdateUrl(Updater::updateUrl());
|
|
|
|
updater->checkForUpdate();
|
|
|
|
}
|
2018-05-18 15:17:13 +03:00
|
|
|
#endif
|
2018-05-18 15:45:29 +03:00
|
|
|
} else {
|
|
|
|
_ui->updateChannel->setCurrentText(ConfigFile().updateChannel());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
msgBox->open();
|
2018-04-26 12:24:30 +03:00
|
|
|
}
|
|
|
|
|
2020-03-09 03:17:02 +03:00
|
|
|
void GeneralSettings::slotUpdateCheckNow()
|
|
|
|
{
|
2020-05-27 21:23:36 +03:00
|
|
|
auto *updater = qobject_cast<OCUpdater *>(Updater::instance());
|
2020-03-09 03:17:02 +03:00
|
|
|
if (ConfigFile().skipUpdateCheck()) {
|
|
|
|
updater = nullptr; // don't show update info if updates are disabled
|
|
|
|
}
|
|
|
|
|
|
|
|
if (updater) {
|
|
|
|
_ui->updateButton->setEnabled(false);
|
|
|
|
|
|
|
|
updater->checkForUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettings::slotToggleAutoUpdateCheck()
|
|
|
|
{
|
|
|
|
ConfigFile cfgFile;
|
|
|
|
bool isChecked = _ui->autoCheckForUpdatesCheckBox->isChecked();
|
|
|
|
cfgFile.setAutoUpdateCheck(isChecked, QString());
|
|
|
|
}
|
2020-03-09 03:48:07 +03:00
|
|
|
#endif // defined(BUILD_UPDATER)
|
2020-03-09 03:17:02 +03:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
void GeneralSettings::saveMiscSettings()
|
|
|
|
{
|
2017-01-26 12:00:19 +03:00
|
|
|
if (_currentlyLoading)
|
|
|
|
return;
|
2014-11-10 00:30:29 +03:00
|
|
|
ConfigFile cfgFile;
|
2013-07-04 21:59:40 +04:00
|
|
|
bool isChecked = _ui->monoIconsCheckBox->isChecked();
|
|
|
|
cfgFile.setMonoIcons(isChecked);
|
|
|
|
Theme::instance()->setSystrayUseMonoIcons(isChecked);
|
2014-08-28 18:19:17 +04:00
|
|
|
cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());
|
2015-07-07 17:28:48 +03:00
|
|
|
|
2015-07-27 10:54:20 +03:00
|
|
|
cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
|
2017-05-17 11:55:42 +03:00
|
|
|
_ui->newFolderLimitSpinBox->value());
|
2017-01-24 12:16:10 +03:00
|
|
|
cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
|
2013-07-04 21:59:40 +04:00
|
|
|
}
|
|
|
|
|
2013-07-05 02:25:19 +04:00
|
|
|
void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
|
|
|
|
{
|
2013-07-07 00:38:33 +04:00
|
|
|
Theme *theme = Theme::instance();
|
|
|
|
Utility::setLaunchOnStartup(theme->appName(), theme->appNameGUI(), enable);
|
2013-07-05 02:25:19 +04:00
|
|
|
}
|
|
|
|
|
2018-02-15 22:21:08 +03:00
|
|
|
void GeneralSettings::slotToggleOptionalServerNotifications(bool enable)
|
2013-07-05 03:01:23 +04:00
|
|
|
{
|
2014-11-10 00:30:29 +03:00
|
|
|
ConfigFile cfgFile;
|
2018-02-15 22:21:08 +03:00
|
|
|
cfgFile.setOptionalServerNotifications(enable);
|
2013-07-05 03:01:23 +04:00
|
|
|
}
|
|
|
|
|
2017-10-19 17:37:51 +03:00
|
|
|
void GeneralSettings::slotShowInExplorerNavigationPane(bool checked)
|
|
|
|
{
|
|
|
|
ConfigFile cfgFile;
|
|
|
|
cfgFile.setShowInExplorerNavigationPane(checked);
|
|
|
|
// Now update the registry with the change.
|
|
|
|
FolderMan::instance()->navigationPaneHelper().setShowInExplorerNavigationPane(checked);
|
|
|
|
}
|
|
|
|
|
2015-03-27 13:46:03 +03:00
|
|
|
void GeneralSettings::slotIgnoreFilesEditor()
|
|
|
|
{
|
|
|
|
if (_ignoreEditor.isNull()) {
|
2019-08-13 23:50:48 +03:00
|
|
|
ConfigFile cfgFile;
|
2019-08-15 00:09:19 +03:00
|
|
|
_ignoreEditor = new IgnoreListEditor(this);
|
2017-05-17 11:55:42 +03:00
|
|
|
_ignoreEditor->setAttribute(Qt::WA_DeleteOnClose, true);
|
2015-03-27 13:46:03 +03:00
|
|
|
_ignoreEditor->open();
|
|
|
|
} else {
|
|
|
|
ownCloudGui::raiseDialog(_ignoreEditor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 20:45:40 +03:00
|
|
|
void GeneralSettings::slotCreateDebugArchive()
|
|
|
|
{
|
|
|
|
const auto filename = QFileDialog::getSaveFileName(this, tr("Create Debug Archive"), QString(), tr("Zip Archives") + " (*.zip)");
|
|
|
|
if (filename.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
createDebugArchive(filename);
|
|
|
|
QMessageBox::information(this, tr("Debug Archive Created"), tr("Debug archive is created at %1").arg(filename));
|
|
|
|
}
|
|
|
|
|
2018-08-02 09:36:03 +03:00
|
|
|
void GeneralSettings::slotShowLegalNotice()
|
|
|
|
{
|
|
|
|
auto notice = new LegalNotice();
|
|
|
|
notice->exec();
|
|
|
|
delete notice;
|
|
|
|
}
|
|
|
|
|
2019-12-09 22:47:42 +03:00
|
|
|
void GeneralSettings::slotStyleChanged()
|
|
|
|
{
|
|
|
|
customizeStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettings::customizeStyle()
|
|
|
|
{
|
|
|
|
// setup about section
|
|
|
|
QString about = Theme::instance()->about();
|
|
|
|
Theme::replaceLinkColorStringBackgroundAware(about);
|
|
|
|
_ui->aboutLabel->setText(about);
|
|
|
|
|
2020-03-09 03:48:07 +03:00
|
|
|
#if defined(BUILD_UPDATER)
|
2019-12-09 22:47:42 +03:00
|
|
|
// updater info
|
|
|
|
slotUpdateInfo();
|
2020-03-09 03:48:07 +03:00
|
|
|
#else
|
|
|
|
_ui->updatesGroupBox->setVisible(false);
|
|
|
|
#endif
|
2019-12-09 22:47:42 +03:00
|
|
|
}
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|