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

Albert Astals Cid aacid at kde.org
Sun Feb 1 19:22:01 GMT 2009


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.

Albert

>
> Cheers
> Friedrich






More information about the kde-core-devel mailing list