diff --git a/FSNotes/Base.lproj/Main.storyboard b/FSNotes/Base.lproj/Main.storyboard index c02f61324..cd4a69b53 100644 --- a/FSNotes/Base.lproj/Main.storyboard +++ b/FSNotes/Base.lproj/Main.storyboard @@ -2001,8 +2001,8 @@ CA - - + + @@ -4015,14 +4015,14 @@ Olena Hlushcneko - + - + - - + + @@ -4031,7 +4031,7 @@ Olena Hlushcneko - + @@ -4041,7 +4041,7 @@ Olena Hlushcneko - + @@ -4911,7 +4911,7 @@ Olena Hlushcneko - + diff --git a/FSNotes/EditorViewController.swift b/FSNotes/EditorViewController.swift index 5263e0434..31c3188a5 100644 --- a/FSNotes/EditorViewController.swift +++ b/FSNotes/EditorViewController.swift @@ -1046,7 +1046,10 @@ class EditorViewController: NSViewController, NSTextViewDelegate, NSMenuItemVali viewController.editor.fill(note: note) if note.isEncryptedAndLocked() { + viewController.lockUnlockButton.image = NSImage(named: NSImage.lockLockedTemplateName) viewController.toggleNotesLock(self) + } else { + viewController.lockUnlockButton.image = NSImage(named: NSImage.lockUnlockedTemplateName) } AppDelegate.noteWindows.insert(windowController, at: 0) @@ -1161,6 +1164,20 @@ class EditorViewController: NSViewController, NSTextViewDelegate, NSMenuItemVali if editor.note == note { editor.editorViewController?.refillEditArea(force: true) + let lockIcon = note.isEncryptedAndLocked() + ? NSImage.lockLockedTemplateName + : NSImage.lockUnlockedTemplateName + + let lockImage = NSImage(named: lockIcon) + + if let noteVC = editor.editorViewController as? NoteViewController { + noteVC.lockUnlockButton.image = lockImage + } + + if let mainVC = editor.editorViewController as? ViewController { + mainVC.lockUnlock.image = lockImage + } + editor.window?.makeFirstResponder(editor) } } diff --git a/FSNotes/ViewController.swift b/FSNotes/ViewController.swift index 3f1364191..d44972fea 100644 --- a/FSNotes/ViewController.swift +++ b/FSNotes/ViewController.swift @@ -115,10 +115,10 @@ class ViewController: EditorViewController, guard self?.titleLabel.isEnabled == false || self?.titleLabel.isEditable == false else { return } if let note = self?.editor.note { - if note.isUnlocked() { - self?.lockUnlock.image = NSImage(named: NSImage.lockUnlockedTemplateName) - } else { + if note.isEncryptedAndLocked() { self?.lockUnlock.image = NSImage(named: NSImage.lockLockedTemplateName) + } else { + self?.lockUnlock.image = NSImage(named: NSImage.lockUnlockedTemplateName) } }