On Wednesday 21 September 2011 14:34:05 Wolf-Michael Bolle wrote:
> I still have one question about one of QMimeType's properties,
> genericIconName. I'd prefer to change that property into returning the
> actual path to the icon file to be more portable. What is the proper way
> to get an icon file name from the generic icon name?
QIcon::fromTheme(). But I don't think qmime should depend on QtGui, so better
let the app authors do that.
Same for iconName(), which is currently missing (it can either come from a
user-defined mimetype xml, or fallback to the mimetype name with slashes
turned into dashes -- all as per the s-m-i spec).
> Also, why do the glob patterns for *.tar.gz return *.tar.gz *.tgz *.taz
> when suffixes only returns tgz and taz?
That's because of this code (from qt creator I presume)
/*!
\var QMimeTypeData::suffixPattern
\brief Regular expression to match a suffix glob pattern: "*.ext" (and not
sth like "Makefile" or "*.log[1-9]"
*/
: suffixPattern(QLatin1String("^\\*\\.[\\w+]+$"))
So this doesn't match .tar.gz, but I agree that's a bug. I'll convert this to
use my kde code instead.
But honestly I don't see the need for a "list of suffixes" method. In KDE we
only have a "primary suffix" method, for the use case of the checkbox at the
bottom of file dialogs which offers to automatically append an extension. And
shared-mime-info now (since 0.70) ensures that the order of the globs is kept,
so the writer of the XML file can control which suffix is seen as "primary".
Returning a list of suffixes has the risk that people use that for filename
matching :-)
--
David Faure, [email protected], http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback