Replace KDE_open macro (and others)

David Faure faure at kde.org
Mon Jan 19 23:38:39 GMT 2009


On Monday 19 January 2009, Christian Ehrlicher wrote:
> Hi,
> 
> now that trunk is open again I would like to renew my suggestion to 
> replace KDE_foo macros from kde_file.h with proper functions. 

(of course "replace" doesn't mean removing the current macros,
for source/binary compatibility reasons).

> As Thiago already set I would replace const char* filename with QUrl --> KDE::open 
> (const QUrl &filename, ...). This would fix the problems with unicode 
> filenames on windows (currently you can't open files with unicode 
> characters which are not in the current locale codeset).

This sounds awfully slow to me, and incoherent.
KDE::open(path) is only for local paths, so a const QString& path or a const QByteArray& path would be right.
If you pass a QUrl, what happens when the QUrl contains http://www.kde.org or ftp://ftp.kde.org/index.html?
Nothing, of course, but then the API is really confusing ("we have all this API in KIO that takes
urls and can work with them, and we have this API like KDE::open which also takes urls
but cannot work with them unless they are local paths").

I can see how QString is a bad choice for paths - Thiago had the utopia that 
everyone would be using UTF-8 by now :-) ... but then the right choice is
QByteArray IMHO, not QUrl... Of course the issue is how to put the right stuff
into the bytearray, especially now that everything everywhere is using QString
for paths. Even QUrl::toLocalFile(), BTW...

Seems to me that proper support for this can only be done in Qt 5....

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list