mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 19:50:27 +00:00
Try to display a malformed image if feasible
Differential Revision: https://phabricator.kde.org/D8415
This commit is contained in:
parent
41d378aef9
commit
e91bf07bcf
|
@ -69,8 +69,12 @@ bool KIMGIOGenerator::loadDocumentInternal(const QByteArray & fileData, const QS
|
|||
QImageReader reader( &buffer, QImageReader::imageFormat( &buffer ) );
|
||||
reader.setAutoDetectImageFormat( true );
|
||||
if ( !reader.read( &m_img ) ) {
|
||||
emit error( i18n( "Unable to load document: %1", reader.errorString() ), -1 );
|
||||
return false;
|
||||
if (!m_img.isNull()) {
|
||||
emit warning( i18n( "This document appears malformed. Here is a best approximation of the document's intended appearance." ), -1 );
|
||||
} else {
|
||||
emit error( i18n( "Unable to load document: %1", reader.errorString() ), -1 );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QMimeDatabase db;
|
||||
auto mime = db.mimeTypeForFileNameAndData( fileName, fileData );
|
||||
|
|
Loading…
Reference in a new issue