Add checkbox in share details page for resharing allowed setting
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 10 Aug 2023 08:03:34 +0000 (16:03 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 11 Aug 2023 14:59:59 +0000 (22:59 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/ShareDetailsPage.qml

index a8755526f5e3b537a46b705b1d7797c8ee1a44d4..ef90d97bd456fe40b335f748b1576c0ed3ca5844 100644 (file)
@@ -66,6 +66,7 @@ Page {
 
     readonly property string linkShareLabel: shareModelData.linkShareLabel ?? ""
 
+    readonly property bool resharingAllowed: shareModelData.resharingAllowed
     readonly property bool editingAllowed: shareModelData.editingAllowed
     readonly property bool hideDownload: shareModelData.hideDownload
     readonly property bool noteEnabled: shareModelData.noteEnabled
@@ -416,6 +417,52 @@ Page {
                         padding: scrollContentsColumn.itemPadding
                         onClicked: root.permissionModeChanged(permissionMode)
                     }
+
+                    CheckBox {
+                        id: allowResharingCheckBox
+
+                        Layout.fillWidth: true
+
+                        // TODO: Rather than setting all these palette colours manually,
+                        // create a custom style and do it for all components globally.
+                        //
+                        // Additionally, we need to override the entire palette when we
+                        // set one palette property, as otherwise we default back to the
+                        // theme palette -- not the parent palette
+                        palette {
+                            text: Style.ncTextColor
+                            windowText: Style.ncTextColor
+                            buttonText: Style.ncTextColor
+                            brightText: Style.ncTextBrightColor
+                            highlight: Style.lightHover
+                            highlightedText: Style.ncTextColor
+                            light: Style.lightHover
+                            midlight: Style.ncSecondaryTextColor
+                            mid: Style.darkerHover
+                            dark: Style.menuBorder
+                            button: Style.buttonBackgroundColor
+                            window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox
+                            base: Style.backgroundColor
+                            toolTipBase: Style.backgroundColor
+                            toolTipText: Style.ncTextColor
+                        }
+
+                        spacing: scrollContentsColumn.indicatorSpacing
+                        padding: scrollContentsColumn.itemPadding
+                        indicator.width: scrollContentsColumn.indicatorItemWidth
+                        indicator.height: scrollContentsColumn.indicatorItemWidth
+
+                        checkable: true
+                        checked: root.resharingAllowed
+                        text: qsTr("Allow resharing")
+                        enabled: !root.isSharePermissionChangeInProgress
+                        onClicked: root.toggleAllowResharing(checked);
+
+                        Connections {
+                            target: root
+                            onResharingAllowedChanged: allowResharingCheckBox.checked = root.resharingAllowed
+                        }
+                    }
                 }
             }