Grantleetheme should always prefer files that are located in DataLocation.
ClosedPublic

Authored by knauss on Jan 4 2019, 12:02 AM.

Details

Summary

Tests need somehow provide the current files and not rely on, that these
files are already installed (see D15727). Having no special
ordering in place, it is random, what file is picked, when there are
themes with same names on different locations. So we may need sort the
themesDirectories.

Diff Detail

Repository
R77 PIM: Grantlee Theme
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
knauss created this revision.Jan 4 2019, 12:02 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 4 2019, 12:02 AM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
knauss requested review of this revision.Jan 4 2019, 12:02 AM
knauss retitled this revision from Make grantleetheme alsoway prefer files that lies in DataLocation. to Grantleetheme should always prefer files that are located in DataLocation..
dfaure added a comment.Jan 4 2019, 9:24 PM

The patch looks ok to me, but I'm not sure I understand the commit log, which talks about sorting. You don't need to sort, locateAll is sorted already (by order of the dirs in GenericDataLocation, which themselves have reliable order, e.g. it's the order of XDG_DATA_DIRS on linux)...

The patch looks ok to me, but I'm not sure I understand the commit log, which talks about sorting. You don't need to sort, locateAll is sorted already (by order of the dirs in GenericDataLocation, which themselves have reliable order, e.g. it's the order of XDG_DATA_DIRS on linux)...

from the patch itself it is not obvious, what is going wrong. I added a comment to the for loop (l127-l151) that is actually loading and overwriting the themes in a way you do not expect it in a Linux environment aka not able for the tests to set the themes (see D15727).

src/grantleethememanager.cpp
127

@dfaure you see this for loop l127 - l151, this will actually overwrites a found theme with a theme found in an other directory. So in the end the most general directory wins. IMO that is the opposite is expected, so that the general folders are fallback, if the local one is not found.

dfaure accepted this revision.Mar 2 2019, 11:59 PM

Pretty hard to reason about this from reading the code, but I'll try your debugging, and the removed code did look weird (count < 2 sounds very special-casey therefore broken).

This revision is now accepted and ready to land.Mar 2 2019, 11:59 PM
This revision was automatically updated to reflect the committed changes.