Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e91bf07b authored by Alexander Trufanov's avatar Alexander Trufanov Committed by Albert Astals Cid

Try to display a malformed image if feasible

Differential Revision: https://phabricator.kde.org/D8415
parent 41d378ae
......@@ -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 );
......
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