From 2abe5fa9ef89eda285770598afba80eddfa65edb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 17 Apr 2013 22:00:02 +0200 Subject: [PATCH] Do yet another attempt at finding the correct mimetype Makes okular http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/digital-editions/assets/welcome.epub work --- core/document.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/document.cpp b/core/document.cpp index d9b7998a7..2517461f0 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1859,6 +1859,18 @@ bool Document::openDocument( const QString & docFile, const KUrl& url, const KMi mime = newmime; offers = KMimeTypeTrader::self()->query( mime->name(), "okular/Generator", constraint ); } + if ( offers.isEmpty() ) + { + // There's still no offers, do a final mime search based on the filename + // We need this becuase sometimes (e.g. when downloading from a webserver) the mimetype we + // use is the one feeded by the server, that may be wrong + newmime = KMimeType::findByUrl( docFile ); + if ( newmime->name() != mime->name() ) + { + mime = newmime; + offers = KMimeTypeTrader::self()->query( mime->name(), "okular/Generator", constraint ); + } + } } if (offers.isEmpty()) {