mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
okular: use KImageIO::typeForMime() to get the format for the image that is saved
much more reliable than assuming that the plugin to be used matches the end of the mime type Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
233adf2643
commit
994a53cdbb
1 changed files with 8 additions and 6 deletions
|
@ -2505,12 +2505,14 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
|
|||
else
|
||||
{
|
||||
KMimeType::Ptr mime = KMimeType::findByUrl( fileName );
|
||||
QString type;
|
||||
if ( !mime || mime == KMimeType::defaultMimeTypePtr() )
|
||||
type = "PNG";
|
||||
else
|
||||
type = mime->name().section( '/', -1 ).toUpper();
|
||||
copyPix.save( fileName, qPrintable( type ) );
|
||||
QString type = QString::fromLatin1("PNG");
|
||||
if ( mime && mime != KMimeType::defaultMimeTypePtr() ) {
|
||||
const QString formatType = KImageIO::typeForMime(mime->name(), KImageIO::Writing);
|
||||
if (!formatType.isEmpty()) {
|
||||
type = formatType;
|
||||
}
|
||||
}
|
||||
copyPix.save( fileName, type.toLatin1() );
|
||||
d->messageWindow->display( i18n( "Image [%1x%2] saved to %3 file.", copyPix.width(), copyPix.height(), type ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue