Skip to content

Commit

Permalink
[settings-vpn] Re-sort VPNs only when the name property is changed. C…
Browse files Browse the repository at this point in the history
…ontributes 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.
  • Loading branch information
rainemak committed Apr 16, 2018
1 parent a8c6a12 commit 51e4905
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vpnmodel.cpp
Expand Up @@ -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;
for ( ; index < itemCount; ++index) {
const VpnConnection *existing = get<VpnConnection>(index);
Expand Down

0 comments on commit 51e4905

Please sign in to comment.