]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Hide password field in share settings when share type does not support passwords
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 2 Aug 2023 09:01:01 +0000 (17:01 +0800)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Tue, 22 Aug 2023 08:11:13 +0000 (10:11 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/ShareDetailsPage.qml

index 41bc8deb9f1b683c037c760da6c76baa4d759b33..bc37bb6fdbad6d30a6327759ea314b56d71f30f5 100644 (file)
@@ -80,6 +80,8 @@ Page {
     readonly property int  currentPermissionMode: shareModelData.currentPermissionMode
 
     readonly property bool isLinkShare: shareModelData.shareType === ShareModel.ShareTypeLink
+    readonly property bool isEmailShare: shareModelData.shareType === ShareModel.ShareTypeEmail
+    readonly property bool shareSupportsPassword: isLinkShare || isEmailShare
 
     readonly property bool isFolderItem: shareModelData.sharedItemType === ShareModel.SharedItemTypeFolder
     readonly property bool isEncryptedItem: shareModelData.sharedItemType === ShareModel.SharedItemTypeEncryptedFile || shareModelData.sharedItemType === ShareModel.SharedItemTypeEncryptedFolder || shareModelData.sharedItemType === ShareModel.SharedItemTypeEncryptedTopLevelFolder
@@ -560,7 +562,10 @@ Page {
                 checkable: true
                 checked: root.passwordProtectEnabled
                 text: qsTr("Password protect")
-                enabled: !root.waitingForPasswordProtectEnabledChange && !root.passwordEnforced
+                visible: root.shareSupportsPassword
+                enabled: visible && 
+                         !root.waitingForPasswordProtectEnabledChange && 
+                         !root.passwordEnforced
 
                 onClicked: {
                     root.togglePasswordProtect(checked);
@@ -581,7 +586,7 @@ Page {
                 height: visible ? implicitHeight : 0
                 spacing: scrollContentsColumn.indicatorSpacing
 
-                visible: root.passwordProtectEnabled
+                visible: root.shareSupportsPassword && root.passwordProtectEnabled
 
                 Image {
                     Layout.preferredWidth: scrollContentsColumn.indicatorItemWidth
@@ -603,7 +608,8 @@ Page {
                     height: visible ? implicitHeight : 0
 
                     text: root.password !== "" ? root.password : root.passwordPlaceholder
-                    enabled: root.passwordProtectEnabled &&
+                    enabled: visible &&
+                             root.passwordProtectEnabled &&
                              !root.waitingForPasswordChange &&
                              !root.waitingForPasswordProtectEnabledChange