Warning, /plasma/plasma-thunderbolt/src/kcm/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2018-2019 Daniel Vrátil <dvratil@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick 2.7
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.3
0010 
0011 import org.kde.kirigami 2.12 as Kirigami
0012 import org.kde.kcmutils
0013 import org.kde.bolt 0.1 as Bolt
0014 
0015 Kirigami.Page {
0016     ConfigModule.buttons: ConfigModule.NoAdditionalButton
0017     id: root
0018 
0019     title: kcm.name
0020     implicitWidth: Kirigami.Units.gridUnit * 20
0021     implicitHeight: pageRow.contentHeight > 0 ? Math.min(pageRow.contentHeight, Kirigami.Units.gridUnit * 20)
0022                                               : Kirigami.Units.gridUnit * 20
0023 
0024     Bolt.Manager {
0025         id: boltManager
0026     }
0027 
0028     Kirigami.PageRow {
0029         id: pageRow
0030         clip: true
0031         anchors.fill: parent
0032 
0033         Component.onCompleted: {
0034             if (boltManager.isAvailable) {
0035                 if (boltManager.securityLevel == Bolt.Bolt.Security.DPOnly
0036                         || boltManager.securityLevel == Bolt.Bolt.Security.USBOnly) {
0037                     pageRow.push(noBoltPage, { text: i18n("Thunderbolt support has been disabled in BIOS") })
0038                 } else {
0039                     pageRow.push(deviceList, { manager: boltManager })
0040                 }
0041             } else {
0042                 pageRow.push(noBoltPage, { text: i18n("Thunderbolt subsystem is not available") })
0043             }
0044         }
0045     }
0046 
0047     Component {
0048         id: noBoltPage
0049         Kirigami.Page {
0050             property alias text: label.text
0051             Kirigami.PlaceholderMessage {
0052                 id: label
0053 
0054                 anchors.centerIn: parent
0055                 width: parent.width - (Kirigami.Units.largeSpacing *4)
0056             }
0057         }
0058     }
0059 
0060     Component {
0061         id: deviceList
0062         DeviceList {
0063             property alias manager: model.manager
0064             deviceModel: Bolt.DeviceModel {
0065                 id: model
0066                 showHosts: false
0067             }
0068 
0069             onItemClicked: function(device) {
0070                 pageRow.push(deviceView, { manager: manager, device: device })
0071             }
0072         }
0073     }
0074 
0075     Component {
0076         id: deviceView
0077         DeviceView {
0078         }
0079     }
0080 }