patch for KService

David Faure faure at kde.org
Wed Sep 14 00:32:33 BST 2005


On Friday 09 September 2005 16:20, Jens Herden wrote:
> Hello,
> 
> I propose the attached patch for KService. 
> The background is that KService::icon() does not what the docs say:
> 
>   /**
>    * Returns the name of the icon.
>    * @return the icon associated with the service,
>    *         or QString::null if not set
>    */
> 
> Actually the return value is the string "unknown" when the icon is not set in 
> the .desktop file. The consequence is that eg. in KBabel all validation tools 
> get the "unkown" icon in the menu. 

Hmm, this might break existing code/apps - we return "unknown" because that's at 
least something to display, instead of nothing... OK it's arguable if it's better to
have a default-white-icon instead of nothing, but still...
Hmm, the K menu has entries without icons at all, how is that possible? I'm quite
sure it uses KService... Ah, I see:
./kicker/ui/addapplet_mnu.cpp:55:        if (ai.icon().isEmpty() || ai.icon() == "unknown")
./kicker/ui/panelmenuiteminfo.h:77:            if (!m_icon.isEmpty() && m_icon != "unknown")

I think this means we shouldn't change it for KDE-3.x, it would break existing apps, so
better just fix the docu and check for "unknown" in your code.
For KDE-4.x, however, I agree, that returning QString::null is better.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list