KProtocolInfo::icon( QString protocol ): return QString() or "unknown" if unknown?

Friedrich W. H. Kossebau kossebau at kde.org
Sun Feb 1 17:33:42 GMT 2009


Am dimanche, 1. février 2009, um 18:02 Uhr, schrieb Alex Merry:
> On Saturday 31 January 2009 23:41:47 Friedrich W. H. Kossebau wrote:
> > The API dox of "KProtocolInfo::icon( QString protocol )" says:
> > 	Returns:
> > 	the icon of the protocol, or null if unknown
> > But the code returns "unknown" if unknown.
>
> If the return type is "QString", you can't return "null", and we don't
> generally distinguish between the null string and an empty string, so the
> documentation should at least be rephrased.

True for that, good eyes :)

> LXR shows a mix of checking for isEmpty() on the result, and simply using
> the result without checking it, generally as an argument to KIcon.  No-one
> checks for "unknown" in KDE SVN, it seems.  If KIcon(QString()) has the
> same effect as KIcon("unknown"), then I'd probably go for changing the
> implementation to return QString().

That's what I think, too. And if "KIcon(QString())" currently does not behave 
like that it should be made to do so IMO. What else could one want to express 
if creating an unnamed icon (and not using a null icon with "KIcon()")? 

So if noone rejects I would commit a change for this to trunk on monday (given 
the patch is easy ;) And if nothing breaks I will backport to 4.2 a few days 
later.

Cheers
Friedrich
-- 
Okteta - KDE 4 Hex Editor - http://utils.kde.org/projects/okteta




More information about the kde-core-devel mailing list