mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +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
|
else
|
||||||
{
|
{
|
||||||
KMimeType::Ptr mime = KMimeType::findByUrl( fileName );
|
KMimeType::Ptr mime = KMimeType::findByUrl( fileName );
|
||||||
QString type;
|
QString type = QString::fromLatin1("PNG");
|
||||||
if ( !mime || mime == KMimeType::defaultMimeTypePtr() )
|
if ( mime && mime != KMimeType::defaultMimeTypePtr() ) {
|
||||||
type = "PNG";
|
const QString formatType = KImageIO::typeForMime(mime->name(), KImageIO::Writing);
|
||||||
else
|
if (!formatType.isEmpty()) {
|
||||||
type = mime->name().section( '/', -1 ).toUpper();
|
type = formatType;
|
||||||
copyPix.save( fileName, qPrintable( type ) );
|
}
|
||||||
|
}
|
||||||
|
copyPix.save( fileName, type.toLatin1() );
|
||||||
d->messageWindow->display( i18n( "Image [%1x%2] saved to %3 file.", copyPix.width(), copyPix.height(), type ) );
|
d->messageWindow->display( i18n( "Image [%1x%2] saved to %3 file.", copyPix.width(), copyPix.height(), type ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue