Port the last uses of KMimeType. Only plasma/package.cpp is left...

This commit is contained in:
David Faure 2012-06-19 15:12:44 +02:00
parent 8f02ed76a1
commit a2b502dbf4
20 changed files with 34 additions and 42 deletions

View File

@ -291,7 +291,7 @@ target_link_libraries(plasma ${KDEPIMLIBS_GPGMEPP_LIBS} karchive)
target_link_libraries(plasmaqgv plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
${KDE4_KDEUI_LIBS} kdeclarative ${PLASMA_EXTRA_LIBS} kcoreaddons)
${KDE4_KDEUI_LIBS} kdeclarative ${PLASMA_EXTRA_LIBS} kcoreaddons ${QtMimeTypes_LIBRARY})
if(QCA2_FOUND)
target_link_libraries(plasma ${QCA2_LIBRARIES})

View File

@ -40,7 +40,7 @@
#include <kcoreauthorized.h>
#include <kmenu.h>
#include <kmessagebox.h>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include <kservicetypetrader.h>
#include <kurlmimedata.h>
@ -1295,8 +1295,9 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
}
#ifndef PLASMA_NO_KIO
else {
KMimeType::Ptr mime = KMimeType::findByUrl(url);
QString mimeName = mime->name();
QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl(url);
QString mimeName = mime.name();
QRectF geom(pos, QSize());
QVariantList args;
args << url.toString();

View File

@ -35,11 +35,7 @@
#include <kaction.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocalizedstring.h>
#include <kmimetype.h>
#include <kshortcutsdialog.h>
#include <kwindowsystem.h>
#include "coronabase.h"
#include "abstractdialogmanager.h"

View File

@ -36,7 +36,6 @@
#include <kaction.h>
#include <kdebug.h>
#include <klocalizedstring.h>
#include <kmimetype.h>
#include <kshortcutsdialog.h>
#include <kwindowsystem.h>

View File

@ -31,7 +31,7 @@
#include <kcompletion.h>
#include <kconfiggroup.h>
#include <kdebug.h>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include <kshell.h>
#include <qstandardpaths.h>
#include <qurl.h>
@ -233,9 +233,10 @@ class RunnerContextPrivate : public QSharedData
mimeType = "inode/folder";
} else if (info.isFile()) {
type = RunnerContext::File;
KMimeType::Ptr mimeTypePtr = KMimeType::findByPath(path);
if (mimeTypePtr) {
mimeType = mimeTypePtr->name();
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(path);
if (!mime.isDefault()) {
mimeType = mime.name();
}
}
}

View File

@ -23,7 +23,7 @@
#include <QPainter>
#include <QDir>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include "private/themedwidgetinterface_p.h"
#include "svg.h"
@ -54,10 +54,11 @@ public:
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(absImagePath);
QPixmap pm(q->size().toSize());
if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) {
if (mime.inherits("image/svg+xml") || mime.inherits("image/svg+xml-compressed")) {
if (!svg || svg->imagePath() != imagePath) {
delete svg;
svg = new Svg();

View File

@ -25,7 +25,6 @@
#include <kcombobox.h>
#include <kiconeffect.h>
#include <kiconloader.h>
#include <kmimetype.h>
#include "applet.h"
#include "framesvg.h"

View File

@ -26,7 +26,7 @@
#include <QPainter>
//KDE
#include <kmimetype.h>
#include <qmimedatabase.h>
//Plasma
#include "framesvg.h"
@ -180,9 +180,10 @@ void Frame::setImage(const QString &path)
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(d->absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(d->absImagePath);
if (!mime->is("image/svg+xml") && !mime->is("application/x-gzip")) {
if (!mime.inherits("image/svg+xml") && !mime.inherits("application/x-gzip")) {
d->pixmap = new QPixmap(d->absImagePath);
} else {
d->image = new Plasma::Svg(this);

View File

@ -23,8 +23,6 @@
#include <QIcon>
#include <QPainter>
#include <kmimetype.h>
#include "svg.h"
#include "private/themedwidgetinterface_p.h"
#include "theme.h"

View File

@ -40,8 +40,6 @@
#include <kglobalsettings.h>
#include <kiconeffect.h>
#include <kiconloader.h>
#include <kmimetype.h>
#include <kurl.h>
#include <klocale.h>
#include "animator.h"

View File

@ -29,7 +29,7 @@
#include <kcolorscheme.h>
#include <kglobalsettings.h>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include "private/themedwidgetinterface_p.h"
#include "svg.h"
@ -62,10 +62,11 @@ public:
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(absImagePath);
QPixmap pm(q->size().toSize());
if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) {
if (mime.inherits("image/svg+xml") || mime.inherits("image/svg+xml-compressed")) {
if (!svg || svg->imagePath() != absImagePath) {
delete svg;
svg = new Svg();

View File

@ -25,7 +25,6 @@
#include <QGraphicsView>
#include <klineedit.h>
#include <kmimetype.h>
#include "applet.h"
#include "framesvg.h"

View File

@ -27,7 +27,7 @@
#include <kiconeffect.h>
#include <kiconloader.h>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include <kpushbutton.h>
#include "animator.h"
@ -66,10 +66,11 @@ public:
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(absImagePath);
QPixmap pm;
if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) {
if (mime.inherits("image/svg+xml") || mime.inherits("image/svg+xml-compressed")) {
if (!svg || svg->imagePath() != absImagePath) {
delete svg;
svg = new Svg();

View File

@ -23,7 +23,7 @@
#include <QPainter>
#include <QRadioButton>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include "private/themedwidgetinterface_p.h"
#include "svg.h"
@ -52,10 +52,11 @@ public:
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(absImagePath);
QPixmap pm(q->size().toSize());
if (mime->is("image/svg+xml")) {
if (mime.inherits("image/svg+xml")) {
svg = new Svg();
QPainter p(&pm);
svg->paint(&p, pm.rect());

View File

@ -36,7 +36,6 @@
#include <QLabel>
//KDE
#include <kmimetype.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kiconloader.h>

View File

@ -24,7 +24,6 @@
#include <QSlider>
#include <QStyleOptionSlider>
#include <QGraphicsSceneWheelEvent>
#include <kmimetype.h>
#include "theme.h"
#include "framesvg.h"

View File

@ -24,7 +24,6 @@
#include <QStyleOptionSpinBox>
#include <QGraphicsView>
#include <kmimetype.h>
#include <knuminput.h>
#include "applet.h"

View File

@ -24,7 +24,6 @@
#include <QPainter>
#include <QScrollBar>
#include <kmimetype.h>
#include <ktextbrowser.h>
#include "svg.h"

View File

@ -25,7 +25,6 @@
#include <QScrollBar>
#include <QGraphicsView>
#include <kmimetype.h>
#include <ktextedit.h>
#include "applet.h"

View File

@ -27,7 +27,7 @@
#include <kcolorutils.h>
#include <kiconeffect.h>
#include <kmimetype.h>
#include <qmimedatabase.h>
#include "animator.h"
#include "framesvg.h"
@ -63,10 +63,11 @@ public:
return;
}
KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
QMimeDatabase db;
QMimeType mime = db.mimeTypeForFile(absImagePath);
QPixmap pm;
if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) {
if (mime.inherits("image/svg+xml") || mime.inherits("image/svg+xml-compressed")) {
if (!svg || svg->imagePath() != absImagePath) {
delete svg;
svg = new Svg();