Add Help menu items.

This commit is contained in:
Brent Simmons 2017-05-27 13:37:50 -07:00
parent b502d297e6
commit e79dbaef68
4 changed files with 50 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import DataModel
import RSTextDrawing
import RSTree
import RSXML
import RSWeb
var currentTheme: VSTheme!
@ -283,6 +284,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
addFeed(appNewsURLString, "Evergreen News")
}
@IBAction func openWebsite(_ sender: AnyObject) {
openInBrowser("http://ranchero.com/evergreen/", inBackground: false)
}
@IBAction func openRepository(_ sender: AnyObject) {
openInBrowser("https://github.com/brentsimmons/Evergreen", inBackground: false)
}
@IBAction func openBugTracker(_ sender: AnyObject) {
openInBrowser("https://github.com/brentsimmons/Evergreen/issues", inBackground: false)
}
@IBAction func showHelp(_ sender: AnyObject) {
openInBrowser("http://ranchero.com/evergreen/help/1.0/", inBackground: false)
}
}
private extension AppDelegate {

View File

@ -400,7 +400,33 @@
<items>
<menuItem title="Evergreen Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
<action selector="showHelp:" target="Voe-Tx-rLC" id="WJP-8V-s4K"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iyN-Fr-QXC"/>
<menuItem title="Add Evergreen News Feed" id="cmP-uH-mS8">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="addAppNews:" target="Ady-hI-5gd" id="xHC-9j-EpT"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="rK6-cL-4Vj"/>
<menuItem title="Website" id="q2Z-9K-GBd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="openWebsite:" target="Ady-hI-5gd" id="rmL-lt-p8g"/>
</connections>
</menuItem>
<menuItem title="GitHub Repository" id="QfD-Xw-sdF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="openRepository:" target="Ady-hI-5gd" id="7xZ-V2-iPD"/>
</connections>
</menuItem>
<menuItem title="Bug Tracker" id="mE2-pM-rQF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="openBugTracker:" target="Ady-hI-5gd" id="fZQ-ng-gIm"/>
</connections>
</menuItem>
</items>

View File

@ -21,7 +21,7 @@ func openInBrowser(_ urlString: String) {
func openInBrowser(_ urlString: String, inBackground: Bool) {
if let url = URL(string: urlString) {
let _ = MacWebBrowser.openURL(url, inBackground: inBackground)
MacWebBrowser.openURL(url, inBackground: inBackground)
}
}

View File

@ -10,7 +10,7 @@ import Cocoa
public class MacWebBrowser {
public class func openURL(_ url: URL, inBackground: Bool) -> Bool {
@discardableResult public class func openURL(_ url: URL, inBackground: Bool) -> Bool {
guard let preparedURL = url.preparedForOpeningInBrowser() else {
return false