mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
gwenview: check image MIME types via KMimeType::is()
because some image MIME types (e.g. image/svg+xml-compressed) do not have magic (only glob) and there is no way KMimeType::findByContent() can detect such (KMimeType::findByContent() returns application/gzip because it is actually a gzip-compressed file, duh) Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f265a13acb
commit
6999d07f0b
1 changed files with 5 additions and 2 deletions
|
@ -76,9 +76,12 @@ QString urlMimeType(const KUrl& url)
|
||||||
|
|
||||||
Kind mimeTypeKind(const QString& mimeType)
|
Kind mimeTypeKind(const QString& mimeType)
|
||||||
{
|
{
|
||||||
if (imageMimeTypes().contains(mimeType)) {
|
foreach (const QString &imageMimeType, imageMimeTypes()) {
|
||||||
|
KMimeType::Ptr imageMimeTypePtr = KMimeType::mimeType(imageMimeType);
|
||||||
|
if (imageMimeTypePtr && imageMimeTypePtr->is(mimeType)) {
|
||||||
return KIND_IMAGE;
|
return KIND_IMAGE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// if it is image but it is not one of the static MIME types attempt to open it anyway
|
// if it is image but it is not one of the static MIME types attempt to open it anyway
|
||||||
if (mimeType.startsWith(QLatin1String("image/"))) {
|
if (mimeType.startsWith(QLatin1String("image/"))) {
|
||||||
return KIND_IMAGE;
|
return KIND_IMAGE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue