Commit 51e49058 authored by Raine Makelainen's avatar Raine Makelainen

[settings-vpn] Re-sort VPNs only when the name property is changed. Contributes to JB#41638

E.i. do not sort when "autoConnect" changes. In practice this means that
sorting is only applied when a new VPN is created. When connection name
is edited, the VPN is first removed and after created again.
parent a8c6a12e
...@@ -864,8 +864,12 @@ void VpnModel::updateConnection(VpnConnection *conn, const QVariantMap &updatePr ...@@ -864,8 +864,12 @@ void VpnModel::updateConnection(VpnConnection *conn, const QVariantMap &updatePr
} }
} }
if (itemCount > 1) {
// Keep the items sorted by name // Keep the items sorted by name. So sort only when updateProperties map contains
// a name e.i. not when "autoConnect" changes. In practice this means that sorting
// is only allowed when a VPN is created. When modifying name of a VPN, the VPN
// will be first removed and then recreated.
if (itemCount > 1 && updateProperties.contains(QStringLiteral("name"))) {
int index = 0; int index = 0;
for ( ; index < itemCount; ++index) { for ( ; index < itemCount; ++index) {
const VpnConnection *existing = get<VpnConnection>(index); const VpnConnection *existing = get<VpnConnection>(index);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment