Text Fixes.
- Replaced URL with URI where appropriate. - Fixed some typos - Updated README (and corrected the attribution of the SynchronizedArray code)
This commit is contained in:
@@ -27,14 +27,14 @@ final internal class ControllersRef: NSObject {
|
||||
/** Transform Tab names to abstract cases. */
|
||||
enum tabNames:String {
|
||||
case Internet
|
||||
case URLs
|
||||
case URIs
|
||||
case UTIs
|
||||
case Applications
|
||||
init? (value: String?) {
|
||||
if let value = value {
|
||||
switch value {
|
||||
case "Internet": self = .Internet
|
||||
case "URL Schemes": self = .URLs
|
||||
case "URI Schemes": self = .URIs
|
||||
case "Uniform Type Identifiers": self = .UTIs
|
||||
case "Applications": self = .Applications
|
||||
default: return nil
|
||||
@@ -55,7 +55,7 @@ final internal class ControllersRef: NSObject {
|
||||
if let Tab = Tab {
|
||||
switch Tab {
|
||||
case "Internet": return "contentDescription"
|
||||
case "URLs": return "contentName"
|
||||
case "URIs": return "contentName"
|
||||
case "UTIs": return "contentName"
|
||||
case "Applications": return "displayName"
|
||||
default: return "contentName"
|
||||
@@ -71,7 +71,7 @@ final internal class ControllersRef: NSObject {
|
||||
|
||||
switch Tab {
|
||||
case "Internet": modelArray = #keyPath(SWDAHandlersModel.internetSchemes)
|
||||
case "URLs": modelArray = #keyPath(SWDAHandlersModel.allSchemes)
|
||||
case "URIs": modelArray = #keyPath(SWDAHandlersModel.allSchemes)
|
||||
case "UTIs": modelArray = #keyPath(SWDAHandlersModel.allUTIs)
|
||||
case "Applications": modelArray = #keyPath(SWDAHandlersModel.allApps)
|
||||
default: modelArray = ""
|
||||
@@ -102,7 +102,7 @@ final internal class ControllersRef: NSObject {
|
||||
if let Tab = Tab {
|
||||
switch Tab {
|
||||
case "Internet": return false
|
||||
case "URLs": return true
|
||||
case "URIs": return true
|
||||
case "UTIs": return true
|
||||
case "Applications": return true
|
||||
default: return true
|
||||
@@ -111,11 +111,11 @@ final internal class ControllersRef: NSObject {
|
||||
else { return true }
|
||||
}
|
||||
|
||||
/** Determines whether to show the "Add" button for custom URL Schemes. */
|
||||
/** Determines whether to show the "Add" button for custom URI Schemes. */
|
||||
static var shouldShowAddRemove: Bool {
|
||||
if let Tab = Tab {
|
||||
switch Tab {
|
||||
case "URLs": return true
|
||||
case "URIs": return true
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ internal class SWDATreeRow:NSObject {
|
||||
guard (self.rowContent != nil) else { return false }
|
||||
let contentType = self.rowContent?.content.contentType
|
||||
guard (contentType != .Application) else { return false }
|
||||
let defaultHandler = (contentType == .URL) ? LSWrappers.Schemes.copyDefaultHandler(self.rowTitle, asPath: false) : LSWrappers.UTType.copyDefaultHandler(self.rowTitle, inRoles: LSRolesMask(from:self.roleMask!), asPath: false)
|
||||
let defaultHandler = (contentType == .URI) ? LSWrappers.Schemes.copyDefaultHandler(self.rowTitle, asPath: false) : LSWrappers.UTType.copyDefaultHandler(self.rowTitle, inRoles: LSRolesMask(from:self.roleMask!), asPath: false)
|
||||
return self.rowContent?.application?.appBundleID?.lowercased() == defaultHandler?.lowercased()
|
||||
}
|
||||
set {
|
||||
@@ -137,7 +137,7 @@ internal class SWDATreeRow:NSObject {
|
||||
switch content.contentType {
|
||||
case .Application: return false
|
||||
case .UTI: handler = LSWrappers.UTType.copyDefaultHandler(content.contentName, inRoles:LSRolesMask(from:self.roleMask!), asPath: false)
|
||||
case .URL: handler = LSWrappers.Schemes.copyDefaultHandler(content.contentName, asPath: false)
|
||||
case .URI: handler = LSWrappers.Schemes.copyDefaultHandler(content.contentName, asPath: false)
|
||||
}
|
||||
guard (handler != nil) else { return false }
|
||||
return (handler?.lowercased() == rowContent?.application?.appBundleID?.lowercased())
|
||||
|
||||
@@ -38,7 +38,7 @@ extension DRYView {
|
||||
return NSNumber(booleanLiteral:ControllersRef.TabData.shouldShowAppPath)
|
||||
}
|
||||
|
||||
/** The only tab where an "Add" button is at all meaningful is the URL Schemes. */
|
||||
/** The only tab where an "Add" button is at all meaningful is the URI Schemes. */
|
||||
@objc var showAddRemoveBool: NSNumber {
|
||||
guard (self.currentTab != nil) else { return NSNumber(booleanLiteral:false) }
|
||||
return NSNumber(booleanLiteral:ControllersRef.TabData.shouldShowAddRemove)
|
||||
@@ -103,7 +103,7 @@ class SWDATabTemplate: DRYView {
|
||||
}
|
||||
}
|
||||
|
||||
/** Add a custom URL Scheme and assign our dummy app as the default handler. In practice this should almost never be necessary but sometimes Launch Services move in mysterious ways. */
|
||||
/** Add a custom URI Scheme and assign our dummy app as the default handler. In practice this should almost never be necessary but sometimes Launch Services move in mysterious ways. */
|
||||
@IBAction func addCustomScheme(_ sender: NSButton) {
|
||||
guard (customNewScheme?.stringValue != nil) && (customNewScheme?.stringValue != "") else { return }
|
||||
let result = LSWrappers.Schemes.setDefaultHandler(customNewScheme!.stringValue, "cl.fail.lordkamina.ThisAppDoesNothing")
|
||||
@@ -216,7 +216,7 @@ class SWDATabViewController: NSTabViewController {
|
||||
top.identifier = "TabView Top"
|
||||
let bottom = NSLayoutConstraint(item: ControllersRef.sharedInstance.theMainView!, attribute: .bottom , relatedBy: .equal, toItem: self.tabView, attribute: .bottom , multiplier: 1, constant: 10)
|
||||
bottom.identifier = "TabView Bottom"
|
||||
let tabs = ["Internet", "URL Schemes", "Uniform Type Identifiers", "Applications"]
|
||||
let tabs = ["Internet", "URI Schemes", "Uniform Type Identifiers", "Applications"]
|
||||
|
||||
ControllersRef.sharedInstance.theMainView.addConstraints([centerX, leading, trailing, bottom, top])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user