Bug 461568

Summary: Opening network KCM again with different Uuid arg doesn't change selected connection
Product: [Applications] systemsettings Reporter: Nicolas Fella <nicolas.fella>
Component: kcm_networkmanagementAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs-null, postix
Priority: NOR    
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nicolas Fella 2022-11-08 01:35:30 UTC
STEPS TO REPRODUCE
1. Open network applet 
2. Select a connection, click Configure, systemsettings opens with the network KCM and the connection selected
3. Select a different connection in the applet, click Configure

OBSERVED RESULT
Same network is selected in systemsettings

EXPECTED RESULT
The connection I just clicked Configure on is selected

SOFTWARE/OS VERSIONS
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version: 5.15.7
Comment 1 Nicolas Fella 2022-11-08 01:36:18 UTC
This assumes that https://invent.kde.org/plasma/plasma-nm/-/merge_requests/170 is merged and that systemsettings is actually opened
Comment 2 ratijas 2023-02-26 16:28:41 UTC
Same goes for the new Flatpak Permissions KCM. It can't switch to another requested app when it's already opened.

This KConfigModule API should be revisited in Plasma 6.
Comment 3 Nicolas Fella 2023-02-26 16:39:25 UTC
Do we need anything more than an "argumentsChanged" signal on the KCM class?
Comment 4 ratijas 2023-02-27 16:39:39 UTC
> Do we need anything more than an "argumentsChanged" signal on the KCM class?

I'd say it should be a virtual method, not a signal:

class ConfigModule {
  bool handleArgumentsChange(const QVariantList &args) {
    return false;
  }
}

When new arguments arrive, there are two possible scenarios:

1. Shell detects that KCM has unsaved changes, and triggers Apply/Discard dialog. If discarded or applied, tell KCM to reload its data and then pass new arguments (go to scenario #2). If cancelled, discard new arguments.

2. Shell detects that KCM has no unsaved changes, so it passes new arguments through the new virtual method. If method returns true, it means that the arguments got handled and KCM did its right thing. Otherwise, either KCM or base class implementation returns false, in which case shell unloads KCM completely, and loads it back in with new arguments passed in constructor (as previously).

By the way, do we really have a usecase for QVariantList? Can't it be just strings?
Comment 5 Nicolas Fella 2023-12-22 21:43:24 UTC
*** Bug 478901 has been marked as a duplicate of this bug. ***
Comment 6 Bug Janitor Service 2024-08-07 21:42:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-nm/-/merge_requests/366
Comment 7 Nicolas Fella 2024-10-31 16:12:33 UTC
Git commit 2c33582e89a836fb0a7c369f3ae6d99e494c0dc8 by Nicolas Fella.
Committed on 31/10/2024 at 16:12.
Pushed by nicolasfella into branch 'Plasma/6.2'.

[kcm] Update selected connection when opening KCM a second time
(cherry picked from commit 8638ee5821af770469e765192d0afb42962352d6)

M  +28   -14   kcm/kcm.cpp
M  +1    -0    kcm/kcm.h

https://invent.kde.org/plasma/plasma-nm/-/commit/2c33582e89a836fb0a7c369f3ae6d99e494c0dc8
Comment 8 Nicolas Fella 2024-10-31 16:17:08 UTC
Git commit 8638ee5821af770469e765192d0afb42962352d6 by Nicolas Fella.
Committed on 31/10/2024 at 15:14.
Pushed by nicolasfella into branch 'master'.

[kcm] Update selected connection when opening KCM a second time

M  +28   -14   kcm/kcm.cpp
M  +1    -0    kcm/kcm.h

https://invent.kde.org/plasma/plasma-nm/-/commit/8638ee5821af770469e765192d0afb42962352d6