Make create button in share view controller show options view and toggle create mode

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-03-06 20:08:45 +08:00
parent e1997bd1fd
commit 131973b935
2 changed files with 10 additions and 2 deletions

View file

@ -18,6 +18,7 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
@IBOutlet weak var fileNameIcon: NSImageView!
@IBOutlet weak var fileNameLabel: NSTextField!
@IBOutlet weak var descriptionLabel: NSTextField!
@IBOutlet weak var createButton: NSButton!
@IBOutlet weak var closeButton: NSButton!
@IBOutlet weak var tableView: NSTableView!
@IBOutlet weak var optionsView: ShareOptionsView!
@ -26,7 +27,6 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
@IBOutlet weak var loadingIndicator: NSProgressIndicator!
@IBOutlet weak var errorMessageStackView: NSStackView!
@IBOutlet weak var errorTextLabel: NSTextField!
@IBOutlet weak var errorDismissLabel: NSButton!
public override var nibName: NSNib.Name? {
return NSNib.Name(self.className)
@ -110,6 +110,13 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
errorMessageStackView.isHidden = true
}
@IBAction func createShare(_ sender: Any) {
tableView.deselectAll(self)
optionsView.createMode = true
splitView.addArrangedSubview(optionsView)
optionsView.isHidden = false
}
func fetchStarted() {
loadingEffectView.isHidden = false
loadingIndicator.startAnimation(self)

View file

@ -11,6 +11,7 @@
<customObject id="-2" userLabel="File's Owner" customClass="ShareViewController" customModule="FileProviderUIExt" customModuleProvider="target">
<connections>
<outlet property="closeButton" destination="aDA-n9-Zly" id="niR-Ad-FEa"/>
<outlet property="createButton" destination="BMA-BP-wHc" id="HEq-bN-i9V"/>
<outlet property="descriptionLabel" destination="gX0-nE-MrU" id="RoY-u1-1on"/>
<outlet property="errorMessageStackView" destination="dFs-Gh-2WQ" id="kkQ-Uq-xk7"/>
<outlet property="errorTextLabel" destination="770-HW-oC7" id="gfn-SV-TNM"/>
@ -82,7 +83,7 @@
<imageReference key="image" image="plus" catalog="system" symbolScale="large"/>
</buttonCell>
<connections>
<action selector="closeAction:" target="-2" id="WC4-wl-0Bk"/>
<action selector="createShare:" target="-2" id="NLV-ZM-y1w"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="aDA-n9-Zly">