Warning, /plasma/kdeplasma-addons/applets/diskquota/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2015 Dominik Haumann <dhaumann@kde.org>
0003 *
0004 * SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 import QtQuick 2.1
0007 import QtQuick.Layouts 1.1
0008
0009 import org.kde.plasma.core as PlasmaCore
0010 import org.kde.kirigami 2.20 as Kirigami
0011 import org.kde.plasma.plasmoid 2.0
0012 import org.kde.plasma.components 3.0 as PlasmaComponents3
0013 import org.kde.plasma.extras 2.0 as PlasmaExtras
0014
0015 import org.kde.plasma.private.diskquota 1.0
0016
0017 PlasmoidItem {
0018 id: quotaApplet
0019
0020 Layout.minimumWidth: Kirigami.Units.gridUnit * 10
0021 Layout.minimumHeight: Kirigami.Units.gridUnit * 2
0022
0023 Plasmoid.status: {
0024 switch (diskQuota.status) {
0025 case DiskQuota.NeedsAttentionStatus:
0026 return PlasmaCore.Types.NeedsAttentionStatus
0027 case DiskQuota.ActiveStatus:
0028 return PlasmaCore.Types.ActiveStatus
0029 }
0030 // default case: DiskQuota.PassiveStatus
0031 return PlasmaCore.Types.PassiveStatus
0032 }
0033
0034 switchWidth: Kirigami.Units.gridUnit * 10
0035 switchHeight: Kirigami.Units.gridUnit * 10
0036
0037 Plasmoid.icon: diskQuota.iconName
0038 toolTipMainText: diskQuota.toolTip
0039 toolTipSubText: diskQuota.subToolTip
0040
0041 Component.onCompleted: plasmoid.removeAction("configure")
0042
0043 DiskQuota {
0044 id: diskQuota
0045 }
0046
0047 fullRepresentation: Item {
0048 id: root
0049
0050 width: Kirigami.Units.gridUnit * 20
0051 height: Kirigami.Units.gridUnit * 14
0052
0053 // HACK: connection to reset currentIndex to -1. Without this, when
0054 // uninstalling filelight, the selection highlight remains fixed (which is wrong)
0055 Connections {
0056 target: diskQuota
0057 function onCleanUpToolInstalledChanged() {
0058 if (!diskQuota.cleanUpToolInstalled) {
0059 listView.currentIndex = -1
0060 }
0061 }
0062 }
0063
0064 Loader {
0065 id: emptyHint
0066
0067 anchors.centerIn: parent
0068 width: parent.width - Kirigami.Units.gridUnit * 4
0069
0070 active: !diskQuota.quotaInstalled || listView.count == 0
0071 visible: active
0072 asynchronous: true
0073
0074 sourceComponent: PlasmaExtras.PlaceholderMessage {
0075 width: parent.width
0076 readonly property bool hasText: model.filterRegularExpression.length > 0
0077 iconName: diskQuota.quotaInstalled ? "edit-none" : "disk-quota"
0078 text: diskQuota.quotaInstalled ? i18nc("@info:status", "No quota restrictions found") : i18nc("@info:status", "Quota tool not found")
0079 explanation: diskQuota.quotaInstalled ? "" : i18nc("@info:usagetip", "Please install 'quota'")
0080 }
0081 }
0082
0083 PlasmaComponents3.ScrollView {
0084 anchors.fill: parent
0085 ListView {
0086 id: listView
0087 model: diskQuota.model
0088 boundsBehavior: Flickable.StopAtBounds
0089 highlight: PlasmaExtras.Highlight { }
0090 highlightMoveDuration: 0
0091 highlightResizeDuration: 0
0092 currentIndex: -1
0093 delegate: ListDelegateItem {
0094 enabled: diskQuota.cleanUpToolInstalled
0095 width: listView.width
0096 mountPoint: model.mountPoint
0097 details: model.details
0098 iconName: model.icon
0099 usedString: model.used
0100 freeString: model.free
0101 usage: model.usage
0102 }
0103 }
0104 }
0105 }
0106 }