November 12, 2008
KDE standard aboutbox is kind of close-minded
Back in the days of kde3, while writing a KDE application, I encountered quite a big problem while trying to use the aboutbox stuff from KDE (that means kaboutdata and the now called kaboutapplicationdialog). I talked to some guys on #kde-devel, and I have been told that, yes, this will be changed for KDE4.
Now that I (mostly) use and (rarely) develop for KDE4, I have been hit again by the same problem. Before reporting to the bugtracking system of KDE, I would like to know what people think. Most importantly, do people outside of KDE proper do actually use this ?
Description of the problem
There is a field called bugsEmailAddress in the constructor of KAboutData, which is used by KAboutApplicationDialog to decide what to display. Using this field, something like
"Please report bugs to <a href=\"mailto:%1\">%2</a>.\n"
will be used to display the link in the about box. What does it mean ? First, it means that it is not possible to have a link to a web bug tracker. You need to provide a mail, and nothing else. Seeing how common are web bugtrackers, this is rather strange.
Though… what about KDE’s own applications ? The default value for bugsEmailAddress is “submit@bugs.kde.org”. So far, it makes perfectly sense. But if you open any KDE application, you’ll see a link to the web page. Why is it so ? look in kdelibs/kdeui/dialogs/kaboutapplicationdialog.cpp :
if ( .. || aboutData->bugAddress() == "submit@bugs.kde.org")
text = "Please use http://bugs.kde.org..."
I can only guess why this was done this way : probably for some historical reason and then nobody bothered about fixing it. I’m sure they have not done something as ugly on purpose.
So as a conclusion
- KDE uses a link to their web tracker.
- You are not allowed to such a luxury and you need to provide an email address.
Toward a fix ?
The obvious fix is to store an URL or linkAddress in KAboutData and use that in the About dialog. Adding a clear sentence to the documentation : “if you want to use an email address, just add mailto: in front of the argument”.
Now, instead of ranting, my first reaction was to go and fix that (I swear, trust me). Even few years ago. But.. then I’m confronted to a problem : probably some people use this, and I would break quite a lot of about boxes, and everybody will hate me. Not something I want of course.. I tried to talk about this on IRC, but nobody is really interested in this. And finally, i did not dare changing this, and wend the old way : I wrote my own about box.
Turn around
Today, I have found a way to turn around the problem : You can use the method setCustomAuthorText() and then, KDE will not do anything and let you decide about what to display in this tab. Hourray 🙂
Wouldn’t it be trivial to provide an overloaded constructor with KUrl instead of the QByteArray now used for the email address?
I would check the contents of the variable. If it starts with ‘^[^/]+:’ just use this as link (so you can use https, etc). Else if it starts with ‘^[^/]+@’ prefix it by ‘mailto:’ and in any other case by ‘http://’
I find that breaking something is a way better solution than doing nothing. Since the breakage is the beginning for something better 🙂
What if the bug-address is checked for “http://”, “https://” etc.
If the given address does not start with the protocol, “mailto:” could be prepended and a warning displayed that this workaround will be removed soon?
Of course it is just a workaround but it would ease the transition…?
To keep compatibility with the old way, one can automatically add the “mailto:” prefix to non-valid URLs with a “@”. It shouldn’t be very hard.