Warning, /network/kdenetwork-filesharing/samba/filepropertiesplugin/qml/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003     SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
0004 */
0005 
0006 import QtQuick 2.12
0007 import QtQuick.Controls 2.5 as QQC2
0008 import QtQuick.Layouts 1.14
0009 import org.kde.kirigami 2.4 as Kirigami
0010 import org.kde.filesharing.samba 1.0 as Samba
0011 
0012 QQC2.StackView {
0013     id: stack
0014 
0015     Samba.GroupManager {
0016         id: groupManager
0017     }
0018 
0019     function stackReplace(target) {
0020         stack.replace(stack.currentItem, target)
0021     }
0022 
0023     // The stack of pending pages. Once all backing data is ready we fill the pending stack with all
0024     // pages that ought to get shown eventually. This enables all pages to simply pop the next page and push
0025     // it into the stack once they are done with their thing.
0026     property var pendingStack: []
0027 
0028     initialItem: Item {
0029         QQC2.BusyIndicator {
0030             anchors.centerIn: parent
0031             running: !sambaPlugin.ready || !groupManager.ready
0032 
0033             onRunningChanged: {
0034                 if (running) {
0035                     return
0036                 }
0037 
0038                 pendingStack.push("ACLPage.qml")
0039                 if (!sambaPlugin.userManager.currentUser().inSamba) {
0040                     pendingStack.push("UserPage.qml")
0041                 }
0042                 if (!groupManager.member) {
0043                     pendingStack.push("GroupPage.qml")
0044                 }
0045                 if (!sambaPlugin.isSambaInstalled()) {
0046                     // NB: the plugin may be built without installer support!
0047                     if (Samba.Installer === undefined) {
0048                         pendingStack.push("MissingSambaPage.qml")
0049                     } else {
0050                         pendingStack.push("InstallPage.qml")
0051                     }
0052                 }
0053 
0054                 stack.clear()
0055                 stack.push(pendingStack.pop())
0056             }
0057         }
0058     }
0059 }