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

Alex Merry kde at randomguy3.me.uk
Sun Feb 1 17:02:51 GMT 2009


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.

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().

Alex


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090201/68732df7/attachment.sig>


More information about the kde-core-devel mailing list