mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
In case an image is not found, try uppercasing its extension and looking for it again.
(yay for case-insensitive contexts!) svn path=/trunk/KDE/kdegraphics/okular/; revision=825261
This commit is contained in:
parent
f817bde307
commit
af05a86e04
|
@ -1104,12 +1104,23 @@ QImage XpsPage::loadImageFromFile( const QString &fileName )
|
|||
return QImage();
|
||||
}
|
||||
|
||||
// TODO: consider case-insensitiveness (eg image.png vs existing image.PNG)
|
||||
const QString absoluteFileName = absolutePath( entryPath( m_fileName ), fileName );
|
||||
const KZipFileEntry* imageFile = static_cast<const KZipFileEntry *>(m_file->xpsArchive()->directory()->entry( absoluteFileName ));
|
||||
QString absoluteFileName = absolutePath( entryPath( m_fileName ), fileName );
|
||||
const KZipFileEntry* imageFile = static_cast< const KZipFileEntry * >( m_file->xpsArchive()->directory()->entry( absoluteFileName ) );
|
||||
if ( !imageFile ) {
|
||||
// image not found
|
||||
return QImage();
|
||||
// image not found, try uppercasing the extension
|
||||
const int dotPos = absoluteFileName.lastIndexOf( QLatin1Char( '.' ) );
|
||||
const QChar lastChar = absoluteFileName.at( absoluteFileName.count() - 1 );
|
||||
if ( dotPos != -1 ) {
|
||||
for ( int i = dotPos + 1; i < absoluteFileName.count(); ++i ) {
|
||||
absoluteFileName[i] = absoluteFileName[i].toUpper();
|
||||
}
|
||||
|
||||
imageFile = static_cast< const KZipFileEntry * >( m_file->xpsArchive()->directory()->entry( absoluteFileName ) );
|
||||
}
|
||||
if ( !imageFile ) {
|
||||
// image not found
|
||||
return QImage();
|
||||
}
|
||||
}
|
||||
|
||||
/* WORKAROUND:
|
||||
|
|
Loading…
Reference in a new issue