Review Request 116952: Make sure non-prefixed desktop files win when looking up by name

Alex Merry alex.merry at kde.org
Fri Mar 21 14:41:27 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116952/
-----------------------------------------------------------

Review request for KDE Frameworks and David Faure.


Repository: kservice


Description
-------

Make sure non-prefixed desktop files win when looking up by name

The existing code resolved all the overrides (based on storage id), then
if there were multiple desktop files with the same id (say
"konsole.desktop" and "kde4/konsole.desktop"), it would arbitrarily (due
to the use of QHash) pick one of them to return from
KService::serviceByDesktopName(), regardless of where in XDG_DATA_DIRS
it was found.

So you might get serviceByDesktopName("konsole") giving you
"kde4/konsole.desktop" and serviceByDesktopName("amarok") giving you
"amarok.desktop" (even if "kde4/amarok.desktop" also exists).

This change makes desktop files without a prefix (like
"konsole.desktop") override ones with a prefix (like
"kde4/konsole.desktop").  If you also have "kde5/konsole.desktop", the
ordering between that and "kde4/konsole.desktop" is still arbitrary, and
the order of XDG_DATA_DIRS is ignored.

Remove the prefix hacks from KService::serviceByDesktopName()

These didn't work; the desktop file "kde4/konsole.desktop" will only be
listed under the desktop name "konsole", not under the name
"kde4-konsole".

Add a test app for the KService::serviceBy* methods


Diffs
-----

  src/kbuildsycoca/kbuildservicefactory.cpp 4dbb44b7db1a8bc4182899485db9c45c063c9b52 
  src/services/kservice.cpp 192682b514a69c41fb84231f3b04ec6e9218d587 
  tests/CMakeLists.txt 47894e5a6175dac924c2e700b2dafe936590cc1b 
  tests/findservice.cpp PRE-CREATION 

Diff: https://git.reviewboard.kde.org/r/116952/diff/


Testing
-------

Tested using the new test app.


Thanks,

Alex Merry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140321/717df6c2/attachment.html>


More information about the Kde-frameworks-devel mailing list