Implement share link copying in share table item view
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 28 Feb 2024 08:35:57 +0000 (16:35 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 17 Apr 2024 08:38:51 +0000 (16:38 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableItemView.swift
shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableItemView.xib

index fe68e91a733b7edd2eef6d9afbe934b1dc85bd9b..f4af970bdc8f475cbd2e4d93eab055b22c6fbafc 100644 (file)
@@ -32,4 +32,11 @@ class ShareTableItemView: NSTableCellView {
         copyLinkButton.isHidden = false
         super.prepareForReuse()
     }
+
+    @IBAction func copyShareLink(sender: Any) {
+        guard let share = share else { return }
+        let pasteboard = NSPasteboard.general
+        pasteboard.declareTypes([.string], owner: nil)
+        pasteboard.setString(share.url, forType: .string)
+    }
 }
index 7685eedb246733acef41a1da4ae2dc3e0209e3ee..5f028f308f91e11e3c63cccb39a8893cec4c4bf0 100644 (file)
@@ -46,6 +46,9 @@
                             <constraints>
                                 <constraint firstAttribute="width" secondItem="y6i-wm-BtQ" secondAttribute="height" multiplier="1:1" id="BlJ-WU-1y5"/>
                             </constraints>
+                            <connections>
+                                <action selector="copyShareLinkWithSender:" target="WWf-Il-fKw" id="dgW-8v-wfd"/>
+                            </connections>
                         </button>
                         <button horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e8z-Xl-jOh">
                             <rect key="frame" x="280" y="0.0" width="32" height="32"/>