Implement share link copying in share table item view

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-02-28 16:35:57 +08:00
parent 4f0e25a4e6
commit 540eb11bf2
2 changed files with 10 additions and 0 deletions

View 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)
}
}

View 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"/>