Commit 9931d3cc authored by Jakub Stachowski's avatar Jakub Stachowski

Do not blindly assume that contents are HTML file.

It is also can be plain text - AportisDoc format.
I don't think many of those are still around but it is simpler to make them display properly
than tweak mime rules to make sure that they will be ignored by Okular.


svn path=/trunk/KDE/kdegraphics/okular/; revision=962670
parent 0599270e
......@@ -19,7 +19,12 @@ MobiDocument::MobiDocument(const QString &fileName) : QTextDocument()
{
file = new Mobipocket::QFileStream(fileName);
doc = new Mobipocket::Document(file);
if (doc->isValid()) setHtml(fixMobiMarkup(doc->text()));
if (doc->isValid()) {
QString text=doc->text();
QString header=text.left(1024);
if (header.contains("<html>") || header.contains("<HTML>")) setHtml(fixMobiMarkup(text));
else setPlainText(text);
}
}
MobiDocument::~MobiDocument()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment