Show the Keyboard Shortcuts menu via its new Window menu command. The window’s HTML content remains to be done, though.

This commit is contained in:
Brent Simmons 2017-11-13 18:33:23 -08:00
parent 5d781d1657
commit 0bc84aa50c
5 changed files with 45 additions and 2 deletions

View File

@ -93,6 +93,7 @@
84E46C7D1F75EF7B005ECFB3 /* AppDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E46C7C1F75EF7B005ECFB3 /* AppDefaults.swift */; };
84E95CF71FABB3C800552D99 /* FeedList.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84E95CF61FABB3C800552D99 /* FeedList.plist */; };
84E95D241FB1087500552D99 /* ArticlePasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E95D231FB1087500552D99 /* ArticlePasteboardWriter.swift */; };
84EB381F1FBA8B9F000D2111 /* KeyboardShortcuts.html in Resources */ = {isa = PBXBuildFile; fileRef = 84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */; };
84F204CE1FAACB660076E152 /* FeedListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204CD1FAACB660076E152 /* FeedListViewController.swift */; };
84F204DE1FAACB8B0076E152 /* FeedListTimelineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DD1FAACB8B0076E152 /* FeedListTimelineViewController.swift */; };
84F204E01FAACBB30076E152 /* ArticleArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DF1FAACBB30076E152 /* ArticleArray.swift */; };
@ -467,6 +468,7 @@
84E46C7C1F75EF7B005ECFB3 /* AppDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDefaults.swift; path = Evergreen/AppDefaults.swift; sourceTree = "<group>"; };
84E95CF61FABB3C800552D99 /* FeedList.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = FeedList.plist; sourceTree = "<group>"; };
84E95D231FB1087500552D99 /* ArticlePasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticlePasteboardWriter.swift; sourceTree = "<group>"; };
84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = KeyboardShortcuts.html; sourceTree = "<group>"; };
84F204CD1FAACB660076E152 /* FeedListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListViewController.swift; sourceTree = "<group>"; };
84F204DD1FAACB8B0076E152 /* FeedListTimelineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListTimelineViewController.swift; sourceTree = "<group>"; };
84F204DF1FAACBB30076E152 /* ArticleArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleArray.swift; sourceTree = "<group>"; };
@ -697,6 +699,7 @@
849A979A1ED9EFEB007D329B /* styleSheet.css */,
849A979B1ED9EFEB007D329B /* template.html */,
849C646C1ED37A5D003D8FC0 /* Info.plist */,
84EB380F1FBA8B9F000D2111 /* KeyboardShortcuts */,
);
name = Resources;
path = Evergreen/Extensions;
@ -864,6 +867,15 @@
path = Importers;
sourceTree = "<group>";
};
84EB380F1FBA8B9F000D2111 /* KeyboardShortcuts */ = {
isa = PBXGroup;
children = (
84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */,
);
name = KeyboardShortcuts;
path = Evergreen/Resources/KeyboardShortcuts;
sourceTree = SOURCE_ROOT;
};
84FB9A2C1EDCD6A4003D53B9 /* Frameworks */ = {
isa = PBXGroup;
children = (
@ -1194,6 +1206,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84EB381F1FBA8B9F000D2111 /* KeyboardShortcuts.html in Resources */,
849A97951ED9EF7A007D329B /* IndeterminateProgressWindow.xib in Resources */,
849A978F1ED9EE72007D329B /* DefaultFeeds.plist in Resources */,
849A979D1ED9EFEB007D329B /* template.html in Resources */,

View File

@ -13,6 +13,7 @@ import RSTextDrawing
import RSTree
import RSWeb
import Account
import RSCore
let appName = "Evergreen"
var currentTheme: VSTheme!
@ -27,6 +28,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
var dinosaursWindowController: DinosaursWindowController?
var addFeedController: AddFeedController?
var addFolderWindowController: AddFolderWindowController?
var keyboardShortcutsWindowController: WebViewWindowController?
let themeLoader = VSThemeLoader()
private let appNewsURLString = "https://ranchero.com/evergreen/feed.json"
private let dockBadge = DockBadge()
@ -207,6 +210,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
dinosaursWindowController!.showWindow(self)
}
@IBAction func showKeyboardShortcutsWindow(_ sender: Any?) {
if keyboardShortcutsWindowController == nil {
keyboardShortcutsWindowController = WebViewWindowController(title: NSLocalizedString("Keyboard Shortcuts", comment: "window title"))
let htmlFile = Bundle(for: type(of: self)).path(forResource: "KeyboardShortcuts", ofType: "html")!
keyboardShortcutsWindowController?.displayContents(of: htmlFile)
}
keyboardShortcutsWindowController!.showWindow(self)
}
@IBAction func importOPMLFromFile(_ sender: AnyObject) {
let panel = NSOpenPanel()

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13770" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13526" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13770"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13526"/>
</dependencies>
<scenes>
<!--Application-->
@ -464,6 +464,12 @@
<action selector="showDinosaursWindow:" target="Ady-hI-5gd" id="txx-zB-q2J"/>
</connections>
</menuItem>
<menuItem title="Keyboard Shortcuts" id="9fu-ah-S4X">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="showKeyboardShortcutsWindow:" target="Ady-hI-5gd" id="gnm-4I-7ab"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Keyboard Shortcuts</title>
</head>
<body>
<h1>Keyboard Shortcuts</h1>
<p>TODO: <a href="https://github.com/brentsimmons/Evergreen/issues/163">Keyboard shortcuts window #163</a></p>
</body>
</html>

View File

@ -29,6 +29,8 @@ public final class WebViewWindowController: NSWindowController {
// We assume there might be images, style sheets, etc. contained by the folder that the file appears in, so we get read access to the parent folder.
let _ = self.window
let fileURL = URL(fileURLWithPath: path)
let folderURL = fileURL.deletingLastPathComponent()