Support option for metered networks in Plasmoid as well

This commit is contained in:
Martchus 2024-02-19 18:34:36 +01:00
parent 827251004e
commit abf1ad6c5a
1 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,8 @@
#include <syncthingconnector/syncthingservice.h>
#include <syncthingconnector/utils.h>
#include <syncthingmodel/syncthingicons.h>
#include <syncthingwidgets/misc/direrrorsdialog.h>
#include <syncthingwidgets/misc/internalerrorsdialog.h>
#include <syncthingwidgets/misc/otherdialogs.h>
@ -12,10 +14,9 @@
#include <syncthingwidgets/settings/settingsdialog.h>
#include <syncthingwidgets/settings/wizard.h>
#include <syncthingwidgets/webview/webviewdialog.h>
#include <syncthingmodel/syncthingicons.h>
#include <syncthingconnector/utils.h>
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
#include <syncthingwidgets/misc/syncthinglauncher.h>
#endif
#include "resources/config.h"
#include "resources/qtconfig.h"
@ -366,6 +367,12 @@ void SyncthingApplet::showSettingsDlg()
{
if (!m_settingsDlg) {
m_settingsDlg = new SettingsDialog(*this);
// create a launcher as its monitoring of whether the network is metered is required by the connection settings
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
if (!SyncthingLauncher::mainInstance()) {
SyncthingLauncher::setMainInstance(new SyncthingLauncher(m_settingsDlg));
}
#endif
// show wizard when requested
connect(m_settingsDlg, &SettingsDialog::wizardRequested, this, &SyncthingApplet::showWizard);
// ensure settings take effect when applied