Commit bed17657 authored by David Faure's avatar David Faure
Browse files

Port away from KImageIO.

Same solution (for finding the format string for QImage from the
mimetype) as the one used by Spectacle.

Test Plan:
Saving still works as PNG, JPG (to test multiple extensions),
and WEBP (to test a 4-letter extension).

Reviewers: broulik, andreagenor, tcanabrava, vkrause

Reviewed By: vkrause

Differential Revision:
parent 007dd8f6
......@@ -47,7 +47,6 @@
#include <QMimeDatabase>
#include "kpLogCategories.h"
#include <kimageio.h> // kdelibs4support
#include <KJobWidgets>
#include <KIO/FileCopyJob>
#include <KLocalizedString>
......@@ -175,21 +174,14 @@ bool kpDocument::savePixmapToDevice (const QImage &image,
*userCancelled = false;
QStringList types = KImageIO::typeForMime (saveOptions.mimeType ());
qCDebug(kpLogDocument) << "\ttypes=" << types;
if (types.isEmpty ()) {
return false;
// It's safe to arbitrarily choose the 0th type as any type in the list
// should invoke the same KImageIO image loader.
const QString type = types [0];
QString type = QMimeDatabase().mimeTypeForName (saveOptions.mimeType ()).preferredSuffix ();
qCDebug(kpLogDocument) << "\tmimeType=" << saveOptions.mimeType ()
<< " type=" << type;
if (type.isEmpty ()) {
return false;
if (lossyPrompt && !lossyPromptContinue (image, saveOptions, parent))
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