[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-cli-tools] /: Port keditfiletype away from kdelibs4support
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2014-05-28 8:55:48
Message-ID: E1WpZeG-0002GB-9d () scm ! kde ! org
[Download RAW message or body]

Git commit b4980967138be088e65612b3e5b4e3cdfacadb09 by Aurélien Gâteau.
Committed on 28/05/2014 at 08:53.
Pushed by gateau into branch 'master'.

Port keditfiletype away from kdelibs4support

REVIEW: 117954

M  +4    -0    CMakeLists.txt
M  +15   -3    keditfiletype/CMakeLists.txt
M  +1    -1    keditfiletype/filegroupdetails.cpp
M  +32   -39   keditfiletype/filetypedetails.cpp
M  +2    -2    keditfiletype/filetypedetails.h
M  +19   -19   keditfiletype/filetypesview.cpp
M  +2    -2    keditfiletype/filetypesview.h
M  +117  -104  keditfiletype/keditfiletype.cpp
M  +20   -13   keditfiletype/keditfiletype.h
M  +17   -38   keditfiletype/kservicelistwidget.cpp
M  +5    -4    keditfiletype/kservicelistwidget.h
M  +15   -17   keditfiletype/kserviceselectdlg.cpp
M  +11   -6    keditfiletype/kserviceselectdlg.h
M  +41   -39   keditfiletype/mimetypedata.cpp
M  +10   -6    keditfiletype/mimetypedata.h
M  +11   -21   keditfiletype/mimetypewriter.cpp
M  +1    -1    keditfiletype/mimetypewriter.h
M  +19   -11   keditfiletype/newtypedlg.cpp
M  +4    -2    keditfiletype/newtypedlg.h
D  +0    -28   keditfiletype/sharedmimeinfoversion.cpp
D  +0    -30   keditfiletype/sharedmimeinfoversion.h
M  +0    -1    keditfiletype/tests/CMakeLists.txt
M  +34   -26   keditfiletype/tests/filetypestest.cpp
M  +4    -5    keditfiletype/typeslistitem.cpp
M  +3    -2    keditfiletype/typeslistitem.h

http://commits.kde.org/kde-cli-tools/b4980967138be088e65612b3e5b4e3cdfacadb09

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa32ecc..7b8e421 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@ include(CheckIncludeFiles)
 find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
     Widgets
     Svg
+    DBus
 )
 
 find_package(Qt5X11Extras ${QT_MIN_VERSION} CONFIG)
@@ -31,9 +32,12 @@ endif()
 
 find_package(KF5 REQUIRED COMPONENTS
     Config
+    IconThemes
+    I18n
     KCMUtils
     Su
     KDE4Support
+    WindowSystem
 )
 
 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/keditfiletype/CMakeLists.txt b/keditfiletype/CMakeLists.txt
index 566e76a..45badef 100644
--- a/keditfiletype/CMakeLists.txt
+++ b/keditfiletype/CMakeLists.txt
@@ -10,7 +10,6 @@ set(libfiletypes_SRCS
  mimetypewriter.cpp
  newtypedlg.cpp
  kserviceselectdlg.cpp
- sharedmimeinfoversion.cpp
 )
 
 ########### next target ###############
@@ -19,7 +18,13 @@ set(kcm_filetypes_SRCS filetypesview.cpp ${libfiletypes_SRCS})
 
 add_library(kcm_filetypes MODULE ${kcm_filetypes_SRCS})
 
-target_link_libraries(kcm_filetypes KF5::KDE4Support KF5::KIOWidgets)
+target_link_libraries(kcm_filetypes
+    KF5::ConfigWidgets
+    KF5::IconThemes
+    KF5::I18n
+    KF5::KIOWidgets
+    Qt5::DBus
+)
 
 install(TARGETS kcm_filetypes  DESTINATION ${PLUGIN_INSTALL_DIR} )
 
@@ -29,7 +34,14 @@ set(keditfiletype_SRCS keditfiletype.cpp ${libfiletypes_SRCS})
 
 add_executable(keditfiletype5 ${keditfiletype_SRCS})
 
-target_link_libraries(keditfiletype5 KF5::KDE4Support KF5::KIOWidgets)
+target_link_libraries(keditfiletype5
+    KF5::ConfigCore
+    KF5::IconThemes
+    KF5::KIOWidgets
+    KF5::WindowSystem
+    KF5::I18n
+    Qt5::DBus
+)
 if (Q_WS_X11)
   target_link_libraries(keditfiletype5 ${X11_X11_LIB})
 endif ()
diff --git a/keditfiletype/filegroupdetails.cpp b/keditfiletype/filegroupdetails.cpp
index c733ba4..579b74d 100644
--- a/keditfiletype/filegroupdetails.cpp
+++ b/keditfiletype/filegroupdetails.cpp
@@ -25,7 +25,7 @@
 #include <QButtonGroup>
 #include <QGroupBox>
 
-#include <klocale.h>
+#include <klocalizedstring.h>
 
 FileGroupDetails::FileGroupDetails(QWidget *parent)
     : QWidget( parent )
diff --git a/keditfiletype/filetypedetails.cpp b/keditfiletype/filetypedetails.cpp
index bfcbb07..71acf7e 100644
--- a/keditfiletype/filetypedetails.cpp
+++ b/keditfiletype/filetypedetails.cpp
@@ -19,28 +19,27 @@
 
 // Own
 #include "filetypedetails.h"
-#include "sharedmimeinfoversion.h"
 
 // Qt
 #include <QBoxLayout>
 #include <QButtonGroup>
 #include <QCheckBox>
+#include <QDebug>
+#include <QInputDialog>
+#include <QLabel>
 #include <QLayout>
 #include <QListWidget>
+#include <QPushButton>
 #include <QRadioButton>
-#include <QLabel>
 
 // KDE
 #include <kconfig.h>
 #include <kconfiggroup.h>
-#include <kdebug.h>
 #include <kicondialog.h>
-#include <kinputdialog.h>
 #include <klineedit.h>
+#include <klocalizedstring.h>
 #include <kiconbutton.h>
-#include <klocale.h>
-#include <kicon.h>
-#include <kpushbutton.h>
+#include <ksharedconfig.h>
 
 // Local
 #include "kservicelistwidget.h"
