Skip to content

Commit

Permalink
Merge pull request nextcloud#7926 from Pabarino/enhancement/2792
Browse files Browse the repository at this point in the history
  • Loading branch information
claucambra authored Feb 26, 2025
2 parents 5414712 + a62976c commit 02f183d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <QMessageBox>

#include <KZip>
#include <chrono>

namespace {
struct ZipEntry {
Expand Down Expand Up @@ -186,6 +187,11 @@ GeneralSettings::GeneralSettings(QWidget *parent)
, _ui(new Ui::GeneralSettings)
{
_ui->setupUi(this);

_ui->labelInterval->setText("seconds (if <a href=\"https://github.com/nextcloud/notify_push\">Client Push</a> is unavailable)");
_ui->labelInterval->setTextFormat(Qt::RichText);
_ui->labelInterval->setTextInteractionFlags(Qt::TextBrowserInteraction);
_ui->labelInterval->setOpenExternalLinks(true);

connect(_ui->serverNotificationsCheckBox, &QAbstractButton::toggled,
this, &GeneralSettings::slotToggleOptionalServerNotifications);
Expand Down Expand Up @@ -240,7 +246,8 @@ GeneralSettings::GeneralSettings(QWidget *parent)
connect(_ui->stopExistingFolderNowBigSyncCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->moveFilesToTrashCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);

connect(_ui->remotePollIntervalSpinBox, &QSpinBox::valueChanged, this, &GeneralSettings::slotRemotePollIntervalChanged);

#ifndef WITH_CRASHREPORTER
_ui->crashreporterCheckBox->setVisible(false);
#endif
Expand Down Expand Up @@ -321,6 +328,9 @@ void GeneralSettings::loadMiscSettings()
_ui->stopExistingFolderNowBigSyncCheckBox->setChecked(_ui->existingFolderLimitCheckBox->isChecked() && cfgFile.stopSyncingExistingFoldersOverLimit());
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());

const auto interval = cfgFile.remotePollInterval();
_ui->remotePollIntervalSpinBox->setValue(static_cast<int>(interval.count() / 1000));
}

#if defined(BUILD_UPDATER)
Expand Down Expand Up @@ -639,4 +649,15 @@ void GeneralSettings::customizeStyle()
#endif
}

void GeneralSettings::slotRemotePollIntervalChanged(int seconds)

Check warning on line 652 in src/gui/generalsettings.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/generalsettings.cpp:652:23 [readability-make-member-function-const]

method 'slotRemotePollIntervalChanged' can be made const
{
if (_currentlyLoading) {
return;
}

ConfigFile cfgFile;

Check warning on line 658 in src/gui/generalsettings.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/generalsettings.cpp:658:16 [cppcoreguidelines-init-variables]

variable 'cfgFile' is not initialized
std::chrono::milliseconds interval(seconds * 1000);
cfgFile.setRemotePollInterval(interval);
}

} // namespace OCC
1 change: 1 addition & 0 deletions src/gui/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private slots:
void slotCreateDebugArchive();
void loadMiscSettings();
void slotShowLegalNotice();
void slotRemotePollIntervalChanged(int seconds);
#if defined(BUILD_UPDATER)
void slotUpdateInfo();
void slotUpdateChannelChanged();
Expand Down
44 changes: 44 additions & 0 deletions src/gui/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,50 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_remotePollInterval">
<item>
<widget class="QLabel" name="remotePollIntervalLabel">
<property name="text">
<string>Server poll interval</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="remotePollIntervalSpinBox">
<property name="minimum">
<number>30</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelInterval">
<property name="text">
<string extracomment="Trailing part of &quot;Server poll interval&quot; ">seconds (if Client Push is unavailable)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_remotePollInterval">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
Expand Down

0 comments on commit 02f183d

Please sign in to comment.