summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. Narvaez <[email protected]>2015-06-05 13:32:29 -0400
committerDavid E. Narvaez <[email protected]>2015-06-05 13:32:29 -0400
commit90b6d183d501ab138290887c81a5026c516078db (patch)
tree430ff4726cdc0e6bc1d2ca5d6f804e8182e5cdab
parentb6631c1318346ff3e3a04c37f48ffe5db88c3785 (diff)
Migrating ImageExporter to use QMimeDatabase
-rw-r--r--filters/exporter.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/filters/exporter.cc b/filters/exporter.cc
index 498e37e..da18645 100644
--- a/filters/exporter.cc
+++ b/filters/exporter.cc
@@ -31,7 +31,7 @@
#include "../misc/kigpainter.h"
#include <QIcon>
-#include <qfile.h>
+#include <QMimeDatabase>
#include <KIconEngine>
#include <kactionmenu.h>
@@ -39,7 +39,6 @@
#include <kimageio.h>
#include <klocale.h>
#include <kmessagebox.h>
-#include <kmimetype.h>
ExporterAction::ExporterAction( const KigPart* doc, KigWidget* w,
KActionCollection* parent, KigExporter* exp )
@@ -104,9 +103,10 @@ void ImageExporter::run( const KigPart& doc, KigWidget& w )
delete opts;
delete kfd;
- KMimeType::Ptr mimeType = KMimeType::findByPath( filename );
- qDebug() << "mimetype: " << mimeType->name();
- if ( !KImageIO::isSupported( mimeType->name(), KImageIO::Writing ) )
+ QMimeDatabase db;
+ QMimeType mimeType = db.mimeTypeForFile( filename );
+ qDebug() << "mimetype: " << mimeType.name();
+ if ( !KImageIO::isSupported( mimeType.name(), KImageIO::Writing ) )
{
KMessageBox::sorry( &w, i18n( "Sorry, this file format is not supported." ) );
return;
@@ -128,7 +128,7 @@ void ImageExporter::run( const KigPart& doc, KigWidget& w )
p.drawGrid( doc.document().coordinateSystem(), showgrid, showaxes );
// FIXME: show the selections ?
p.drawObjects( doc.document().objects(), false );
- QStringList types = KImageIO::typeForMime( mimeType->name() );
+ QStringList types = KImageIO::typeForMime( mimeType.name() );
if ( types.isEmpty() ) return; // TODO error dialog?
if ( !img.save( filename, types.at(0).toLatin1() ) )
{