Adding dedicated button for backend saving

This commit is contained in:
Rob Emery 2024-10-09 09:50:01 +01:00 committed by Carl Schwan
parent 27f5882dc1
commit 5895daf612
No known key found for this signature in database
GPG key ID: 02325448204E452A
3 changed files with 26 additions and 4 deletions

View file

@ -134,6 +134,7 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
connect(kcmUi.renameDone_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameDone); connect(kcmUi.renameDone_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameDone);
connect(kcmUi.renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow); connect(kcmUi.renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow);
connect(kcmUi.pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged); connect(kcmUi.pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
connect(kcmUi.backend_apply_button, &QAbstractButton::clicked, this, &KdeConnectKcm::saveBackends);
if (!args.isEmpty() && !args.first().isNull() && args.first().canConvert<QString>()) { if (!args.isEmpty() && !args.first().isNull() && args.first().canConvert<QString>()) {
const QString input = args.first().toString(); const QString input = args.first().toString();
@ -183,6 +184,11 @@ KdeConnectKcm::~KdeConnectKcm()
} }
void KdeConnectKcm::refresh() void KdeConnectKcm::refresh()
{
daemon->forceOnNetworkChange();
}
void KdeConnectKcm::saveBackends()
{ {
QStringList providerStatusToSend; QStringList providerStatusToSend;
for (int i = 0; i < kcmUi.linkProviders_list->count(); ++i) { for (int i = 0; i < kcmUi.linkProviders_list->count(); ++i) {
@ -193,7 +199,6 @@ void KdeConnectKcm::refresh()
} }
daemon->setProviderStatus(providerStatusToSend); daemon->setProviderStatus(providerStatusToSend);
daemon->forceOnNetworkChange();
} }
void KdeConnectKcm::deviceSelected(const QString &deviceId) void KdeConnectKcm::deviceSelected(const QString &deviceId)

View file

@ -36,6 +36,7 @@ private Q_SLOTS:
void sendPing(); void sendPing();
void pairingFailed(const QString &error); void pairingFailed(const QString &error);
void refresh(); void refresh();
void saveBackends();
void renameShow(); void renameShow();
void renameDone(); void renameDone();
void setRenameMode(bool b); void setRenameMode(bool b);

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1130</width> <width>1143</width>
<height>740</height> <height>740</height>
</rect> </rect>
</property> </property>
@ -65,6 +65,9 @@
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
@ -121,6 +124,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="refresh_button">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -132,9 +142,9 @@
<widget class="QListWidget" name="linkProviders_list"/> <widget class="QListWidget" name="linkProviders_list"/>
</item> </item>
<item> <item>
<widget class="QPushButton" name="refresh_button"> <widget class="QPushButton" name="backend_apply_button">
<property name="text"> <property name="text">
<string>Refresh</string> <string>Apply</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -229,6 +239,9 @@
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
@ -254,6 +267,9 @@
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>