From 233adf2643dd2758de5018a875bb2eeca2d62599 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 8 Aug 2023 17:58:45 +0300 Subject: [PATCH] generic: adjust to KImageIO changes Signed-off-by: Ivailo Monev --- gwenview/app/gvcore.cpp | 12 +++++------- ksnapshot/ksnapshotobject.cpp | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/gwenview/app/gvcore.cpp b/gwenview/app/gvcore.cpp index 5f0d6836..d02cd03f 100644 --- a/gwenview/app/gvcore.cpp +++ b/gwenview/app/gvcore.cpp @@ -83,21 +83,19 @@ struct GvCorePrivate if (mimeType.isEmpty()) { KMessageBox::sorry( mMainWindow, - i18nc("@info", - "No image format selected.") + i18nc("@info", "No image format selected.") ); continue; } - const QStringList typeList = KImageIO::typeForMime(mimeType); - if (typeList.count() > 0) { - *format = typeList[0].toAscii(); + const QString formatType = KImageIO::typeForMime(mimeType, KImageIO::Writing); + if (!formatType.isEmpty()) { + *format = formatType.toAscii(); break; } KMessageBox::sorry( mMainWindow, - i18nc("@info", - "Gwenview cannot save images as %1.", mimeType) + i18nc("@info", "Gwenview cannot save images as %1.", mimeType) ); } while (true); diff --git a/ksnapshot/ksnapshotobject.cpp b/ksnapshot/ksnapshotobject.cpp index ee08e0fd..3b61fdbf 100644 --- a/ksnapshot/ksnapshotobject.cpp +++ b/ksnapshot/ksnapshotobject.cpp @@ -129,9 +129,9 @@ bool KSnapshotObject::saveEqual( const KUrl& url,QWidget *widget ) { QByteArray type = "PNG"; QString mime = KMimeType::findByUrl( url.fileName(), 0, url.isLocalFile(), true )->name(); - const QStringList types = KImageIO::typeForMime(mime); - if ( !types.isEmpty() ) - type = types.first().toLatin1(); + const QString formatType = KImageIO::typeForMime(mime, KImageIO::Writing); + if ( !formatType.isEmpty() ) + type = formatType.toLatin1(); bool ok = false;