@@ -51,6 +50,7 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
 {
 
     QVBoxLayout* topLayout = new QVBoxLayout(this);
+    topLayout->setContentsMargins(0, 0, 0, 0);
 
     m_mimeTypeLabel = new QLabel(this);
     topLayout->addWidget(m_mimeTypeLabel, 0, Qt::AlignCenter);
@@ -66,23 +66,14 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
   QHBoxLayout *hBox = new QHBoxLayout();
   firstLayout->addLayout(hBox);
 
-    if (SharedMimeInfoVersion::supportsIcon()) {
-        iconButton = new KIconButton(firstWidget);
-        iconButton->setIconType(KIconLoader::Desktop, KIconLoader::MimeType);
-        connect(iconButton, SIGNAL(iconChanged(QString)), \
                SLOT(updateIcon(QString)));
-        iconButton->setWhatsThis( i18n("This button displays the icon associated"
-                                       " with the selected file type. Click on it to \
                choose a different icon.") );
-        iconButton->setFixedSize(70, 70);
-        iconLabel = 0;
-        hBox->addWidget(iconButton);
-    } else {
-        iconButton = 0;
-        iconLabel = new QLabel(firstWidget);
-        iconLabel->setWhatsThis( i18n("This is the icon associated with the selected \
                file type. "
-                                      "Choosing a different icon requires \
                shared-mime-info to be at least version 0.40.") );
-        iconLabel->setFixedSize(70, 70);
-        hBox->addWidget(iconLabel);
-    }
+  iconButton = new KIconButton(firstWidget);
+  iconButton->setIconType(KIconLoader::Desktop, KIconLoader::MimeType);
+  connect(iconButton, SIGNAL(iconChanged(QString)), SLOT(updateIcon(QString)));
+  iconButton->setWhatsThis( i18n("This button displays the icon associated"
+                                 " with the selected file type. Click on it to \
choose a different icon.") ); +  iconButton->setFixedSize(70, 70);
+  iconLabel = 0;
+  hBox->addWidget(iconButton);
 
   QGroupBox *gb = new QGroupBox(i18n("Filename Patterns"), firstWidget);
   hBox->addWidget(gb);
@@ -104,16 +95,16 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
   QVBoxLayout *vbox = new QVBoxLayout();
   hBox->addLayout(vbox);
 
-  addExtButton = new KPushButton(i18n("Add..."), gb);
-  addExtButton->setIcon(KIcon("list-add"));
+  addExtButton = new QPushButton(i18n("Add..."), gb);
+  addExtButton->setIcon(QIcon::fromTheme("list-add"));
   addExtButton->setEnabled(false);
   connect(addExtButton, SIGNAL(clicked()),
           this, SLOT(addExtension()));
   vbox->addWidget(addExtButton);
   addExtButton->setWhatsThis( i18n("Add a new pattern for the selected file type.") \
);  
-  removeExtButton = new KPushButton(i18n("Remove"), gb);
-  removeExtButton->setIcon(KIcon("list-remove"));
+  removeExtButton = new QPushButton(i18n("Remove"), gb);
+  removeExtButton->setIcon(QIcon::fromTheme("list-remove"));
   removeExtButton->setEnabled(false);
   connect(removeExtButton, SIGNAL(clicked()),
           this, SLOT(removeExtension()));
@@ -221,8 +212,9 @@ void FileTypeDetails::addExtension()
     return;
 
   bool ok;
-  QString ext = KInputDialog::getText( i18n( "Add New Extension" ),
-    i18n( "Extension:" ), "*.", &ok, this );
+  QString ext = QInputDialog::getText(this,
+    i18n( "Add New Extension" ), i18n( "Extension:" ),
+    QLineEdit::Normal, "*.", &ok);
   if (ok) {
     extensionLB->addItem(ext);
     QStringList patt = m_mimeTypeData->patterns();
@@ -263,6 +255,7 @@ void FileTypeDetails::updateAskSave()
 {
     if ( !m_mimeTypeData )
         return;
+    QMimeDatabase db;
 
     MimeTypeData::AutoEmbed autoEmbed = m_mimeTypeData->autoEmbed();
     if (m_mimeTypeData->isMeta() && autoEmbed == MimeTypeData::UseGroupSetting) {
@@ -287,11 +280,11 @@ void FileTypeDetails::updateAskSave()
     bool neverAsk = false;
 
     if (autoEmbed == MimeTypeData::Yes) {
-        const KMimeType::Ptr mime = KMimeType::mimeType( mimeType );
-        if (mime) {
+        const QMimeType mime = db.mimeTypeForName( mimeType );
+        if (mime.isValid()) {
             // SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC SYNC
             // NOTE: Keep this function in sync with
-            // kdelibs/kparts/browseropenorsavequestion.cpp \
BrowserOpenOrSaveQuestionPrivate::autoEmbedMimeType +            // \
kparts/src/browseropenorsavequestion.cpp \
BrowserOpenOrSaveQuestionPrivate::autoEmbedMimeType  
             // Don't ask for:
             // - html (even new tabs would ask, due to about:blank!)
@@ -300,12 +293,12 @@ void FileTypeDetails::updateAskSave()
             // e.g. postscript is different, because takes longer to read, so
             // it's more likely that the user might want to save it.
             // - multipart/* ("server push", see kmultipart)
-            if ( mime->is( "text/html" ) ||
-                 mime->is( "application/xml" ) ||
-                 mime->is( "inode/directory" ) ||
-                 mimeType.startsWith( QLatin1String("image") ) ||
-                 mime->is( "multipart/x-mixed-replace" ) ||
-                 mime->is( "multipart/replace" ) )
+            if (mime.inherits(QStringLiteral("text/html")) ||
+                mime.inherits(QStringLiteral("application/xml")) ||
+                mime.inherits(QStringLiteral("inode/directory")) ||
+                mimeType.startsWith(QLatin1String("image")) ||
+                mime.inherits(QStringLiteral("multipart/x-mixed-replace")) ||
+                mime.inherits(QStringLiteral("multipart/replace")))
             {
                 neverAsk = true;
             }
diff --git a/keditfiletype/filetypedetails.h b/keditfiletype/filetypedetails.h
index 7c0abb4..a050642 100644
--- a/keditfiletype/filetypedetails.h
+++ b/keditfiletype/filetypedetails.h
@@ -32,7 +32,7 @@ class QButtonGroup;
 class QCheckBox;
 class QRadioButton;
 class KLineEdit;
-class KPushButton;
+class QPushButton;
 class KServiceListWidget;
 
 /**
@@ -88,7 +88,7 @@ private:
     QLabel* iconLabel; // if icon cannot be changed
 
   QListWidget *extensionLB;
-  KPushButton *addExtButton, *removeExtButton;
+  QPushButton *addExtButton, *removeExtButton;
   KLineEdit *description;
   KServiceListWidget *serviceListWidget;
 
diff --git a/keditfiletype/filetypesview.cpp b/keditfiletype/filetypesview.cpp
index 886892f..51f2096 100644
--- a/keditfiletype/filetypesview.cpp
+++ b/keditfiletype/filetypesview.cpp
@@ -28,19 +28,18 @@
 #include <QLayout>
 #include <QtCore/QTimer>
 #include <QBoxLayout>
+#include <QPushButton>
 #include <QStandardPaths>
 #include <qdbusconnection.h>
 #include <qdbusmessage.h>
+#include <qdebug.h>
 
 // KDE
 #include <kbuildsycocaprogressdialog.h>
-#include <kdebug.h>
 #include <klineedit.h>
-#include <klocale.h>
-#include <kpushbutton.h>
+#include <klocalizedstring.h>
 #include <kservicetypeprofile.h>
 
-#include <kicon.h>
 #include <ksycoca.h>
 
 // Local
@@ -118,15 +117,15 @@ FileTypesView::FileTypesView(QWidget *parent, const \
QVariantList &)  QHBoxLayout* btnsLay = new QHBoxLayout();
   leftLayout->addLayout(btnsLay);
   btnsLay->addStretch(1);
-  KPushButton *addTypeB = new KPushButton(i18n("Add..."), this);
-  addTypeB->setIcon(KIcon("list-add"));
+  QPushButton *addTypeB = new QPushButton(i18n("Add..."), this);
+  addTypeB->setIcon(QIcon::fromTheme("list-add"));
   connect(addTypeB, SIGNAL(clicked()), SLOT(addType()));
   btnsLay->addWidget(addTypeB);
 
   addTypeB->setWhatsThis( i18n("Click here to add a new file type.") );
 
-  m_removeTypeB = new KPushButton(i18n("&Remove"), this);
-  m_removeTypeB->setIcon(KIcon("list-remove"));
+  m_removeTypeB = new QPushButton(i18n("&Remove"), this);
+  m_removeTypeB->setIcon(QIcon::fromTheme("list-remove"));
   connect(m_removeTypeB, SIGNAL(clicked()), SLOT(removeType()));
   btnsLay->addWidget(m_removeTypeB);
   m_removeTypeB->setEnabled(false);
@@ -172,9 +171,9 @@ void FileTypesView::setDirty(bool state)
 }
 
 // To order the mimetype list
-static bool mimeTypeLessThan(const KMimeType::Ptr& m1, const KMimeType::Ptr& m2)
+static bool mimeTypeLessThan(const QMimeType& m1, const QMimeType& m2)
 {
-    return m1->name() < m2->name();
+    return m1.name() < m2.name();
 }
 
 // Note that this method loses any newly-added (and not saved yet) mimetypes.
@@ -185,11 +184,12 @@ void FileTypesView::readFileTypes()
     m_majorMap.clear();
     m_itemList.clear();
 
-    KMimeType::List mimetypes = KMimeType::allMimeTypes();
+    QMimeDatabase db;
+    QList<QMimeType> mimetypes = db.allMimeTypes();
     qSort(mimetypes.begin(), mimetypes.end(), mimeTypeLessThan);
-    KMimeType::List::const_iterator it2(mimetypes.constBegin());
+    auto it2(mimetypes.constBegin());
     for (; it2 != mimetypes.constEnd(); ++it2) {
-        const QString mimetype = (*it2)->name();
+        const QString mimetype = (*it2).name();
         const int index = mimetype.indexOf('/');
         const QString maj = mimetype.left(index);
         const QString min = mimetype.right(mimetype.length() - index+1);
@@ -362,16 +362,16 @@ void FileTypesView::updateRemoveButton(TypesListItem* tlitem)
             } else {
                 // We can only remove mimetypes that we defined ourselves, not those \
from freedesktop.org  const QString mimeType = mimeTypeData.name();
-                kDebug() << mimeType << "hasDefinitionFile:" << \
MimeTypeWriter::hasDefinitionFile(mimeType); +                qDebug() << mimeType << \
"hasDefinitionFile:" << MimeTypeWriter::hasDefinitionFile(mimeType);  if \
(MimeTypeWriter::hasDefinitionFile(mimeType)) {  canRemove = true;
 
                     // Is there a global definition for it?
                     const QStringList mimeFiles = \
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/") \
                + mimeType + ".xml" );
-                    kDebug() << mimeFiles;
+                    qDebug() << mimeFiles;
                     if (mimeFiles.count() >= 2 /*a local and a global*/) {
                         m_removeButtonSaysRevert = true;
-                        kDebug() << removedList;
+                        qDebug() << removedList;
                         if (removedList.contains(mimeType)) {
                             canRemove = false; // already on the "to be reverted" \
list, user needs to save now  }
@@ -415,7 +415,7 @@ void FileTypesView::save()
   while ( it1 != m_majorMap.end() ) {
     TypesListItem *tli = *it1;
     if (tli->mimeTypeData().isDirty()) {
-      kDebug() << "Entry " << tli->name() << " is dirty. Saving.";
+      qDebug() << "Entry " << tli->name() << " is dirty. Saving.";
       if (tli->mimeTypeData().sync())
           needUpdateMimeDb = true;
       didIt = true;
@@ -426,7 +426,7 @@ void FileTypesView::save()
         if (tli->mimeTypeData().isDirty()) {
             if (tli->mimeTypeData().isServiceListDirty())
                 needUpdateSycoca = true;
-            kDebug() << "Entry " << tli->name() << " is dirty. Saving.";
+            qDebug() << "Entry " << tli->name() << " is dirty. Saving.";
             if (tli->mimeTypeData().sync())
                 needUpdateMimeDb = true;
             didIt = true;
@@ -470,7 +470,7 @@ void FileTypesView::load()
 
 void FileTypesView::slotDatabaseChanged(const QStringList& changedResources)
 {
-    kDebug() << changedResources;
+    qDebug() << changedResources;
     if ( changedResources.contains("xdgdata-mime") // changes in mimetype \
                definitions
          || changedResources.contains("services") ) { // changes in .desktop files
 
diff --git a/keditfiletype/filetypesview.h b/keditfiletype/filetypesview.h
index 82fd0ab..693c18a 100644
--- a/keditfiletype/filetypesview.h
+++ b/keditfiletype/filetypesview.h
@@ -35,7 +35,7 @@
 class QLabel;
 class QTreeWidget;
 class QTreeWidgetItem;
-class KPushButton;
+class QPushButton;
 class KLineEdit;
 class FileTypeDetails;
 class FileGroupDetails;
@@ -69,7 +69,7 @@ private:
 
 private:
   QTreeWidget *typesLV;
-  KPushButton *m_removeTypeB;
+  QPushButton *m_removeTypeB;
 
   QStackedWidget * m_widgetStack;
   FileTypeDetails * m_details;
diff --git a/keditfiletype/keditfiletype.cpp b/keditfiletype/keditfiletype.cpp
index aab0830..f061b4a 100644
--- a/keditfiletype/keditfiletype.cpp
+++ b/keditfiletype/keditfiletype.cpp
@@ -22,20 +22,25 @@
 #include "mimetypewriter.h"
 
 // Qt
-#include <qdbusconnection.h>
-#include <qdbusmessage.h>
-#include <QtCore/QFile>
+#include <QApplication>
+#include <QBoxLayout>
+#include <QCommandLineOption>
+#include <QCommandLineParser>
+#include <QDBusConnection>
+#include <QDBusMessage>
+#include <QDebug>
+#include <QDialogButtonBox>
+#include <QFile>
+#include <QPushButton>
 
 // KDE
-#include <kapplication.h>
-#include <k4aboutdata.h>
+#include <kaboutdata.h>
 #include <kbuildsycocaprogressdialog.h>
-#include <kdebug.h>
-#include <kcmdlineargs.h>
+#include <klocalizedstring.h>
+
 #include <ksycoca.h>
 #include <kservicetypeprofile.h>
 
-#include <klocale.h>
 #include <kwindowsystem.h>
 
 // Local
@@ -44,12 +49,10 @@
 
 
 FileTypeDialog::FileTypeDialog( MimeTypeData* mime )
-  : KDialog( 0 ),
+  : QDialog( 0 ),
     m_mimeTypeData(mime)
 {
-  setButtons( Cancel | Apply | Ok );
-
-  init();
+    init();
 }
 
 FileTypeDialog::~FileTypeDialog()
@@ -61,16 +64,28 @@ void FileTypeDialog::init()
 {
     m_details = new FileTypeDetails( this );
     m_details->setMimeTypeData( m_mimeTypeData );
+    connect(m_details, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
+
+    m_buttonBox = new QDialogButtonBox;
+    m_buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | \
QDialogButtonBox::Cancel); +    connect(m_buttonBox, SIGNAL(accepted()), \
SLOT(accept())); +    connect(m_buttonBox->button(QDialogButtonBox::Apply), \
SIGNAL(clicked()), SLOT(save())); +    connect(m_buttonBox, SIGNAL(rejected()), \
SLOT(reject()));  
     // This code is very similar to kcdialog.cpp
-    setMainWidget( m_details );
-    connect(m_details, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
+    QVBoxLayout* layout = new QVBoxLayout(this);
+    layout->addWidget(m_details);
+    layout->addWidget(m_buttonBox);
     // TODO setHelp()
-    enableButton(Apply, false);
+
+    setApplyButtonEnabled(false);
 
     connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), \
                SLOT(slotDatabaseChanged(QStringList)));
-    connect( this, SIGNAL( okClicked() ), SLOT( slotOk() ) );
-    connect( this, SIGNAL( applyClicked() ), SLOT( slotApply() ) );
+}
+
+void FileTypeDialog::setApplyButtonEnabled(bool enabled)
+{
+    m_buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enabled);
 }
 
 void FileTypeDialog::save()
@@ -88,27 +103,21 @@ void FileTypeDialog::save()
     }
 }
 
-void FileTypeDialog::slotOk()
-{
-  save();
-  accept();
-}
-
-void FileTypeDialog::slotApply()
+void FileTypeDialog::accept()
 {
   save();
+  QDialog::accept();
 }
 
 void FileTypeDialog::clientChanged(bool state)
 {
-  // enable/disable buttons
-  enableButton(User1, state);
-  enableButton(Apply, state);
+    m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(state);
+    m_buttonBox->button(QDialogButtonBox::Apply)->setEnabled(state);
 }
 
 void FileTypeDialog::slotDatabaseChanged(const QStringList& changedResources)
 {
-    kDebug() << changedResources;
+    qDebug() << changedResources;
     if ( changedResources.contains("xdgdata-mime") // changes in mimetype \
                definitions
          || changedResources.contains("services") ) { // changes in .desktop files
         m_details->refresh();
@@ -119,81 +128,85 @@ void FileTypeDialog::slotDatabaseChanged(const QStringList& \
changedResources)  
 int main(int argc, char ** argv)
 {
-  K4AboutData aboutData( "keditfiletype", "filetypes", ki18n("KEditFileType"), \
                "1.0",
-                        ki18n("KDE file type editor - simplified version for editing \
                a single file type"),
-                        K4AboutData::License_GPL,
-                        ki18n("(c) 2000, KDE developers") );
-  aboutData.addAuthor(ki18n("Preston Brown"),KLocalizedString(), "pbrown@kde.org");
-  aboutData.addAuthor(ki18n("David Faure"),KLocalizedString(), "faure@kde.org");
-  aboutData.setProgramIconName("preferences-desktop-filetype-association");
-
-  KCmdLineArgs::init( argc, argv, &aboutData );
-
-  KCmdLineOptions options;
-  options.add("parent <winid>", ki18n("Makes the dialog transient for the window \
                specified by winid"));
-  options.add("+mimetype", ki18n("File type to edit (e.g. text/html)"));
-  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
-  KApplication app;
-  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-
-  if (args->count() == 0)
-    KCmdLineArgs::usage();
-
-  QString arg = args->arg(0);
-  MimeTypeData* mimeTypeData = 0;
-  const bool createType = arg.startsWith('*');
-  if ( createType ) {
-      QString mimeString = "application/x-kdeuser%1";
-      QString mimeTypeName;
-      int inc = 0;
-      bool ok = false;
-      do {
-          ++inc;
-          mimeTypeName = mimeString.arg(inc);
-          ok = !KMimeType::mimeType(mimeTypeName);
-      } while (!ok);
-
-      QStringList patterns;
-      if ( arg.length() > 2 )
-          patterns << arg.toLower() << arg.toUpper();
-      QString comment;
-      if ( arg.startsWith( QLatin1String("*.") ) && arg.length() >= 3 ) {
-          const QString type = arg.mid( 3 ).prepend( arg[2].toUpper() );
-          comment = i18n( "%1 File", type );
-      }
-
-      mimeTypeData = new MimeTypeData(mimeTypeName, true); // new mimetype
-      mimeTypeData->setComment(comment);
-      mimeTypeData->setPatterns(patterns);
-  }
-  else {
-      const QString mimeTypeName = arg;
-      KMimeType::Ptr mime = KMimeType::mimeType(mimeTypeName, \
                KMimeType::ResolveAliases);
-      if (!mime) {
-          kError() << "Mimetype" << mimeTypeName << "not found" ;
-          return 1;
-      }
-
-      mimeTypeData = new MimeTypeData(mime);
-  }
-
-  FileTypeDialog dlg( mimeTypeData );
-  if( args->isSet( "parent" )) {
-    bool ok;
-    long id = QString(args->getOption("parent")).toLong(&ok);
-    if (ok)
-      KWindowSystem::setMainWindow( &dlg, (WId)id );
-  }
-  args->clear();
-  if ( !createType )
-    dlg.setCaption( i18n("Edit File Type %1", mimeTypeData->name()) );
-  else {
-    dlg.setCaption( i18n("Create New File Type %1", mimeTypeData->name()) );
-    dlg.enableButton( KDialog::Apply, true );
-  }
-
-  dlg.show(); // non-modal
-
-  return app.exec();
+    QApplication app(argc, argv);
+
+    KAboutData aboutData( "keditfiletype", i18n("KEditFileType"), "1.0",
+       i18n("KDE file type editor - simplified version for editing a single file \
type"), +       KAboutLicense::GPL,
+       i18n("(c) 2000, KDE developers") );
+    aboutData.addAuthor(i18n("Preston Brown"), QString(), "pbrown@kde.org");
+    aboutData.addAuthor(i18n("David Faure"), QString(), "faure@kde.org");
+    aboutData.setProgramIconName("preferences-desktop-filetype-association");
+    KAboutData::setApplicationData(aboutData);
+
+    QCommandLineParser parser;
+    aboutData.setupCommandLine(&parser);
+    parser.addHelpOption();
+    parser.addVersionOption();
+    parser.addOption(QCommandLineOption(QStringList() << "parent", i18n("Makes the \
dialog transient for the window specified by winid"), "winid")); +    \
parser.addPositionalArgument("mimetype", i18n("File type to edit (e.g. text/html)")); \
+ +    parser.process(app);
+    aboutData.processCommandLine(&parser);
+
+    if (parser.positionalArguments().count() == 0)
+        parser.showHelp();
+
+    QMimeDatabase db;
+    QString arg = parser.positionalArguments().first();
+    MimeTypeData* mimeTypeData = 0;
+    const bool createType = arg.startsWith('*');
+    if ( createType ) {
+        QString mimeString = "application/x-kdeuser%1";
+        QString mimeTypeName;
+        int inc = 0;
+        bool ok = false;
+        do {
+            ++inc;
+            mimeTypeName = mimeString.arg(inc);
+            ok = !db.mimeTypeForName(mimeTypeName).isValid();
+        } while (!ok);
+
+        QStringList patterns;
+        if ( arg.length() > 2 )
+            patterns << arg.toLower() << arg.toUpper();
+        QString comment;
+        if ( arg.startsWith( QLatin1String("*.") ) && arg.length() >= 3 ) {
+            const QString type = arg.mid( 3 ).prepend( arg[2].toUpper() );
+            comment = i18n( "%1 File", type );
+        }
+
+        mimeTypeData = new MimeTypeData(mimeTypeName, true); // new mimetype
+        mimeTypeData->setComment(comment);
+        mimeTypeData->setPatterns(patterns);
+    }
+    else {
+        const QString mimeTypeName = arg;
+        QMimeType mime = db.mimeTypeForName(mimeTypeName);
+        if (!mime.isValid()) {
+            qCritical() << "Mimetype" << mimeTypeName << "not found" ;
+            return 1;
+        }
+
+        mimeTypeData = new MimeTypeData(mime);
+    }
+
+    FileTypeDialog dlg( mimeTypeData );
+    if( parser.isSet( "parent" )) {
+        bool ok;
+        long id = parser.value("parent").toLong(&ok);
+        if (ok)
+            KWindowSystem::setMainWindow( &dlg, (WId)id );
+    }
+    if ( !createType )
+        dlg.setWindowTitle( i18n("Edit File Type %1", mimeTypeData->name()) );
+    else {
+        dlg.setWindowTitle( i18n("Create New File Type %1", mimeTypeData->name()) );
+        dlg.setApplyButtonEnabled(true);
+    }
+
+    dlg.show(); // non-modal
+
+    return app.exec();
 }
 
diff --git a/keditfiletype/keditfiletype.h b/keditfiletype/keditfiletype.h
index 0b235ce..9a955b6 100644
--- a/keditfiletype/keditfiletype.h
+++ b/keditfiletype/keditfiletype.h
@@ -20,33 +20,40 @@
 #ifndef __keditfiletype_h
 #define __keditfiletype_h
 
-#include <kdialog.h>
-#include <kmimetype.h>
+#include <QDialog>
+#include <QMimeType>
+#include <QMimeDatabase>
+
+class QDialogButtonBox;
 
 class MimeTypeData;
 class FileTypeDetails;
 
 // A dialog for ONE file type to be edited.
-class FileTypeDialog : public KDialog
+class FileTypeDialog : public QDialog
 {
     Q_OBJECT
 public:
     FileTypeDialog(MimeTypeData* mime);
-    ~FileTypeDialog();
+    virtual ~FileTypeDialog();
+
+    void setApplyButtonEnabled(bool);
+
+public Q_SLOTS:
+    void accept() Q_DECL_OVERRIDE;
 
 protected Q_SLOTS:
-  virtual void slotOk();
-  virtual void slotApply();
-  void clientChanged(bool state);
-  void slotDatabaseChanged(const QStringList& changedResources);
+    void clientChanged(bool state);
+    void slotDatabaseChanged(const QStringList& changedResources);
 
-protected:
-  void save();
+private Q_SLOTS:
+    void save();
 
 private:
-  void init();
-  FileTypeDetails * m_details;
-  MimeTypeData* m_mimeTypeData;
+    void init();
+    FileTypeDetails * m_details;
+    MimeTypeData* m_mimeTypeData;
+    QDialogButtonBox* m_buttonBox;
 };
 
 #endif
diff --git a/keditfiletype/kservicelistwidget.cpp \
b/keditfiletype/kservicelistwidget.cpp index 88dface..64fc7f1 100644
--- a/keditfiletype/kservicelistwidget.cpp
+++ b/keditfiletype/kservicelistwidget.cpp
@@ -25,21 +25,17 @@
 #include <unistd.h>
 
 // Qt
+#include <QBoxLayout>
+#include <QDebug>
 #include <QLayout>
-#include <QHBoxLayout>
+#include <QPushButton>
 #include <QStandardPaths>
 
 // KDE
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
 #include <kmessagebox.h>
-#include <knotification.h>
 #include <kopenwithdialog.h>
 #include <kpropertiesdialog.h>
-#include <kpushbutton.h>
-#include <kicon.h>
-#include <kstandarddirs.h>
 
 // Local
 #include "kserviceselectdlg.h"
@@ -59,10 +55,6 @@ KServiceListItem::KServiceListItem( const KService::Ptr& pService, \
int kind )  localPath = pService->locateLocal();
 }
 
-bool KServiceListItem::isImmutable() const
-{
-    return !KStandardDirs::checkAccess(localPath, W_OK);
-}
 
 
 
@@ -99,8 +91,8 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
   QVBoxLayout *btnsLay= new QVBoxLayout();
   lay->addLayout(btnsLay);
 
-  servUpButton = new KPushButton(i18n("Move &Up"), this);
-  servUpButton->setIcon(KIcon("arrow-up"));
+  servUpButton = new QPushButton(i18n("Move &Up"), this);
+  servUpButton->setIcon(QIcon::fromTheme("arrow-up"));
   servUpButton->setEnabled(false);
   connect(servUpButton, SIGNAL(clicked()), SLOT(promoteService()));
   btnsLay->addWidget(servUpButton);
@@ -113,8 +105,8 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
                    i18n("Assigns a higher priority to the selected\n"
                         "service, moving it up in the list."));
 
-  servDownButton = new KPushButton(i18n("Move &Down"), this);
-  servDownButton->setIcon(KIcon("arrow-down"));
+  servDownButton = new QPushButton(i18n("Move &Down"), this);
+  servDownButton->setIcon(QIcon::fromTheme("arrow-down"));
   servDownButton->setEnabled(false);
   connect(servDownButton, SIGNAL(clicked()), SLOT(demoteService()));
   btnsLay->addWidget(servDownButton);
@@ -126,24 +118,24 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget \
*parent)  i18n("Assigns a lower priority to the selected\n"
                         "service, moving it down in the list."));
 
-  servNewButton = new KPushButton(i18n("Add..."), this);
-  servNewButton->setIcon(KIcon("list-add"));
+  servNewButton = new QPushButton(i18n("Add..."), this);
+  servNewButton->setIcon(QIcon::fromTheme("list-add"));
   servNewButton->setEnabled(false);
   connect(servNewButton, SIGNAL(clicked()), SLOT(addService()));
   btnsLay->addWidget(servNewButton);
   servNewButton->setWhatsThis( i18n( "Add a new application for this file type." ) \
);  
 
-  servEditButton = new KPushButton(i18n("Edit..."), this);
-  servEditButton->setIcon(KIcon("edit-rename"));
+  servEditButton = new QPushButton(i18n("Edit..."), this);
+  servEditButton->setIcon(QIcon::fromTheme("edit-rename"));
   servEditButton->setEnabled(false);
   connect(servEditButton, SIGNAL(clicked()), SLOT(editService()));
   btnsLay->addWidget(servEditButton);
   servEditButton->setWhatsThis( i18n( "Edit command line of the selected \
application." ) );  
 
-  servRemoveButton = new KPushButton(i18n("Remove"), this);
-  servRemoveButton->setIcon(KIcon("list-remove"));
+  servRemoveButton = new QPushButton(i18n("Remove"), this);
+  servRemoveButton->setIcon(QIcon::fromTheme("list-remove"));
   servRemoveButton->setEnabled(false);
   connect(servRemoveButton, SIGNAL(clicked()), SLOT(removeService()));
   btnsLay->addWidget(servRemoveButton);
@@ -193,13 +185,11 @@ void KServiceListWidget::setMimeTypeData( MimeTypeData * \
mimeTypeData )  void KServiceListWidget::promoteService()
 {
   if (!servicesLB->isEnabled()) {
-    KNotification::beep();
     return;
   }
 
   int selIndex = servicesLB->currentRow();
   if (selIndex == 0) {
-    KNotification::beep();
     return;
   }
 
@@ -216,13 +206,11 @@ void KServiceListWidget::promoteService()
 void KServiceListWidget::demoteService()
 {
   if (!servicesLB->isEnabled()) {
-    KNotification::beep();
     return;
   }
 
   int selIndex = servicesLB->currentRow();
   if (selIndex == servicesLB->count() - 1) {
-    KNotification::beep();
     return;
   }
 
@@ -365,19 +353,10 @@ void KServiceListWidget::removeService()
   int selected = servicesLB->currentRow();
 
   if ( selected >= 0 ) {
-    // Check if service is associated with this mimetype or with one of its parents
-    KServiceListItem *serviceItem = static_cast<KServiceListItem \
                *>(servicesLB->item(selected));
-    if (serviceItem->isImmutable())
-    {
-       KMessageBox::sorry(this, i18n("You are not authorized to remove this \
                service."));
-    }
-    else
-    {
-       delete servicesLB->takeItem( selected );
-       updatePreferredServices();
+    delete servicesLB->takeItem( selected );
+    updatePreferredServices();
 
-       emit changed(true);
-    }
+    emit changed(true);
   }
 
     // Update buttons and service list again (e.g. to re-add "None")
diff --git a/keditfiletype/kservicelistwidget.h b/keditfiletype/kservicelistwidget.h
index c817d24..fbc488a 100644
--- a/keditfiletype/kservicelistwidget.h
+++ b/keditfiletype/kservicelistwidget.h
@@ -25,15 +25,16 @@
 #include <QGroupBox>
 #include <QListWidget>
 #include <kservice.h>
+
+class QPushButton;
+
 class MimeTypeData;
-class KPushButton;
 class KService;
 
 class KServiceListItem : public QListWidgetItem
 {
 public:
     KServiceListItem( const KService::Ptr& pService, int kind );
-    bool isImmutable() const;
     QString storageId;
     QString desktopPath;
     QString localPath;
@@ -71,8 +72,8 @@ protected:
 private:
   int m_kind;
   QListWidget *servicesLB;
-  KPushButton *servUpButton, *servDownButton;
-  KPushButton *servNewButton, *servEditButton, *servRemoveButton;
+  QPushButton *servUpButton, *servDownButton;
+  QPushButton *servNewButton, *servEditButton, *servRemoveButton;
   MimeTypeData *m_mimeTypeData;
 };
 
diff --git a/keditfiletype/kserviceselectdlg.cpp \
b/keditfiletype/kserviceselectdlg.cpp index 09c7c5d..e9fcabc 100644
--- a/keditfiletype/kserviceselectdlg.cpp
+++ b/keditfiletype/kserviceselectdlg.cpp
@@ -19,23 +19,25 @@
 #include "kserviceselectdlg.moc"
 #include "kservicelistwidget.h"
 
-#include <klocale.h>
-#include <QVBoxLayout>
+#include <QDialogButtonBox>
 #include <QLabel>
+#include <QVBoxLayout>
+
+#include <KLocalizedString>
 
 KServiceSelectDlg::KServiceSelectDlg( const QString& /*serviceType*/, const QString& \
                /*value*/, QWidget *parent )
-    : KDialog( parent )
+    : QDialog( parent )
 {
     setObjectName( QLatin1String( "serviceSelectDlg" ) );
     setModal( true );
-    setCaption( i18n( "Add Service" ) );
-    setButtons( Ok | Cancel );
+    setWindowTitle( i18n( "Add Service" ) );
 
-    QWidget *vbox = new QWidget( this );
-    QVBoxLayout *layout = new QVBoxLayout( vbox );
+    QVBoxLayout *layout = new QVBoxLayout(this);
 
-    layout->addWidget( new QLabel( i18n( "Select service:" ), vbox ) );
-    m_listbox=new KListWidget( vbox );
+    layout->addWidget( new QLabel( i18n( "Select service:" ) ) );
+    m_listbox=new QListWidget();
+    m_buttonBox = new QDialogButtonBox;
+    m_buttonBox->setStandardButtons(QDialogButtonBox::Ok | \
QDialogButtonBox::Cancel);  
     // Can't make a KTrader query since we don't have a servicetype to give,
     // we want all services that are not applications.......
@@ -53,20 +55,16 @@ KServiceSelectDlg::KServiceSelectDlg( const QString& \
/*serviceType*/, const QStr  m_listbox->setMinimumHeight(350);
     m_listbox->setMinimumWidth(400);
     layout->addWidget( m_listbox );
-    connect(m_listbox,SIGNAL(itemDoubleClicked(QListWidgetItem*)),SLOT(slotOk()));
-    connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );
-    setMainWidget(vbox);
+    layout->addWidget( m_buttonBox );
+    connect(m_listbox,SIGNAL(itemDoubleClicked(QListWidgetItem*)),SLOT(accept()));
+    connect(m_buttonBox, SIGNAL(accepted()), SLOT(accept()));
+    connect(m_buttonBox, SIGNAL(rejected()), SLOT(reject()));
 }
 
 KServiceSelectDlg::~KServiceSelectDlg()
 {
 }
 
-void KServiceSelectDlg::slotOk()
-{
-   accept();
-}
-
 KService::Ptr KServiceSelectDlg::service()
 {
     int selIndex = m_listbox->currentRow();
diff --git a/keditfiletype/kserviceselectdlg.h b/keditfiletype/kserviceselectdlg.h
index 8e6d0d0..3acabfb 100644
--- a/keditfiletype/kserviceselectdlg.h
+++ b/keditfiletype/kserviceselectdlg.h
@@ -17,10 +17,15 @@
 
 #ifndef __kserviceselectdlg_h
 #define __kserviceselectdlg_h
-#include <kdialog.h>
+
+#include <QDialog>
+#include <QListWidget>
+
 #include <kservice.h>
-#include <klistwidget.h>
-class KServiceSelectDlg : public KDialog
+
+class QDialogButtonBox;
+
+class KServiceSelectDlg : public QDialog
 {
     Q_OBJECT
 public:
@@ -41,10 +46,10 @@ public:
      * @return the chosen service
      */
     KService::Ptr service();
-protected slots:
-    void slotOk();
+
 private:
-    KListWidget * m_listbox;
+    QListWidget * m_listbox;
+    QDialogButtonBox* m_buttonBox;
 };
 
 #endif
diff --git a/keditfiletype/mimetypedata.cpp b/keditfiletype/mimetypedata.cpp
index 057113f..65af59c 100644
--- a/keditfiletype/mimetypedata.cpp
+++ b/keditfiletype/mimetypedata.cpp
@@ -19,10 +19,9 @@
 */
 
 #include "mimetypedata.h"
-#include "sharedmimeinfoversion.h"
 #include <kprotocolmanager.h>
 #include "mimetypewriter.h"
-#include <kdebug.h>
+#include <qdebug.h>
 #include <kservice.h>
 #include <ksharedconfig.h>
 #include <kconfiggroup.h>
@@ -37,21 +36,23 @@ MimeTypeData::MimeTypeData(const QString& major)
       m_isGroup(true),
       m_appServicesModified(false),
       m_embedServicesModified(false),
+      m_userSpecifiedIconModified(false),
       m_major(major)
 {
     m_autoEmbed = readAutoEmbed();
 }
 
-MimeTypeData::MimeTypeData(const KMimeType::Ptr mime)
+MimeTypeData::MimeTypeData(const QMimeType& mime)
     : m_mimetype(mime),
       m_askSave(AskSaveDefault), // TODO: the code for initializing this is missing. \
FileTypeDetails initializes the checkbox instead...  m_bNewItem(false),
       m_bFullInit(false),
       m_isGroup(false),
       m_appServicesModified(false),
-      m_embedServicesModified(false)
+      m_embedServicesModified(false),
+      m_userSpecifiedIconModified(false)
 {
-    const QString mimeName = m_mimetype->name();
+    const QString mimeName = m_mimetype.name();
     const int index = mimeName.indexOf('/');
     if (index != -1) {
         m_major = mimeName.left(index);
@@ -59,17 +60,18 @@ MimeTypeData::MimeTypeData(const KMimeType::Ptr mime)
     } else {
         m_major = mimeName;
     }
-    initFromKMimeType();
+    initFromQMimeType();
 }
 
 MimeTypeData::MimeTypeData(const QString& mimeName, bool)
-    : m_mimetype(0),
-      m_askSave(AskSaveDefault),
+    : m_askSave(AskSaveDefault),
       m_bNewItem(true),
       m_bFullInit(false),
       m_isGroup(false),
       m_appServicesModified(false),
-      m_embedServicesModified(false)
+      m_embedServicesModified(false),
+      m_userSpecifiedIconModified(false)
+
 {
     const int index = mimeName.indexOf('/');
     if (index != -1) {
@@ -82,10 +84,10 @@ MimeTypeData::MimeTypeData(const QString& mimeName, bool)
     // all the rest is empty by default
 }
 
-void MimeTypeData::initFromKMimeType()
+void MimeTypeData::initFromQMimeType()
 {
-    m_comment = m_mimetype->comment();
-    setPatterns(m_mimetype->patterns());
+    m_comment = m_mimetype.comment();
+    setPatterns(m_mimetype.globPatterns());
     m_autoEmbed = readAutoEmbed();
 
     // Parse XML file to find out if the user specified a custom icon name
@@ -141,7 +143,7 @@ MimeTypeData::AutoEmbed MimeTypeData::readAutoEmbed() const
     } else {
         if (group.hasKey(key))
             return group.readEntry(key, false) ? Yes : No;
-        // TODO if ( !mimetype->property( "X-KDE-LocalProtocol" \
).toString().isEmpty() ) +        // TODO if ( !mimetype.property( \
                "X-KDE-LocalProtocol" ).toString().isEmpty() )
         // TODO    return MimeTypeData::Yes; // embed by default for zip, tar etc.
         return MimeTypeData::UseGroupSetting;
     }
@@ -192,7 +194,11 @@ bool MimeTypeData::isEssential() const
 
 void MimeTypeData::setUserSpecifiedIcon(const QString& icon)
 {
+    if (icon == m_userSpecifiedIcon) {
+        return;
+    }
     m_userSpecifiedIcon = icon;
+    m_userSpecifiedIconModified = true;
 }
 
 QStringList MimeTypeData::getAppOffers() const
@@ -247,24 +253,24 @@ bool MimeTypeData::isMimeTypeDirty() const
     if (m_bNewItem)
         return true;
 
-    if (!m_mimetype) {
-        kWarning() << "MimeTypeData for" << name() << "says 'not new' but is without \
a mimetype? Should not happen."; +    if (!m_mimetype.isValid()) {
+        qWarning() << "MimeTypeData for" << name() << "says 'not new' but is without \
a mimetype? Should not happen.";  return true;
     }
 
-    if (m_mimetype->comment() != m_comment) {
-        kDebug() << "Mimetype Comment Dirty: old=" << m_mimetype->comment() << \
"m_comment=" << m_comment; +    if (m_mimetype.comment() != m_comment) {
+        qDebug() << "Mimetype Comment Dirty: old=" << m_mimetype.comment() << \
"m_comment=" << m_comment;  return true;
     }
-    if (m_mimetype->userSpecifiedIconName() != m_userSpecifiedIcon) {
-        kDebug() << "Mimetype Icon Dirty: old=" << m_mimetype->iconName() << \
"m_userSpecifiedIcon=" << m_userSpecifiedIcon; +    if (m_userSpecifiedIconModified) \
{ +        qDebug() << "m_userSpecifiedIcon has changed. Now set to" << \
m_userSpecifiedIcon;  return true;
     }
 
-    QStringList storedPatterns = m_mimetype->patterns();
+    QStringList storedPatterns = m_mimetype.globPatterns();
     storedPatterns.sort(); // see ctor
     if ( storedPatterns != m_patterns) {
-        kDebug() << "Mimetype Patterns Dirty: old=" << storedPatterns
+        qDebug() << "Mimetype Patterns Dirty: old=" << storedPatterns
                  << "m_patterns=" << m_patterns;
         return true;
     }
@@ -282,7 +288,7 @@ bool MimeTypeData::isServiceListDirty() const
 bool MimeTypeData::isDirty() const
 {
     if ( m_bNewItem ) {
-        kDebug() << "New item, need to save it";
+        qDebug() << "New item, need to save it";
         return true;
     }
 
@@ -334,17 +340,13 @@ bool MimeTypeData::sync()
     if (isMimeTypeDirty()) {
         MimeTypeWriter mimeTypeWriter(name());
         mimeTypeWriter.setComment(m_comment);
-        if (SharedMimeInfoVersion::supportsIcon()) {
-            // Very important: don't write <icon> if shared-mime-info doesn't \
                support it,
-            // it would abort on it!
-            if (!m_userSpecifiedIcon.isEmpty()) {
-                mimeTypeWriter.setIconName(m_userSpecifiedIcon);
-            }
+        if (!m_userSpecifiedIcon.isEmpty()) {
+            mimeTypeWriter.setIconName(m_userSpecifiedIcon);
         }
         mimeTypeWriter.setPatterns(m_patterns);
         if (!mimeTypeWriter.write())
             return false;
-
+        m_userSpecifiedIconModified = false;
         needUpdateMimeDb = true;
     }
 
@@ -393,7 +395,7 @@ static QStringList collectStorageIds(const QStringList& services)
 
         KService::Ptr pService = KService::serviceByStorageId(*it);
         if (!pService) {
-            kWarning() << "service with storage id" << *it << "not found";
+            qWarning() << "service with storage id" << *it << "not found";
             continue; // Where did that one go?
         }
 
@@ -434,17 +436,17 @@ void MimeTypeData::refresh()
 {
     if (m_isGroup)
         return;
-
-    m_mimetype = KMimeType::mimeType( name() );
-    if (m_mimetype) {
+    QMimeDatabase db;
+    m_mimetype = db.mimeTypeForName( name() );
+    if (m_mimetype.isValid()) {
         if (m_bNewItem) {
-            kDebug() << "OK, created" << name();
+            qDebug() << "OK, created" << name();
             m_bNewItem = false; // if this was a new mimetype, we just created it
         }
         if (!isMimeTypeDirty()) {
             // Update from the xml, in case something was changed from out of this \
                kcm
             // (e.g. using KOpenWithDialog, or keditfiletype + kcmshell filetypes)
-            initFromKMimeType();
+            initFromQMimeType();
         }
         if (!m_appServicesModified && !m_embedServicesModified) {
             m_bFullInit = false; // refresh services too
@@ -468,7 +470,7 @@ void MimeTypeData::setAskSave(bool _askSave)
 bool MimeTypeData::canUseGroupSetting() const
 {
     // "Use group settings" isn't available for zip, tar etc.; those have a builtin \
                default...
-    if (!m_mimetype) // e.g. new mimetype
+    if (!m_mimetype.isValid()) // e.g. new mimetype
         return true;
     const bool hasLocalProtocolRedirect = \
!KProtocolManager::protocolForArchiveMimetype(name()).isEmpty();  return \
!hasLocalProtocolRedirect; @@ -478,7 +480,7 @@ void MimeTypeData::setPatterns(const \
QStringList &p)  {
     m_patterns = p;
     // Sort them, since update-mime-database doesn't respect order (order of globs \
                file != order of xml),
-    // and this code says things like if (m_mimetype->patterns() == m_patterns).
+    // and this code says things like if (m_mimetype.patterns() == m_patterns).
     // We could also sort in KMimeType::setPatterns but this would just slow down \
the  // normal use case (anything else than this KCM) for no good reason.
     m_patterns.sort();
@@ -514,7 +516,7 @@ QString MimeTypeData::icon() const
 {
     if (!m_userSpecifiedIcon.isEmpty())
         return m_userSpecifiedIcon;
-    if (m_mimetype)
-        return m_mimetype->iconName();
+    if (m_mimetype.isValid())
+        return m_mimetype.iconName();
     return QString();
 }
diff --git a/keditfiletype/mimetypedata.h b/keditfiletype/mimetypedata.h
index 042b043..5b00c07 100644
--- a/keditfiletype/mimetypedata.h
+++ b/keditfiletype/mimetypedata.h
@@ -21,11 +21,14 @@
 #ifndef MIMETYPEDATA_H
 #define MIMETYPEDATA_H
 
-#include <kmimetype.h>
+#include <QMimeType>
+#include <QMimeDatabase>
+
+class KConfigGroup;
 
 /**
  * This is a non-gui (data) class, that represents a mimetype.
- * It is a KMimeType::Ptr plus the changes we made to it.
+ * It is a QMimeType plus the changes we made to it.
  */
 class MimeTypeData
 {
@@ -33,7 +36,7 @@ public:
     // Constructor used for groups
     MimeTypeData(const QString& major);
     // Real constructor, used for an existing mimetype.
-    MimeTypeData(const KMimeType::Ptr mime);
+    MimeTypeData(const QMimeType& mime);
     // Real constructor, used for a new mimetype.
     MimeTypeData(const QString& mimeName, bool /*unused, just to distinguish from \
the other QString ctor*/);  
@@ -67,7 +70,7 @@ public:
     AutoEmbed autoEmbed() const { return m_autoEmbed; }
     void setAutoEmbed( AutoEmbed a ) { m_autoEmbed = a; }
 
-    const KMimeType::Ptr& mimeType() const { return m_mimetype; }
+    const QMimeType& mimeType() const { return m_mimetype; }
     bool canUseGroupSetting() const;
 
     void getAskSave(bool &);
@@ -105,7 +108,7 @@ public:
     bool matchesFilter(const QString& filter) const;
 
 private:
-    void initFromKMimeType();
+    void initFromQMimeType();
     AutoEmbed readAutoEmbed() const;
     void writeAutoEmbed();
     bool isMimeTypeDirty() const; // whether the mimetype definition file needs \
saving @@ -116,7 +119,7 @@ private:
     void saveServices(KConfigGroup & config, const QStringList& services);
     void saveRemovedServices(KConfigGroup & config, const QStringList& services, \
const QStringList& oldServices);  
-    KMimeType::Ptr m_mimetype; // 0 if this is data for a mimetype group \
(m_isGroup==true) +    QMimeType m_mimetype;
     enum AskSave { AskSaveYes = 0, AskSaveNo = 1, AskSaveDefault = 2 };
     AskSave m_askSave:3;
     AutoEmbed m_autoEmbed:3;
@@ -125,6 +128,7 @@ private:
     bool m_isGroup:1;
     bool m_appServicesModified:1;
     bool m_embedServicesModified:1;
+    bool m_userSpecifiedIconModified:1;
     QString m_major, m_minor, m_comment, m_userSpecifiedIcon;
     QStringList m_patterns;
     mutable QStringList m_appServices;
diff --git a/keditfiletype/mimetypewriter.cpp b/keditfiletype/mimetypewriter.cpp
index be5e5d4..11963d2 100644
--- a/keditfiletype/mimetypewriter.cpp
+++ b/keditfiletype/mimetypewriter.cpp
@@ -19,23 +19,15 @@
 */
 
 #include "mimetypewriter.h"
-#include <kmimetype.h>
 
-#include <kdebug.h>
-#include <kdeversion.h>
-#include <kprocess.h>
-
-
-#include <QXmlStreamWriter>
+#include <QDebug>
 #include <QFile>
+#include <QMimeDatabase>
+#include <QMimeType>
 #include <QStandardPaths>
+#include <QXmlStreamWriter>
 
-/// WARNING: this code is duplicated between apps/nsplugins and runtime/filetypes
-
-static bool sharedMimeInfoSupportsIcon()
-{
-    return KMimeType::sharedMimeInfoVersion() >= KDE_MAKE_VERSION(0, 40, 0);
-}
+#include <kprocess.h>
 
 class MimeTypeWriterPrivate
 {
@@ -84,10 +76,10 @@ void MimeTypeWriter::setMarker(const QString& marker)
 bool MimeTypeWriter::write()
 {
     const QString packageFileName = d->localFilePath();
-    kDebug() << "writing" << packageFileName;
+    qDebug() << "writing" << packageFileName;
     QFile packageFile(packageFileName);
     if (!packageFile.open(QIODevice::WriteOnly)) {
-        kError() << "Couldn't open" << packageFileName << "for writing";
+        qCritical() << "Couldn't open" << packageFileName << "for writing";
         return false;
     }
     QXmlStreamWriter writer(&packageFile);
@@ -110,11 +102,9 @@ bool MimeTypeWriter::write()
 
     if (!d->m_iconName.isEmpty()) {
         // User-specified icon name
-        if (sharedMimeInfoSupportsIcon()) {
-            writer.writeStartElement(nsUri, "icon");
-            writer.writeAttribute("name", d->m_iconName);
-            writer.writeEndElement(); // icon
-        }
+        writer.writeStartElement(nsUri, "icon");
+        writer.writeAttribute("name", d->m_iconName);
+        writer.writeEndElement(); // icon
     }
 
     // Allow this local definition to override the global definition
@@ -142,7 +132,7 @@ void MimeTypeWriter::runUpdateMimeDatabase()
     proc << localPackageDir;
     const int exitCode = proc.execute();
     if (exitCode) {
-        kWarning() << proc.program() << "exited with error code" << exitCode;
+        qWarning() << proc.program() << "exited with error code" << exitCode;
     }
 }
 
diff --git a/keditfiletype/mimetypewriter.h b/keditfiletype/mimetypewriter.h
index 5a618a6..3dfca16 100644
--- a/keditfiletype/mimetypewriter.h
+++ b/keditfiletype/mimetypewriter.h
@@ -74,7 +74,7 @@ public:
      *
      * NOTE: this is not the same as testing whether the
      * mimetype is defined in general (for instance by freedesktop.org.xml)
-     * you should use KMimeType::mimeType() for that.
+     * you should use db.mimeTypeForName() for that.
      * This method is only for mimetypes generated by MimeTypeWriter.
      */
     static bool hasDefinitionFile(const QString& mimeType);
diff --git a/keditfiletype/newtypedlg.cpp b/keditfiletype/newtypedlg.cpp
index c933a8f..78c2fdd 100644
--- a/keditfiletype/newtypedlg.cpp
+++ b/keditfiletype/newtypedlg.cpp
@@ -24,6 +24,7 @@
 // Qt
 #include <QBoxLayout>
 #include <QComboBox>
+#include <QDialogButtonBox>
 #include <QFrame>
 #include <QFormLayout>
 #include <QLabel>
@@ -31,23 +32,21 @@
 
 // KDE
 #include <klineedit.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
 
 
 NewTypeDialog::NewTypeDialog(const QStringList &groups, QWidget *parent)
-  : KDialog( parent )
+  : QDialog( parent )
 {
   setModal( true );
-  setCaption( i18n( "Create New File Type" ) );
-  setButtons( Ok | Cancel );
+  setWindowTitle( i18n( "Create New File Type" ) );
 
-  QWidget* main = mainWidget();
+  QVBoxLayout *mainLayout = new QVBoxLayout(this);
+  QFormLayout *formLayout = new QFormLayout;
 
-  QFormLayout *formLayout = new QFormLayout(main);
+  QLabel *l = new QLabel(i18n("Group:"));
 
-  QLabel *l = new QLabel(i18n("Group:"), main);
-
-  m_groupCombo = new QComboBox(main);
+  m_groupCombo = new QComboBox;
   m_groupCombo->setEditable(true);
   m_groupCombo->addItems(groups);
   m_groupCombo->setCurrentIndex(m_groupCombo->findText("application")); // certainly \
a better default than "all" @@ -58,15 +57,24 @@ NewTypeDialog::NewTypeDialog(const \
QStringList &groups, QWidget *parent)  
   // Line 1: mimetype name
 
-  l = new QLabel(i18n("Type name:"), main);
+  l = new QLabel(i18n("Type name:"));
 
-  m_typeEd = new KLineEdit(main);
+  m_typeEd = new KLineEdit;
   formLayout->addRow(l, m_typeEd);
 
   m_typeEd->setWhatsThis(i18n("Type the name of the file type. For instance, if you \
selected 'image' as category and you type 'custom' here, the file type 'image/custom' \
will be created."));  
   m_typeEd->setFocus();
 
+  m_buttonBox = new QDialogButtonBox;
+  m_buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+  mainLayout->addLayout(formLayout);
+  mainLayout->addWidget(m_buttonBox);
+
+  connect(m_buttonBox, SIGNAL(accepted()), SLOT(accept()));
+  connect(m_buttonBox, SIGNAL(rejected()), SLOT(reject()));
+
   // Set a minimum width so that caption is not half-hidden
   setMinimumWidth(300);
 }
diff --git a/keditfiletype/newtypedlg.h b/keditfiletype/newtypedlg.h
index fba8385..cc7f9e2 100644
--- a/keditfiletype/newtypedlg.h
+++ b/keditfiletype/newtypedlg.h
@@ -20,8 +20,9 @@
 #ifndef _NEWTYPEDLG_H
 #define _NEWTYPEDLG_H
 
-#include <kdialog.h>
+#include <QDialog>
 
+class QDialogButtonBox;
 class QStringList;
 class KLineEdit;
 class QComboBox;
@@ -32,7 +33,7 @@ class QComboBox;
  * - a line-edit for entering the name of the file type
  * The rest (description, patterns, icon, apps) can be set later in the \
                filetypesview anyway.
  */
-class NewTypeDialog : public KDialog
+class NewTypeDialog : public QDialog
 {
 public:
     explicit NewTypeDialog(const QStringList &groups, QWidget *parent);
@@ -41,6 +42,7 @@ public:
 private:
     KLineEdit *m_typeEd;
     QComboBox *m_groupCombo;
+    QDialogButtonBox* m_buttonBox;
 };
 
 #endif
diff --git a/keditfiletype/sharedmimeinfoversion.cpp \
b/keditfiletype/sharedmimeinfoversion.cpp deleted file mode 100644
index 9dabf0e..0000000
--- a/keditfiletype/sharedmimeinfoversion.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*  This file is part of the KDE project
-    Copyright (C) 2009 David Faure <faure@kde.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License or ( at
-    your option ) version 3 or, at the discretion of KDE e.V. ( which shall
-    act as a proxy as in section 14 of the GPLv3 ), any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; see the file COPYING.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "sharedmimeinfoversion.h"
-#include <kmimetype.h>
-#include <kdeversion.h>
-
-bool SharedMimeInfoVersion::supportsIcon()
-{
-    return KMimeType::sharedMimeInfoVersion() >= KDE_MAKE_VERSION(0, 40, 0);
-}
diff --git a/keditfiletype/sharedmimeinfoversion.h \
b/keditfiletype/sharedmimeinfoversion.h deleted file mode 100644
index 9824d7b..0000000
--- a/keditfiletype/sharedmimeinfoversion.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*  This file is part of the KDE project
-    Copyright (C) 2009 David Faure <faure@kde.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License or ( at
-    your option ) version 3 or, at the discretion of KDE e.V. ( which shall
-    act as a proxy as in section 14 of the GPLv3 ), any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; see the file COPYING.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef SHAREDMIMEINFOVERSION_H
-#define SHAREDMIMEINFOVERSION_H
-
-namespace SharedMimeInfoVersion
-{
-    bool supportsIcon();
-}
-
-#endif /* SHAREDMIMEINFOVERSION_H */
-
diff --git a/keditfiletype/tests/CMakeLists.txt b/keditfiletype/tests/CMakeLists.txt
index 489bb4d..cee562d 100644
--- a/keditfiletype/tests/CMakeLists.txt
+++ b/keditfiletype/tests/CMakeLists.txt
@@ -6,7 +6,6 @@ add_executable(filetypestest
  filetypestest.cpp
  ../mimetypedata.cpp
  ../mimetypewriter.cpp
- ../sharedmimeinfoversion.cpp
 )
 ecm_mark_as_test(filetypestest)
 add_test(filetypestest filetypestest)
diff --git a/keditfiletype/tests/filetypestest.cpp \
b/keditfiletype/tests/filetypestest.cpp index 68eef26..05dae41 100644
--- a/keditfiletype/tests/filetypestest.cpp
+++ b/keditfiletype/tests/filetypestest.cpp
@@ -19,7 +19,6 @@
 
 #include <kprocess.h>
 #include <kservice.h>
-#include <qtest_kde.h>
 
 #include <kconfiggroup.h>
 #include <kdebug.h>
@@ -27,9 +26,13 @@
 #include <kstandarddirs.h>
 #include <ksycoca.h>
 
+// Qt
+#include <QDir>
+#include <QStandardPaths>
+#include <QTest>
+
 #include <mimetypedata.h>
 #include <mimetypewriter.h>
-#include <QStandardPaths>
 
 #define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
 
@@ -108,7 +111,8 @@ private Q_SLOTS:
 
     void testMimeTypeAutoEmbed()
     {
-        MimeTypeData data(KMimeType::mimeType("text/plain"));
+        QMimeDatabase db;
+        MimeTypeData data(db.mimeTypeForName("text/plain"));
         QCOMPARE(data.majorType(), QString("text"));
         QCOMPARE(data.minorType(), QString("plain"));
         QCOMPARE(data.name(), QString("text/plain"));
@@ -121,7 +125,7 @@ private Q_SLOTS:
         QVERIFY(!data.sync()); // save to disk. Should succeed, but return false (no \
need to run update-mime-database)  QVERIFY(!data.isDirty());
         // Check what's on disk by creating another MimeTypeData instance
-        MimeTypeData data2(KMimeType::mimeType("text/plain"));
+        MimeTypeData data2(db.mimeTypeForName("text/plain"));
         QCOMPARE(data2.autoEmbed(), MimeTypeData::Yes);
         QVERIFY(!data2.isDirty());
         data2.setAutoEmbed(MimeTypeData::UseGroupSetting); // revert to default, for \
next time @@ -132,7 +136,8 @@ private Q_SLOTS:
 
     void testMimeTypePatterns()
     {
-        MimeTypeData data(KMimeType::mimeType("text/plain"));
+        QMimeDatabase db;
+        MimeTypeData data(db.mimeTypeForName("text/plain"));
         QCOMPARE(data.name(), QString("text/plain"));
         QCOMPARE(data.majorType(), QString("text"));
         QCOMPARE(data.minorType(), QString("plain"));
@@ -141,10 +146,7 @@ private Q_SLOTS:
         QVERIFY(patterns.contains("*.txt"));
         QVERIFY(!patterns.contains("*.toto"));
         const QStringList origPatterns = patterns;
-        if (KMimeType::sharedMimeInfoVersion() >= KDE_MAKE_VERSION(0, 61, 0)) {
-            // <glob-deleteall> is only supported by shared-mime-info > 0.60
-            patterns.removeAll("*.txt");
-        }
+        patterns.removeAll("*.txt");
         patterns.append("*.toto"); // yes, a french guy wrote this, as you can see
         patterns.sort(); // for future comparisons
         QVERIFY(!data.isDirty());
@@ -158,7 +160,7 @@ private Q_SLOTS:
         data.refresh(); // reload from the xml
         QCOMPARE(data.patterns(), patterns);
         // Check what's in ksycoca
-        QStringList newPatterns = KMimeType::mimeType("text/plain")->patterns();
+        QStringList newPatterns = db.mimeTypeForName("text/plain").globPatterns();
         newPatterns.sort();
         QCOMPARE(newPatterns, patterns);
         QVERIFY(!data.isDirty());
@@ -170,15 +172,16 @@ private Q_SLOTS:
         MimeTypeWriter::runUpdateMimeDatabase();
         //runKBuildSycoca();
         // Check what's in ksycoca
-        newPatterns = KMimeType::mimeType("text/plain")->patterns();
+        newPatterns = db.mimeTypeForName("text/plain").globPatterns();
         newPatterns.sort();
         QCOMPARE(newPatterns, origPatterns);
     }
 
     void testAddService()
     {
+        QMimeDatabase db;
         const char* mimeTypeName = "application/rtf"; // use inherited mimetype to \
                test #321706
-        MimeTypeData data(KMimeType::mimeType(mimeTypeName));
+        MimeTypeData data(db.mimeTypeForName(mimeTypeName));
         QStringList appServices = data.appServices();
         //kDebug() << appServices;
         QVERIFY(!appServices.isEmpty());
@@ -222,9 +225,10 @@ private Q_SLOTS:
 
     void testRemoveTwice()
     {
+        QMimeDatabase db;
         // Remove fakeApplication from image/png
         const char* mimeTypeName = "image/png";
-        MimeTypeData data(KMimeType::mimeType(mimeTypeName));
+        MimeTypeData data(db.mimeTypeForName(mimeTypeName));
         QStringList appServices = data.appServices();
         kDebug() << "initial list for" << mimeTypeName << appServices;
         QVERIFY(appServices.removeAll(fakeApplication) > 0);
@@ -264,6 +268,7 @@ private Q_SLOTS:
 
     void testCreateMimeType()
     {
+        QMimeDatabase db;
         const QString mimeTypeName = "fake/unit-test-fake-mimetype";
         // Clean up after previous runs if necessary
         if (MimeTypeWriter::hasDefinitionFile(mimeTypeName))
@@ -277,19 +282,20 @@ private Q_SLOTS:
         QVERIFY(data.sync());
         MimeTypeWriter::runUpdateMimeDatabase();
         //runKBuildSycoca();
-        KMimeType::Ptr mime = KMimeType::mimeType(mimeTypeName);
-        QVERIFY(mime);
-        QCOMPARE(mime->comment(), QString("Fake MimeType"));
-        QCOMPARE(mime->patterns(), patterns); // must sort them if more than one
+        QMimeType mime = db.mimeTypeForName(mimeTypeName);
+        QVERIFY(mime.isValid());
+        QCOMPARE(mime.comment(), QString("Fake MimeType"));
+        QCOMPARE(mime.globPatterns(), patterns); // must sort them if more than one
 
         // Testcase for the shaman.xml bug
-        QCOMPARE(KMimeType::findByPath("/whatever/foo.pkg.tar.gz")->name(), \
QString("fake/unit-test-fake-mimetype")); +        \
QCOMPARE(db.mimeTypeForFile("/whatever/foo.pkg.tar.gz").name(), \
QString("fake/unit-test-fake-mimetype"));  
         m_mimeTypeCreatedSuccessfully = true;
     }
 
     void testDeleteMimeType()
     {
+        QMimeDatabase db;
         if (!m_mimeTypeCreatedSuccessfully)
             QSKIP("This test relies on testCreateMimeType");
         const QString mimeTypeName = "fake/unit-test-fake-mimetype";
@@ -297,14 +303,15 @@ private Q_SLOTS:
         MimeTypeWriter::removeOwnMimeType(mimeTypeName);
         MimeTypeWriter::runUpdateMimeDatabase();
         //runKBuildSycoca();
-        KMimeType::Ptr mime = KMimeType::mimeType(mimeTypeName);
-        QVERIFY(!mime);
+        QMimeType mime = db.mimeTypeForName(mimeTypeName);
+        QVERIFY(mime.isValid());
     }
 
     void testModifyMimeTypeComment() // of a system mimetype. And check that it's \
re-read correctly.  {
+        QMimeDatabase db;
         const char* mimeTypeName = "image/png";
-        MimeTypeData data(KMimeType::mimeType(mimeTypeName));
+        MimeTypeData data(db.mimeTypeForName(mimeTypeName));
         QCOMPARE(data.comment(), QString::fromLatin1("PNG image"));
         const char* fakeComment = "PNG image [testing]";
         data.setComment(fakeComment);
@@ -312,9 +319,9 @@ private Q_SLOTS:
         QVERIFY(data.sync());
         MimeTypeWriter::runUpdateMimeDatabase();
         //runKBuildSycoca();
-        KMimeType::Ptr mime = KMimeType::mimeType(mimeTypeName);
-        QVERIFY(mime);
-        QCOMPARE(mime->comment(), QString::fromLatin1(fakeComment));
+        QMimeType mime = db.mimeTypeForName(mimeTypeName);
+        QVERIFY(mime.isValid());
+        QCOMPARE(mime.comment(), QString::fromLatin1(fakeComment));
 
         // Cleanup
         QVERIFY(MimeTypeWriter::hasDefinitionFile(mimeTypeName));
@@ -391,7 +398,8 @@ private: // helper methods
 
     void checkMimeTypeServices(const QString& mimeTypeName, const QStringList& \
expectedServices)  {
-        MimeTypeData data2(KMimeType::mimeType(mimeTypeName));
+        QMimeDatabase db;
+        MimeTypeData data2(db.mimeTypeForName(mimeTypeName));
         if (data2.appServices() != expectedServices)
             kDebug() << "got" << data2.appServices() << "expected" << \
expectedServices;  QCOMPARE(data2.appServices(), expectedServices);
@@ -403,6 +411,6 @@ private: // helper methods
     bool m_mimeTypeCreatedSuccessfully;
 };
 
-QTEST_KDEMAIN( FileTypesTest, NoGUI )
+QTEST_MAIN(FileTypesTest)
 
 #include "filetypestest.moc"
diff --git a/keditfiletype/typeslistitem.cpp b/keditfiletype/typeslistitem.cpp
index 97cd3c1..44f0ff1 100644
--- a/keditfiletype/typeslistitem.cpp
+++ b/keditfiletype/typeslistitem.cpp
@@ -22,9 +22,8 @@
 // Own
 #include "typeslistitem.h"
 
-// KDE
-#include <kdebug.h>
-#include <kicon.h>
+// Qt
+#include <QDebug>
 
 
 TypesListItem::TypesListItem(QTreeWidget *parent, const QString & major)
@@ -34,7 +33,7 @@ TypesListItem::TypesListItem(QTreeWidget *parent, const QString & \
major)  setText(0, major);
 }
 
-TypesListItem::TypesListItem(TypesListItem *parent, KMimeType::Ptr mimetype)
+TypesListItem::TypesListItem(TypesListItem *parent, QMimeType mimetype)
   : QTreeWidgetItem(parent),
     m_mimetypeData(mimetype)
 {
@@ -61,7 +60,7 @@ void TypesListItem::setIcon( const QString& icon )
 void TypesListItem::loadIcon(bool forceReload)
 {
     if ((!m_mimetypeData.icon().isEmpty() && icon(0).isNull()) || forceReload) {
-        QTreeWidgetItem::setIcon(0, KIcon(m_mimetypeData.icon()));
+        QTreeWidgetItem::setIcon(0, QIcon::fromTheme(m_mimetypeData.icon()));
     }
 }
 
diff --git a/keditfiletype/typeslistitem.h b/keditfiletype/typeslistitem.h
index 05e425a..e86f3a4 100644
--- a/keditfiletype/typeslistitem.h
+++ b/keditfiletype/typeslistitem.h
@@ -24,7 +24,8 @@
 #include "mimetypedata.h"
 #include <QTreeWidgetItem>
 
-#include <kmimetype.h>
+#include <QMimeType>
+#include <QMimeDatabase>
 
 // TODO different subclasses for mimetypes and groups?
 class TypesListItem : public QTreeWidgetItem
@@ -38,7 +39,7 @@ public:
     /**
      * Create a filetype item inside a group, for an existing mimetype
      */
-    TypesListItem(TypesListItem *parent, KMimeType::Ptr mimetype);
+    TypesListItem(TypesListItem *parent, QMimeType mimetype);
 
     /**
      * Create a filetype item inside a group, for a new mimetype


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic