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

Friedrich W. H. Kossebau kossebau at kde.org
Sun Feb 1 21:19:51 GMT 2009


Am dimanche, 1. février 2009, um 20:22 Uhr, schrieb Albert Astals Cid:
> A Diumenge, 1 de febrer de 2009, Friedrich W. H. Kossebau va escriure:
> > 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.
>
> Do you really need to backport this? I don't see the point, 4.2 is
> "working" with it so no need to make an improvement that may break things.

Because the API dox does not match the behaviour, so 3rd party programmer will 
be confused? :) 

And from lxr* I could not see where this would break something inside KDE 4.

* 
http://lxr.kde.org/search?filestring=&string=%22KProtocolInfo%3A%3Aicon%28%22

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




More information about the kde-core-devel mailing list