diff --git a/apps/plasma/applets/folderview/folderview.cpp b/apps/plasma/applets/folderview/folderview.cpp
index 4931764..ae3f093 100644
--- a/apps/plasma/applets/folderview/folderview.cpp
+++ b/apps/plasma/applets/folderview/folderview.cpp
@@ -18,7 +18,6 @@
  */
 
 #include "folderview.h"
-#include "folderview.moc"
 
 #include <QApplication>
 #include <QClipboard>
@@ -43,6 +42,7 @@
 #include <KGlobalSettings>
 #include <KMenu>
 #include <KStandardShortcut>
+#include <KStringHandler>
 
 #include <kio/fileundomanager.h>
 #include <kio/paste.h>
@@ -63,6 +63,91 @@
 #include <limits.h>
 
 
+MimeModel::MimeModel(QObject *parent)
+    : QStringListModel(parent)
+{
+    m_mimetypes = KMimeType::allMimeTypes();
+}
+
+QVariant MimeModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid()) {
+        return QVariant();
+    }
+    KMimeType *mime = static_cast<KMimeType*>(index.internalPointer());
+    switch (role) {
+        case Qt::DisplayRole:
+            return mime->comment();
+        default:
+            return QStringListModel::data(index, role);
+    }
+}
+
+QModelIndex MimeModel::index(int row, int column, const QModelIndex &parent) const
+{
+    if (parent.isValid() || row >= m_mimetypes.count()) {
+        return QModelIndex();
+    } 
+    return createIndex(row, column, (void*) m_mimetypes[row].data());
+}
+
+int MimeModel::rowCount(const QModelIndex &parent) const
+{
+    if (parent.isValid()) {
+        return 0;
+    }
+    return m_mimetypes.count();
+}
+
+
+
+// ---------------------------------------------------------------------------
+
+
+
+ProxyMimeModel::ProxyMimeModel(QObject *parent)
+    : QSortFilterProxyModel(parent)
+{
+}
+
+void ProxyMimeModel::setSourceModel(QAbstractItemModel *sourceModel)
+{
+    QSortFilterProxyModel::setSourceModel(sourceModel);
+    sort(0);
+}
+
+void ProxyMimeModel::setFilter(const QString &filter)
+{
+    m_filter = filter;
+    invalidateFilter();
+}
+
+bool ProxyMimeModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+    KMimeType *leftPtr = static_cast<KMimeType*>(left.internalPointer());
+    KMimeType *rightPtr = static_cast<KMimeType*>(right.internalPointer());
+    
+    return KStringHandler::naturalCompare(leftPtr->comment(), rightPtr->comment()) < 0;
+}
+
+bool ProxyMimeModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+    QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
+    KMimeType *mime = static_cast<KMimeType*>(sourceIndex.internalPointer());
+    if (mime->comment().isEmpty()) {
+        return false;
+    }
+    if (m_filter.isEmpty()) {
+        return true;
+    }
+    return mime->comment().contains(m_filter, Qt::CaseInsensitive);
+}
+
+
+// ---------------------------------------------------------------------------
+
+
+
 // Wraps a QScrollBar in a QGraphicsProxyWidget
 class ScrollBar : public QGraphicsProxyWidget
 {
@@ -195,13 +280,23 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
     }
 
     ui.lineEdit->setMode(KFile::Directory); 
-    ui.filterFiles->setText(m_filterFiles);
+    ui.filterFilesPattern->setText(m_filterFiles);
+    
+    MimeModel *mimeModel = new MimeModel(widget);
+    ProxyMimeModel *pMimeModel = new ProxyMimeModel(widget);
+    pMimeModel->setSourceModel(mimeModel);
+    ui.filterFilesList->setModel(pMimeModel);
+    
+    connect(ui.searchMimetype, SIGNAL(textChanged(QString)), pMimeModel, SLOT(setFilter(QString)));
 
     parent->addPage(widget, parent->windowTitle(), icon());
     parent->setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
     connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
     connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     connect(ui.showCustomFolder, SIGNAL(toggled(bool)), this, SLOT(customFolderToggled(bool)));
+    connect(ui.noFilter, SIGNAL(toggled(bool)), this, SLOT(filterChanged(bool)));
+    connect(ui.filterByPattern, SIGNAL(toggled(bool)), this, SLOT(filterChanged(bool)));
+    connect(ui.filterByMimeType, SIGNAL(toggled(bool)), this, SLOT(filterChanged(bool)));
 }
 
 void FolderView::configAccepted()
@@ -216,11 +311,11 @@ void FolderView::configAccepted()
     if (url.isEmpty() || (url.isLocalFile() && !QFile::exists(url.path())))
         url = KUrl(QDir::homePath());
 
