Commit 0f3b64a8 authored by Jonah Brüchert's avatar Jonah Brüchert Committed by Jan Grulich
Browse files

mobile filechooser: Allow to disable the mime type filter

parent 71b5e8df
......@@ -25,21 +25,13 @@ Kirigami.ScrollablePage {
property string acceptLabel
property bool selectFolder
property alias createDirectorySheet: createDirectorySheet
CreateDirectorySheet {
id: createDirectorySheet
parentPath: dirModel.folder
}
contextualActions: [
Kirigami.Action {
icon.name: "folder"
text: i18n("Create folder")
visible: !root.selectExisting
onTriggered: createDirectorySheet.open()
}
]
onCurrentFileChanged: {
if (root.currentFile) {
// Switch into directory of preselected file
......
......@@ -50,21 +50,33 @@ Kirigami.ApplicationWindow {
Component.onCompleted: console.log(JSON.stringify(callback))
}
Connections {
target: filePicker
pageStack.initialPage: FilePicker {
contextualActions: [
Kirigami.Action {
icon.name: "folder"
text: i18n("Create folder")
visible: !root.selectExisting
onTriggered: filePicker.createDirectorySheet.open()
},
Kirigami.Action {
id: filterAction
icon.name: "view-filter"
checkable: true
text: i18n("Filter filetype")
checked: true
}
]
onAccepted: (urls) => {
callback.accepted(urls)
}
}
pageStack.initialPage: FilePicker {
id: filePicker
selectMultiple: callback.selectMultiple
selectExisting: callback.selectExisting
nameFilters: callback.nameFilters
mimeTypeFilters: callback.mimeTypeFilters
mimeTypeFilters: filterAction.checked ? callback.mimeTypeFilters : undefined
currentFile: callback.currentFile
acceptLabel: callback.acceptLabel
selectFolder: callback.selectFolder
......
......@@ -136,6 +136,13 @@ void DirModel::setMimeFilters(const QStringList &mimeFilters)
}
}
void DirModel::resetMimeFilters()
{
m_lister->clearMimeFilter();
m_lister->emitChanges();
Q_EMIT mimeFiltersChanged();
}
QString DirModel::lastError() const
{
return m_lastError;
......
......@@ -20,7 +20,7 @@ class DirModel : public KDirSortFilterProxyModel
Q_PROPERTY(bool showDotFiles READ showDotFiles WRITE setShowDotFiles NOTIFY showDotFilesChanged)
Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
Q_PROPERTY(QString nameFilter READ nameFilter WRITE setNameFilter NOTIFY nameFilterChanged)
Q_PROPERTY(QStringList mimeFilters READ mimeFilters WRITE setMimeFilters NOTIFY mimeFiltersChanged)
Q_PROPERTY(QStringList mimeFilters READ mimeFilters WRITE setMimeFilters RESET resetMimeFilters NOTIFY mimeFiltersChanged)
Q_PROPERTY(QString lastError READ lastError NOTIFY lastErrorChanged)
......@@ -59,6 +59,7 @@ public:
QStringList mimeFilters() const;
void setMimeFilters(const QStringList &mimeFilters);
void resetMimeFilters();
QString lastError() const;
......
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