From e1d8ca658d6d64845aeec35c78226825f5c94760 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Sun, 7 Apr 2024 01:09:13 +0800 Subject: [PATCH] Add a "no shares" label if there are no shares available in share view Signed-off-by: Claudio Cambra --- .../ShareTableViewDataSource.swift | 2 +- .../ShareViewController.swift | 2 + .../FileProviderUIExt/ShareViewController.xib | 50 ++++++++++++------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift index cf8087bc46724..1200499ab5ec0 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift @@ -32,7 +32,7 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele private(set) var kit: NextcloudKit? private(set) var itemURL: URL? private(set) var itemServerRelativePath: String? - private var shares: [NKShare] = [] { + private(set) var shares: [NKShare] = [] { didSet { Task { @MainActor in sharesTableView?.reloadData() } } } private var account: NextcloudAccount? { diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift index 17016dcc44052..55955f143984d 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift @@ -27,6 +27,7 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate { @IBOutlet weak var loadingIndicator: NSProgressIndicator! @IBOutlet weak var errorMessageStackView: NSStackView! @IBOutlet weak var errorTextLabel: NSTextField! + @IBOutlet weak var noSharesLabel: NSTextField! public override var nibName: NSNib.Name? { return NSNib.Name(self.className) @@ -143,6 +144,7 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate { } func fetchFinished() { + noSharesLabel.isHidden = !shareDataSource.shares.isEmpty loadingEffectView.isHidden = true loadingIndicator.stopAnimation(self) } diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib index a797c5e9b1d31..7a61de7033656 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -19,6 +19,7 @@ + @@ -28,10 +29,10 @@ - + - + @@ -49,7 +50,7 @@ - + @@ -57,7 +58,7 @@ - + @@ -123,8 +124,8 @@ - - + + @@ -132,7 +133,7 @@ - + @@ -326,8 +327,8 @@ - - + + @@ -343,7 +344,7 @@ - + @@ -478,6 +479,14 @@ + + + + + + + + @@ -503,6 +512,9 @@ + + +