mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 15:12:21 +00:00
Table in fix auto type window now gets updates if something changes in the document while the window is open
This commit is contained in:
@@ -44,22 +44,15 @@ NSString *const kMPIconCell = @"IconCell";
|
|||||||
|
|
||||||
@interface MPFixAutotypeWindowController () {
|
@interface MPFixAutotypeWindowController () {
|
||||||
NSMutableArray *_elements;
|
NSMutableArray *_elements;
|
||||||
|
BOOL _didRegisterForUndoRedo;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation MPFixAutotypeWindowController
|
@implementation MPFixAutotypeWindowController
|
||||||
|
|
||||||
- (instancetype)init {
|
- (NSString *)windowNibName {
|
||||||
self = [super initWithWindowNibName:@"FixAutotypeWindow"];
|
return @"FixAutotypeWindow";
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithWindow:(NSWindow *)window {
|
|
||||||
self = [super initWithWindow:window];
|
|
||||||
if (self) {
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidLoad {
|
- (void)windowDidLoad {
|
||||||
@@ -67,6 +60,7 @@ NSString *const kMPIconCell = @"IconCell";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[self.window orderOut:self];
|
[self.window orderOut:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +72,12 @@ NSString *const kMPIconCell = @"IconCell";
|
|||||||
if(_workingDocument != workingDocument) {
|
if(_workingDocument != workingDocument) {
|
||||||
_workingDocument = workingDocument;
|
_workingDocument = workingDocument;
|
||||||
}
|
}
|
||||||
|
if(!_didRegisterForUndoRedo) {
|
||||||
|
NSUndoManager *manager = [_workingDocument undoManager];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeDocument:) name:NSUndoManagerDidRedoChangeNotification object:manager];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeDocument:) name:NSUndoManagerDidUndoChangeNotification object:manager];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeDocument:) name:NSUndoManagerDidCloseUndoGroupNotification object:manager];
|
||||||
|
}
|
||||||
_elements = nil;
|
_elements = nil;
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
}
|
}
|
||||||
@@ -232,5 +232,9 @@ NSString *const kMPIconCell = @"IconCell";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark NSUndoManagerNotifications
|
||||||
|
- (void)_didChangeDocument:(NSNotification *)notification {
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user