mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Change import and export OPML so that they don't prompt to select an account if only one is active
This commit is contained in:
@@ -35,8 +35,16 @@ class ExportOPMLWindowController: NSWindowController {
|
||||
// MARK: API
|
||||
|
||||
func runSheetOnWindow(_ hostWindow: NSWindow) {
|
||||
|
||||
self.hostWindow = hostWindow
|
||||
hostWindow.beginSheet(window!)
|
||||
|
||||
if AccountManager.shared.activeAccounts.count == 1 {
|
||||
let account = AccountManager.shared.activeAccounts.first!
|
||||
exportOPML(account: account)
|
||||
} else {
|
||||
hostWindow.beginSheet(window!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
@@ -50,9 +58,14 @@ class ExportOPMLWindowController: NSWindowController {
|
||||
guard let menuItem = accountPopUpButton.selectedItem else {
|
||||
return
|
||||
}
|
||||
|
||||
let account = menuItem.representedObject as! Account
|
||||
|
||||
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
exportOPML(account: account)
|
||||
|
||||
}
|
||||
|
||||
func exportOPML(account: Account) {
|
||||
|
||||
let panel = NSSavePanel()
|
||||
panel.allowedFileTypes = ["opml"]
|
||||
@@ -79,7 +92,6 @@ class ExportOPMLWindowController: NSWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,16 @@ class ImportOPMLWindowController: NSWindowController {
|
||||
// MARK: API
|
||||
|
||||
func runSheetOnWindow(_ hostWindow: NSWindow) {
|
||||
|
||||
self.hostWindow = hostWindow
|
||||
hostWindow.beginSheet(window!)
|
||||
|
||||
if AccountManager.shared.activeAccounts.count == 1 {
|
||||
let account = AccountManager.shared.activeAccounts.first!
|
||||
importOPML(account: account)
|
||||
} else {
|
||||
hostWindow.beginSheet(window!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
@@ -50,9 +58,14 @@ class ImportOPMLWindowController: NSWindowController {
|
||||
guard let menuItem = accountPopUpButton.selectedItem else {
|
||||
return
|
||||
}
|
||||
|
||||
let account = menuItem.representedObject as! Account
|
||||
|
||||
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
importOPML(account: account)
|
||||
|
||||
}
|
||||
|
||||
func importOPML(account: Account) {
|
||||
|
||||
let panel = NSOpenPanel()
|
||||
panel.canDownloadUbiquitousContents = true
|
||||
|
||||
Reference in New Issue
Block a user