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,8 +76,11 @@ QString urlMimeType(const KUrl& url)
|
|||
|
||||
Kind mimeTypeKind(const QString& mimeType)
|
||||
{
|
||||
if (imageMimeTypes().contains(mimeType)) {
|
||||
return KIND_IMAGE;
|
||||
foreach (const QString &imageMimeType, imageMimeTypes()) {
|
||||
KMimeType::Ptr imageMimeTypePtr = KMimeType::mimeType(imageMimeType);
|
||||
if (imageMimeTypePtr && imageMimeTypePtr->is(mimeType)) {
|
||||
return KIND_IMAGE;
|
||||
}
|
||||
}
|
||||
// if it is image but it is not one of the static MIME types attempt to open it anyway
|
||||
if (mimeType.startsWith(QLatin1String("image/"))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue