mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Simplify configuration of text field delegate
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
66f77233a8
commit
4464f7e460
1 changed files with 9 additions and 6 deletions
|
@ -42,13 +42,16 @@ class ShareOptionsView: NSView {
|
|||
Logger.shareOptionsView.error("Could not configure suggestions data source.")
|
||||
return
|
||||
}
|
||||
suggestionsWindowController.dataSource = ShareeSuggestionsDataSource(kit: kit)
|
||||
suggestionsWindowController.parentTextField = shareRecipientTextField
|
||||
|
||||
suggestionsTextFieldDelegate.suggestionsWindowController = suggestionsWindowController
|
||||
shareRecipientTextField.delegate = suggestionsTextFieldDelegate
|
||||
|
||||
suggestionsWindowController.begin(for: shareRecipientTextField)
|
||||
suggestionsTextFieldDelegate.suggestionsDataSource = ShareeSuggestionsDataSource(
|
||||
kit: kit
|
||||
)
|
||||
suggestionsTextFieldDelegate.confirmationHandler = { suggestion in
|
||||
guard let sharee = suggestion?.data as? NKSharee else { return }
|
||||
self.shareRecipientTextField.stringValue = sharee.shareWith
|
||||
Logger.shareOptionsView.debug("Chose sharee \(sharee.shareWith, privacy: .public)")
|
||||
}
|
||||
suggestionsTextFieldDelegate.targetTextField = shareRecipientTextField
|
||||
}
|
||||
}
|
||||
var dataSource: ShareTableViewDataSource?
|
||||
|
|
Loading…
Reference in a new issue