-    if (m_url != url || m_filterFiles != ui.filterFiles->text()) {
+    if (m_url != url || m_filterFiles != ui.filterFilesPattern->text()) {
         m_dirModel->dirLister()->openUrl(url);
-        m_model->setFilterFixedString(ui.filterFiles->text());
+        m_model->setFilterFixedString(ui.filterFilesPattern->text());
         m_url = url;
-        m_filterFiles = ui.filterFiles->text();
+        m_filterFiles = ui.filterFilesPattern->text();
 
         KConfigGroup cg = config();
         cg.writeEntry("url", m_url);
@@ -996,6 +1091,39 @@ void FolderView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint
     markEverythingDirty();
 }
 
+void FolderView::filterChanged(bool state)
+{
+    if (!state) {
+        return;
+    }
+    
+    QObject *senderObject = sender();
+    if (senderObject == ui.noFilter) {
+            ui.excludeFilter->setEnabled(false);
+            ui.filterLabelPattern->setEnabled(false);
+            ui.filterFilesPattern->setEnabled(false);
+            ui.searchMimetype->setEnabled(false);
+            ui.filterLabelList->setEnabled(false);
+            ui.filterFilesList->setEnabled(false);
+    } else if (senderObject == ui.filterByPattern) {
+            ui.excludeFilter->setEnabled(true);
+            ui.filterLabelPattern->setEnabled(true);
+            ui.filterFilesPattern->setEnabled(true);
+            ui.searchMimetype->setEnabled(false);
+            ui.filterLabelList->setEnabled(false);
+            ui.filterFilesList->setEnabled(false);
+    } else if (senderObject == ui.filterByMimeType) {
+            ui.excludeFilter->setEnabled(true);
+            ui.filterLabelPattern->setEnabled(false);
+            ui.filterFilesPattern->setEnabled(false);
+            ui.searchMimetype->setEnabled(true);
+            ui.filterLabelList->setEnabled(true);
+            ui.filterFilesList->setEnabled(true);
+    }
+    
+    return;
+}
+
 void FolderView::moveToTrash(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
 {
     Q_UNUSED(buttons)    
@@ -1488,3 +1616,4 @@ QStyleOptionViewItemV4 FolderView::viewOptions() const
     return option;
 }
 
+#include "folderview.moc"
diff --git a/apps/plasma/applets/folderview/folderview.h b/apps/plasma/applets/folderview/folderview.h
index 941d9c3..be2cff4 100644
--- a/apps/plasma/applets/folderview/folderview.h
+++ b/apps/plasma/applets/folderview/folderview.h
@@ -21,10 +21,12 @@
 #define FOLDERVIEW_H
 
 #include <QPersistentModelIndex>
+#include <QSortFilterProxyModel>
 #include <QStyleOption>
 #include <QPointer>
 
 #include <KActionCollection>
+#include <KMimeType>
 
 #include <plasma/containment.h>
 #include "ui_folderviewConfig.h"
@@ -90,6 +92,8 @@ private slots:
 
     void commitData(QWidget *editor);
     void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
+    
+    void filterChanged(bool state);
 
 private:
     void createActions();
@@ -158,6 +162,51 @@ private:
     bool m_dragInProgress;
 };
 
+
+
+// ---------------------------------------------------------------------------
+
+
+
+class MimeModel : public QStringListModel
+{
+public:
+    MimeModel(QObject *parent = 0);
+    
+    virtual QVariant data(const QModelIndex &index, int role) const;
+    virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    
+private:
+    KMimeType::List m_mimetypes;
+};
+
+
+
+// ---------------------------------------------------------------------------
+
+
+
+class ProxyMimeModel : public QSortFilterProxyModel
+{
+Q_OBJECT
+
+public:
+    ProxyMimeModel(QObject *parent = 0);
+    
+    virtual void setSourceModel(QAbstractItemModel *sourceModel);
+    
+public slots:
+    void setFilter(const QString &filter);
+    
+protected:
+    virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+    virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+    
+private:
+    QString m_filter;
+};
+
 K_EXPORT_PLASMA_APPLET(folderview, FolderView)
 
 #endif
diff --git a/apps/plasma/applets/folderview/folderviewConfig.ui b/apps/plasma/applets/folderview/folderviewConfig.ui
index 02db010..f03458a 100644
--- a/apps/plasma/applets/folderview/folderviewConfig.ui
+++ b/apps/plasma/applets/folderview/folderviewConfig.ui
@@ -1,6 +1,14 @@
 <ui version="4.0" >
  <class>folderviewConfig</class>
  <widget class="QWidget" name="folderviewConfig" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>560</width>
+    <height>559</height>
+   </rect>
+  </property>
   <property name="sizePolicy" >
    <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
     <horstretch>0</horstretch>
@@ -22,22 +30,6 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <spacer name="spacer2" >
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0" >
-      <size>
-       <width>21</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
    <item row="2" column="1" >
     <widget class="QLabel" name="selectLabel" >
      <property name="sizePolicy" >
@@ -64,46 +56,180 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="1" >
-    <widget class="QLabel" name="filterLabel" >
-     <property name="text" >
-      <string>Filter</string>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="2" >
-    <spacer name="spacer1" >
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0" >
-      <size>
-       <width>20</width>
-       <height>81</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="3" column="2" >
-    <widget class="KLineEdit" name="filterFiles" >
-     <property name="toolTip" >
-      <string>Space-separated list of extensions, e.g. *.txt * .od*</string>
-     </property>
-     <property name="whatsThis" >
-      <string>Space-separated list of extensions, e.g. *.txt * .od* to display only office- and text-files</string>
-     </property>
-     <property name="urlDropsEnabled" >
-      <bool>false</bool>
-     </property>
-     <property name="showClearButton" stdset="0" >
-      <bool>true</bool>
-     </property>
+   <item row="3" column="0" colspan="3" >
+    <widget class="QGroupBox" name="fileFilters" >
+     <property name="title" >
+      <string>File filters</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3" >
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_2" >
+        <item>
+         <widget class="QRadioButton" name="noFilter" >
+          <property name="text" >
+           <string>No filter</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="filterByPattern" >
+          <property name="text" >
+           <string>Filter by pattern</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_5" >
+          <item>
+           <spacer name="horizontalSpacer" >
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Fixed</enum>
+            </property>
+            <property name="sizeHint" stdset="0" >
+             <size>
+              <width>20</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <layout class="QGridLayout" name="gridLayout_2" >
+            <property name="margin" >
+             <number>4</number>
+            </property>
+            <item row="0" column="1" >
+             <widget class="KLineEdit" name="filterFilesPattern" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="toolTip" >
+               <string>Space-separated list of extensions, e.g. *.txt * .od*</string>
+              </property>
+              <property name="whatsThis" >
+               <string>Space-separated list of extensions, e.g. *.txt * .od* to display only office- and text-files</string>
+              </property>
+              <property name="urlDropsEnabled" >
+               <bool>false</bool>
+              </property>
+              <property name="showClearButton" stdset="0" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="0" >
+             <widget class="QLabel" name="filterLabelPattern" >
+              <property name="text" >
+               <string>Filter</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="filterByMimeType" >
+          <property name="text" >
+           <string>Filter by mime type</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_6" >
+          <item>
+           <spacer name="horizontalSpacer_2" >
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Fixed</enum>
+            </property>
+            <property name="sizeHint" stdset="0" >
+             <size>
+              <width>20</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <layout class="QGridLayout" name="gridLayout_5" >
+            <property name="margin" >
+             <number>4</number>
+            </property>
+            <item row="1" column="0" >
+             <widget class="QLabel" name="filterLabelList" >
+              <property name="text" >
+               <string>Filter</string>
+              </property>
+              <property name="alignment" >
+               <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1" >
+             <widget class="KLineEdit" name="searchMimetype" >
+              <property name="clickMessage" >
+               <string>Search mime type</string>
+              </property>
+              <property name="showClearButton" stdset="0" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1" >
+             <widget class="QListView" name="filterFilesList" >
+              <property name="selectionMode" >
+               <enum>QAbstractItemView::ExtendedSelection</enum>
+              </property>
+              <property name="flow" >
+               <enum>QListView::TopToBottom</enum>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="Line" name="line" >
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QCheckBox" name="excludeFilter" >
+          <property name="text" >
+           <string>Exclude filter</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+     <zorder>verticalLayoutWidget</zorder>
+     <zorder>groupBox_2</zorder>
     </widget>
    </item>
   </layout>
+  <zorder>showDesktopFolder</zorder>
+  <zorder>showCustomFolder</zorder>
+  <zorder>selectLabel</zorder>
+  <zorder>lineEdit</zorder>
+  <zorder>groupBox_2</zorder>
+  <zorder>radioButton</zorder>
+  <zorder>verticalLayoutWidget</zorder>
+  <zorder>verticalLayoutWidget</zorder>
+  <zorder>fileFilters</zorder>
+  <zorder>filterFilesList</zorder>
  </widget>
  <customwidgets>
   <customwidget>
