Warning, /utilities/filelight/src/qml/SettingsPageScanning.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0002 // SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0003 
0004 pragma ComponentBehavior: Bound
0005 
0006 import QtQuick 2.15
0007 import QtQuick.Layouts 1.15
0008 import QtQuick.Controls 2.15 as QQC2
0009 import org.kde.kirigami 2.19 as Kirigami
0010 import org.kde.kirigami.delegates as KD
0011 
0012 import org.kde.filelight 1.0
0013 
0014 Kirigami.Page {
0015     Timer {
0016         id: cacheResetTimer
0017         running: false
0018         interval: 1000
0019         repeat: false
0020         onTriggered: ScanManager.emptyCache()
0021     }
0022 
0023     ColumnLayout {
0024         anchors.fill: parent
0025         spacing: Kirigami.Units.smallSpacing
0026 
0027         RowLayout {
0028             spacing: Kirigami.Units.smallSpacing
0029             Layout.fillWidth: true
0030 
0031             QQC2.Label {
0032                 Layout.fillWidth: true
0033                 text: i18nc("@label", "Do not scan these folders:")
0034                 wrapMode: Text.Wrap
0035                 verticalAlignment: Text.AlignBottom
0036             }
0037 
0038             QQC2.Button {
0039                 Layout.alignment: Qt.AlignBottom
0040                 action: Kirigami.Action {
0041                     text: i18nc("@action:button remove list entry", "Add…")
0042                     icon.name: "folder-open"
0043                     onTriggered: Config.addFolder()
0044                 }
0045             }
0046         }
0047 
0048         QQC2.ScrollView {
0049             Layout.fillWidth: true
0050             Layout.fillHeight: true
0051             Kirigami.Theme.colorSet: Kirigami.Theme.View
0052             Kirigami.Theme.inherit: false
0053             Component.onCompleted: background.visible = true
0054 
0055             ListView {
0056                 id: skipView
0057                 clip: true
0058                 reuseItems: true
0059                 activeFocusOnTab: true
0060                 keyNavigationEnabled: true
0061                 keyNavigationWraps: true
0062                 model: Config.skipList
0063                 delegate: Kirigami.SwipeListItem {
0064                     id: delegate
0065 
0066                     required property string modelData
0067 
0068                     text: modelData
0069 
0070                     QQC2.ToolTip.text: text
0071                     QQC2.ToolTip.visible: (Kirigami.Settings.tabletMode ? down : hovered) && (contentItem?.truncated ?? false)
0072                     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0073 
0074                     contentItem: KD.TitleSubtitle {
0075                         title: delegate.text
0076                         selected: delegate.highlighted
0077                         font: delegate.font
0078                         elide: Text.ElideMiddle
0079                     }
0080 
0081                     actions: [
0082                         Kirigami.Action {
0083                             text: i18nc("@action:button remove list entry", "Remove")
0084                             icon.name: "list-remove"
0085                             onTriggered: {
0086                                 Config.removeFolder(delegate.modelData)
0087                             }
0088                         }
0089                     ]
0090 
0091                     onClicked: {
0092                         // Do not let auto-resolver prepend "qrc:"
0093                         const url = Qt.url(`file://${modelData}`);
0094                         Qt.openUrlExternally(url);
0095                     }
0096                 }
0097             }
0098         }
0099 
0100         QQC2.CheckBox {
0101             id: scanAcrossMountsBox
0102             Layout.fillWidth: true
0103             text: i18nc("@checkbox", "Scan across filesystem boundaries")
0104             checked: Config.scanAcrossMounts
0105             onToggled: {
0106                 if (Config.scanAcrossMounts === checked) {
0107                     return
0108                 }
0109                 Config.scanAcrossMounts = checked
0110                 cacheResetTimer.restart()
0111             }
0112         }
0113         QQC2.CheckBox {
0114             Layout.fillWidth: true
0115             text: i18nc("@checkbox", "Exclude remote filesystems")
0116             checked: !Config.scanRemoteMounts
0117             enabled: scanAcrossMountsBox.checked
0118             onToggled: {
0119                 if (Config.scanRemoteMounts === !checked) {
0120                     return
0121                 }
0122                 Config.scanRemoteMounts = !checked
0123                 cacheResetTimer.restart()
0124             }
0125         }
0126     }
0127 }