[KCM/Component] filemanager: make dolphin the default filemananger
ClosedPublic

Authored by meven on Dec 31 2019, 10:30 AM.

Diff Detail

Repository
R119 Plasma Desktop
Branch
arcpatch-D26324
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20455
Build 20473: arc lint + arc unit
meven created this revision.Dec 31 2019, 10:30 AM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 31 2019, 10:30 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
meven requested review of this revision.Dec 31 2019, 10:30 AM
ervin accepted this revision.Dec 31 2019, 11:08 AM

Note that I think std::any_of wrapped in a helper to get an iterator on the dolphin radio button would make that code simpler. To be checked maybe? Not mandatory at all, feel free to ignore me there.

This revision is now accepted and ready to land.Dec 31 2019, 11:08 AM
meven updated this revision to Diff 72485.Dec 31 2019, 1:50 PM

Use std::any_of

ervin added a comment.Dec 31 2019, 1:59 PM

Damn, sorry mate... I meant find_if... dunno why I spluttered any_of... :-/

Indeed if you make a tiny wrapper function for find_if on the "storageId == org.kde.dolphin.desktop" condition, you can use it both in defaults and isDefaults.

In one case it's just about calling setChecked(true) on the found radio is any, in the other case it's about returning true or isChecked() if something was found (and then the check on mDynamicRadioButtons emptiness can disappear, indeed if it's empty dolphin can't be present anyway).

meven updated this revision to Diff 72488.Dec 31 2019, 2:18 PM

Use std::find_if

meven updated this revision to Diff 72489.Dec 31 2019, 2:18 PM

rebase on master

ervin requested changes to this revision.Dec 31 2019, 2:32 PM
ervin added inline comments.
kcms/componentchooser/componentchooserfilemanager.cpp
57

Turn it into a free function (taking the list as parameter), move it toward the top of the file and in the anonymous namespace (this is typically before the first definition of a method in CfgFileManager).

Also: space before * or & not after.

61

This if is not necessary anymore (if it's empty dolphinRadio will be a nullptr

kcms/componentchooser/componentchooserfilemanager.h
46 ↗(On Diff #72489)

No need to expose it in the .h at all, could take the list as a const& parameter. Besides the space should be before the star not after.

This revision now requires changes to proceed.Dec 31 2019, 2:32 PM
meven updated this revision to Diff 72491.Dec 31 2019, 2:53 PM
meven marked 2 inline comments as done.

Better implement helper function, replace unnused include by a more relevant one

ervin requested changes to this revision.Dec 31 2019, 3:08 PM

Almost there.

kcms/componentchooser/componentchooserfilemanager.cpp
42

Please move it before the ctor an declare it in the anonymous namespace ("namespace { ... }"). Also remove the space after the * and receive the radio buttons list as a const reference not by value.

Nitpick: I think I'd rename the parameter to something like "radioButtons" or "radioButtonList".

kcms/componentchooser/componentchooserfilemanager.h
46 ↗(On Diff #72491)

This change should go away now.

This revision now requires changes to proceed.Dec 31 2019, 3:08 PM
meven updated this revision to Diff 72493.Dec 31 2019, 3:13 PM
meven marked an inline comment as done.

Correct namespace declaration, better variable naming, take list of QRadioButton by const ref

ervin requested changes to this revision.Dec 31 2019, 3:16 PM

Note the :: prefix is likely unnecessary in this context (doesn't hurt either).

kcms/componentchooser/componentchooserfilemanager.h
46 ↗(On Diff #72493)

Really, this change should go away. ;-)

This revision now requires changes to proceed.Dec 31 2019, 3:16 PM
ervin added inline comments.Dec 31 2019, 3:31 PM
kcms/componentchooser/componentchooserfilemanager.cpp
32

And of course as I was about to hit "accept" I notice this opening curly brace is misplaced, please put it on the next line.

meven updated this revision to Diff 72497.Dec 31 2019, 3:41 PM

fix curly brace position

meven marked an inline comment as done.Dec 31 2019, 3:41 PM
ervin accepted this revision.Dec 31 2019, 3:55 PM
This revision is now accepted and ready to land.Dec 31 2019, 3:55 PM
This revision was automatically updated to reflect the committed changes.