Warning, /network/kdenetwork-filesharing/samba/filepropertiesplugin/qml/ChangePermissionsPage.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: 2021 Slava Aseev <nullptrnine@basealt.ru>
0004 SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0005 */
0006
0007 import QtQuick 2.12
0008 import QtQuick.Controls 2.15 as QQC2
0009 import QtQuick.Layouts 1.14
0010 import org.kde.kirigami 2.12 as Kirigami
0011
0012 Item {
0013 id: page
0014
0015 ColumnLayout {
0016 anchors.fill: parent
0017 Layout.fillWidth: true
0018 Layout.fillHeight: true
0019
0020 Kirigami.InlineMessage {
0021 id: changePermissionsError
0022 Layout.fillWidth: true
0023 visible: text !== ""
0024 type: Kirigami.MessageType.Error
0025 }
0026
0027 ColumnLayout {
0028 Layout.fillWidth: true
0029
0030 QQC2.Label {
0031 Layout.fillWidth: true
0032 wrapMode: Text.WordWrap
0033 textFormat: Text.RichText
0034 text: xi18nc("@info", `
0035 <para>The folder <filename>%1</filename> needs extra permissions for sharing to work.</para>
0036 <para>Do you want to add these permissions now?</para><nl/>
0037 `, sambaPlugin.shareContext.path)
0038 }
0039
0040 QQC2.ScrollView {
0041 Layout.fillWidth: true
0042 Layout.fillHeight: true
0043
0044 contentItem: TableView {
0045 id: view
0046
0047 clip: true
0048 interactive: false
0049 model: sambaPlugin.permissionsHelper.model
0050
0051 property int maxColumn: model.columnCount() - 1
0052
0053 delegate: QQC2.Label {
0054 font.bold: row == 0 /* header */ ? true : false
0055 Layout.fillWidth: true
0056 text: display
0057 font.family: "monospace"
0058 rightPadding: column >= view.maxColumn ? 0 : Kirigami.Units.largeSpacing
0059 }
0060 }
0061 }
0062 }
0063
0064 Kirigami.ActionToolBar {
0065 alignment: Qt.AlignRight
0066 flat: false
0067
0068 actions: [
0069 Kirigami.Action {
0070 icon.name: "dialog-ok-apply"
0071 text: i18nc("@action:button changes permissions", "Change Permissions")
0072 onTriggered: {
0073 var failedPaths = sambaPlugin.permissionsHelper.changePermissions()
0074 if (failedPaths.length > 0) {
0075 changePermissionsError.text =
0076 i18nc("@label",
0077 "Could not change permissions for: %1. All permission changes have been reverted to initial state.",
0078 failedPaths.join(", "))
0079 } else {
0080 stack.pop()
0081 }
0082 }
0083 },
0084 Kirigami.Action {
0085 icon.name: "dialog-cancel"
0086 text: i18nc("@action:button cancels permissions change", "Cancel")
0087 onTriggered: stack.pop()
0088 }
0089 ]
0090 }
0091 }
0092 }