Upon copying share link, trigger a change in the button to make copy action completed...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 10 May 2023 03:24:55 +0000 (11:24 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 13:16:11 +0000 (21:16 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/ShareDetailsPage.qml

index a4bcc7cafd645494607a1221f850e8ef51838148..17a5a75963bf46c865ecdbf526ef19e3dd7ec6c9 100644 (file)
@@ -853,27 +853,36 @@ Page {
         CustomButton {
             id: copyShareLinkButton
 
+            function copyShareLink() {
+                clipboardHelper.text = root.link;
+                clipboardHelper.selectAll();
+                clipboardHelper.copy();
+                clipboardHelper.clear();
+
+                shareLinkCopied = true;
+            }
+
+            property bool shareLinkCopied: false
+
             height: Style.standardPrimaryButtonHeight
 
             imageSource: "image://svgimage-custom-color/copy.svg/" + Style.ncHeaderTextColor
-            text: qsTr("Copy share link")
+            text: shareLinkCopied ? qsTr("Share link copied!") : qsTr("Copy share link")
             textColor: Style.ncHeaderTextColor
             contentsFont.bold: true
-            bgColor: Style.ncBlue
+            bgColor: shareLinkCopied ? Style.positiveColor : Style.ncBlue
             bgNormalOpacity: 1.0
-            bgHoverOpacity: Style.hoverOpacity
+            bgHoverOpacity: shareLinkCopied ? 1.0 : Style.hoverOpacity
 
             visible: root.isLinkShare
             enabled: visible
 
-            onClicked: {
-                clipboardHelper.text = root.link;
-                clipboardHelper.selectAll();
-                clipboardHelper.copy();
-                clipboardHelper.clear();
-            }
+            onClicked: copyShareLink()
 
-            TextEdit { id: clipboardHelper; visible: false }
+            TextEdit {
+                id: clipboardHelper
+                visible: false
+            }
         }
     }
 }