mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Handle feed renames in the inspector. Handle multiple selection. Fix #137.
This commit is contained in:
@@ -129,12 +129,11 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
self.database = Database(databaseFilePath: databaseFilePath, accountID: accountID)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(downloadProgressDidChange(_:)), name: .DownloadProgressDidChange, object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
||||
|
||||
pullObjectsFromDisk()
|
||||
|
||||
@@ -438,6 +437,16 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
}
|
||||
}
|
||||
|
||||
@objc func displayNameDidChange(_ note: Notification) {
|
||||
|
||||
if let feed = note.object as? Feed, let feedAccount = feed.account, feedAccount === self {
|
||||
dirty = true
|
||||
}
|
||||
if let folder = note.object as? Folder, let folderAccount = folder.account, folderAccount === self {
|
||||
dirty = true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
public class func ==(lhs: Account, rhs: Account) -> Bool {
|
||||
|
||||
@@ -17,7 +17,6 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
|
||||
public var name: String? {
|
||||
didSet {
|
||||
account?.dirty = true
|
||||
postDisplayNameDidChangeNotification()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,13 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
public var faviconURL: String?
|
||||
public var name: String?
|
||||
public var authors: Set<Author>?
|
||||
public var editedName: String?
|
||||
|
||||
public var editedName: String? {
|
||||
didSet {
|
||||
postDisplayNameDidChangeNotification()
|
||||
}
|
||||
}
|
||||
|
||||
public var conditionalGetInfo: HTTPConditionalGetInfo?
|
||||
public var contentHash: String?
|
||||
public let hashValue: Int
|
||||
@@ -29,7 +35,13 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
|
||||
public var nameForDisplay: String {
|
||||
get {
|
||||
return (editedName ?? name) ?? NSLocalizedString("Untitled", comment: "Feed name")
|
||||
if let s = editedName, !s.isEmpty {
|
||||
return s
|
||||
}
|
||||
if let s = name, !s.isEmpty {
|
||||
return s
|
||||
}
|
||||
return NSLocalizedString("Untitled", comment: "Feed name")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user