mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Implement hide and show of share options in share view controller
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
c74575cd32
commit
13fa2bca1d
@ -7,10 +7,11 @@
|
||||
|
||||
import AppKit
|
||||
import FileProvider
|
||||
import NextcloudKit
|
||||
import OSLog
|
||||
import QuickLookThumbnailing
|
||||
|
||||
class ShareViewController: NSViewController {
|
||||
class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
|
||||
let shareDataSource = ShareTableViewDataSource()
|
||||
let itemIdentifiers: [NSFileProviderItemIdentifier]
|
||||
|
||||
@ -20,6 +21,7 @@ class ShareViewController: NSViewController {
|
||||
@IBOutlet weak var closeButton: NSButton!
|
||||
@IBOutlet weak var tableView: NSTableView!
|
||||
@IBOutlet weak var optionsView: NSView!
|
||||
@IBOutlet weak var splitView: NSSplitView!
|
||||
|
||||
public override var nibName: NSNib.Name? {
|
||||
return NSNib.Name(self.className)
|
||||
@ -48,6 +50,10 @@ class ShareViewController: NSViewController {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
hideOptions()
|
||||
}
|
||||
|
||||
@IBAction func closeAction(_ sender: Any) {
|
||||
actionViewController.extensionContext.completeRequest()
|
||||
}
|
||||
@ -60,6 +66,7 @@ class ShareViewController: NSViewController {
|
||||
do {
|
||||
let itemUrl = try await manager.getUserVisibleURL(for: itemIdentifier)
|
||||
await updateDisplay(itemUrl: itemUrl)
|
||||
shareDataSource.uiDelegate = self
|
||||
shareDataSource.sharesTableView = tableView
|
||||
shareDataSource.loadItem(url: itemUrl)
|
||||
} catch let error {
|
||||
@ -91,4 +98,14 @@ class ShareViewController: NSViewController {
|
||||
}
|
||||
fileNameIcon.image = fileThumbnail?.nsImage
|
||||
}
|
||||
|
||||
func hideOptions() {
|
||||
splitView.removeArrangedSubview(optionsView)
|
||||
optionsView.isHidden = true
|
||||
}
|
||||
|
||||
func showOptions(share: NKShare) {
|
||||
splitView.addArrangedSubview(optionsView)
|
||||
optionsView.isHidden = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
<outlet property="fileNameIcon" destination="zSV-DV-Ray" id="336-e0-CEo"/>
|
||||
<outlet property="fileNameLabel" destination="slV-H6-zJ3" id="DPp-sN-Yff"/>
|
||||
<outlet property="optionsView" destination="EXb-m8-yzj" id="uAb-lv-EZ4"/>
|
||||
<outlet property="splitView" destination="91w-SP-6sl" id="20T-gQ-SPY"/>
|
||||
<outlet property="tableView" destination="vb0-a6-eeH" id="KQo-eg-dba"/>
|
||||
<outlet property="view" destination="Jw6-da-U8j" id="5Ek-F1-w7C"/>
|
||||
</connections>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user