Commit f4eeccd1 authored by Luigi Toscano's avatar Luigi Toscano

Recognize an image by MIME type, not extension

parent e418e0a6
......@@ -34,6 +34,8 @@
#include <QLinkedList>
#include <QListWidget>
#include <QMenu>
#include <QMimeDatabase>
#include <QMimeType>
#include <qpixmap.h>
#include <qpainter.h>
#include <QPushButton>
......@@ -1591,13 +1593,13 @@ void KImageMapEditor::mapShowHTML()
void KImageMapEditor::openFile(const KUrl & url) {
if ( ! url.isEmpty()) {
QString ext=QFileInfo(url.path()).completeSuffix().toLower();
if (ext=="png" || ext=="jpg" || ext=="jpeg" || ext=="gif" ||
ext=="bmp" || ext=="xbm" || ext=="xpm" || ext=="mng" || ext=="pnm")
QMimeDatabase db;
QMimeType openedFileType = db.mimeTypeForUrl(url);
if (openedFileType.name().left(6) == "image/") {
addImage(url);
else
} else {
openURL(url);
}
}
}
......
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