[Icon View] Fix titles of previously opened KCMs bleeding into QML KCMs
ClosedPublic

Authored by filipf on Dec 4 2019, 12:33 AM.

Details

Summary

The change in D14581 triggered the spawning of an additional header in QML KCMs in icon view mode.

The additional header was the header of the previously opened QWidgets KCM.

Sidebar view doesn't have this issue so I went and found the code that prevents the bug from happening and added it to icon view.

Given that icon view also has an additional sidebar when there's more than 1 category, a check also needed to be added so that we don't lose the sidebar.

BUG: 400876

Test Plan

Before:

After:

Diff Detail

Repository
R124 System Settings
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
filipf created this revision.Dec 4 2019, 12:33 AM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 4 2019, 12:33 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
filipf requested review of this revision.Dec 4 2019, 12:33 AM
filipf edited the summary of this revision. (Show Details)Dec 4 2019, 12:34 AM
filipf edited the test plan for this revision. (Show Details)
filipf added a reviewer: Plasma.
filipf edited the summary of this revision. (Show Details)Dec 4 2019, 12:47 AM
davidedmundson accepted this revision.Dec 4 2019, 9:58 AM
davidedmundson added a subscriber: davidedmundson.

Oh, well done!
I'd seen the bug report but hadn't been able to fix it.

icons/IconMode.cpp
119

In general we want to not mix two styles in the same method.

The rest of the code uses
d->moduleView->

This revision is now accepted and ready to land.Dec 4 2019, 9:58 AM
filipf planned changes to this revision.Dec 4 2019, 10:42 AM

I just realized this kills the sidebar when there's more than 1 kcm under a category :(

So we also fix this by setting:

d->moduleView()->setFaceType(KPageView::List);

But then then a sidebar shows up even if there is only 1 category.

So just need to check for the number of categories and do List if > 1, otherwise Plain.

filipf updated this revision to Diff 70889.Dec 4 2019, 12:14 PM

don't break the sidebar

This revision is now accepted and ready to land.Dec 4 2019, 12:14 PM
filipf edited the summary of this revision. (Show Details)Dec 4 2019, 12:17 PM
ngraham added a subscriber: ngraham.Dec 4 2019, 2:45 PM
ngraham added inline comments.
icons/IconMode.cpp
144

Since this is only used once, you don't really need to define a variable to hold it; just use it directly in the if statement.

ngraham accepted this revision.Dec 4 2019, 5:06 PM

Otherwise LGTM

filipf updated this revision to Diff 70915.Dec 4 2019, 5:41 PM

define condition without creating a variable

filipf marked 2 inline comments as done.Dec 4 2019, 5:42 PM
ngraham added inline comments.Dec 4 2019, 5:43 PM
icons/IconMode.cpp
144

pedantic nitpick: space before the final )

filipf updated this revision to Diff 70916.Dec 4 2019, 5:44 PM

add space before final )

ngraham accepted this revision.Dec 4 2019, 5:44 PM

5.17 I say

filipf added a comment.Dec 4 2019, 8:44 PM

5.17 I say

I think that makes sense.

I tested this by comparing every KCM with 5.17 system settings and saw no issues. Breadcrumb navigation worked as well.

This revision was automatically updated to reflect the committed changes.