Run the new-folder sheet on the frontmost window.

This commit is contained in:
Brent Simmons 2017-11-15 13:13:40 -08:00
parent 3612469954
commit baaf9c1a02
2 changed files with 14 additions and 3 deletions

View File

@ -54,6 +54,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
appDelegate = self appDelegate = self
} }
// MARK: - API
func logMessage(_ message: String, type: LogItem.ItemType) { func logMessage(_ message: String, type: LogItem.ItemType) {
let logItem = LogItem(type: type, message: message) let logItem = LogItem(type: type, message: message)
@ -65,6 +67,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
logMessage(message, type: .debug) logMessage(message, type: .debug)
} }
func showAddFolderSheetOnWindow(_ window: NSWindow) {
addFolderWindowController = AddFolderWindowController()
addFolderWindowController!.runSheetOnWindow(window)
}
// MARK: - NSApplicationDelegate // MARK: - NSApplicationDelegate
func applicationDidFinishLaunching(_ note: Notification) { func applicationDidFinishLaunching(_ note: Notification) {
@ -211,9 +219,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
@IBAction func showAddFolderWindow(_ sender: AnyObject) { @IBAction func showAddFolderWindow(_ sender: AnyObject) {
createAndShowMainWindow() createAndShowMainWindow()
showAddFolderSheetOnWindow(mainWindowController!.window!)
addFolderWindowController = AddFolderWindowController()
addFolderWindowController!.runSheetOnWindow(mainWindowController!.window!)
} }
@IBAction func showFeedList(_ sender: AnyObject) { @IBAction func showFeedList(_ sender: AnyObject) {

View File

@ -111,6 +111,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
// MARK: Actions // MARK: Actions
@IBAction func showAddFolderWindow(_ sender: AnyObject) {
appDelegate.showAddFolderSheetOnWindow(window!)
}
@IBAction func openArticleInBrowser(_ sender: AnyObject?) { @IBAction func openArticleInBrowser(_ sender: AnyObject?) {
if let link = currentLink { if let link = currentLink {