diff --git a/Evergreen/AppDelegate.swift b/Evergreen/AppDelegate.swift index 36f04da16..1c9567e92 100644 --- a/Evergreen/AppDelegate.swift +++ b/Evergreen/AppDelegate.swift @@ -249,15 +249,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool { + let isDisplayingSheet = mainWindowController?.isDisplayingSheet ?? false + if item.action == #selector(refreshAll(_:)) { return !AccountManager.shared.refreshInProgress } if item.action == #selector(addAppNews(_:)) { - return !AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) + return !isDisplayingSheet && !AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) } if item.action == #selector(sortByNewestArticleOnTop(_:)) || item.action == #selector(sortByOldestArticleOnTop(_:)) { return mainWindowController?.isOpen ?? false } + if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) { + return !isDisplayingSheet + } return true } @@ -266,6 +271,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, func addFeed(_ urlString: String?, _ name: String? = nil) { createAndShowMainWindow() + if mainWindowController!.isDisplayingSheet { + return + } addFeedController = AddFeedController(hostWindow: mainWindowController!.window!) addFeedController?.showAddFeedSheet(urlString, name) diff --git a/Evergreen/Base.lproj/MainWindow.storyboard b/Evergreen/Base.lproj/MainWindow.storyboard index 49801d380..a2232733d 100644 --- a/Evergreen/Base.lproj/MainWindow.storyboard +++ b/Evergreen/Base.lproj/MainWindow.storyboard @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS"> +<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14087.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS"> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14087.3"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> diff --git a/Evergreen/MainWindow/MainWindowController.swift b/Evergreen/MainWindow/MainWindowController.swift index c31e811d2..fc3710bef 100644 --- a/Evergreen/MainWindow/MainWindowController.swift +++ b/Evergreen/MainWindow/MainWindowController.swift @@ -18,6 +18,13 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { return isWindowLoaded && window!.isVisible } + var isDisplayingSheet: Bool { + if let _ = window?.attachedSheet { + return true + } + return false + } + // MARK: NSWindowController private let windowAutosaveName = NSWindow.FrameAutosaveName(rawValue: kWindowFrameKey)