mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Make share property central to display update of share table item view
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
46e2ca5887
commit
18de0d0b3f
2 changed files with 18 additions and 5 deletions
|
@ -6,12 +6,25 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import AppKit
|
import AppKit
|
||||||
|
import NextcloudKit
|
||||||
|
|
||||||
class ShareTableItemView: NSTableCellView {
|
class ShareTableItemView: NSTableCellView {
|
||||||
@IBOutlet weak var typeImageView: NSImageView!
|
@IBOutlet private weak var typeImageView: NSImageView!
|
||||||
@IBOutlet weak var label: NSTextField!
|
@IBOutlet private weak var label: NSTextField!
|
||||||
@IBOutlet weak var copyLinkButton: NSButton!
|
@IBOutlet private weak var copyLinkButton: NSButton!
|
||||||
@IBOutlet weak var optionsButton: NSButton!
|
@IBOutlet private weak var optionsButton: NSButton!
|
||||||
|
|
||||||
|
var share: NKShare? {
|
||||||
|
didSet {
|
||||||
|
guard let share = share else {
|
||||||
|
prepareForReuse()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
typeImageView.image = share.typeImage
|
||||||
|
label.stringValue = share.displayString
|
||||||
|
copyLinkButton.isHidden = share.shareType != NKShare.ShareType.publicLink.rawValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
typeImageView.image = nil
|
typeImageView.image = nil
|
||||||
|
|
|
@ -146,7 +146,7 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele
|
||||||
Logger.sharesDataSource.error("Acquired item view from table is not a Share item view!")
|
Logger.sharesDataSource.error("Acquired item view from table is not a Share item view!")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
view.label.stringValue = share.label
|
view.share = share
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue