mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 14:02:28 +00:00
Refacoted window and view controller to use windowNibName and nibName. Fixes #164
This commit is contained in:
@@ -44,12 +44,13 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
|
|||||||
|
|
||||||
@implementation MPContextBarViewController
|
@implementation MPContextBarViewController
|
||||||
|
|
||||||
#pragma mark Livecycle
|
#pragma mark Nib handling
|
||||||
- (instancetype)init {
|
- (NSString *)nibName {
|
||||||
self = [self initWithNibName:@"ContextBar" bundle:nil];
|
return @"ContextBar";
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark Livecycle
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,17 @@
|
|||||||
|
|
||||||
@implementation MPDatabaseSettingsWindowController
|
@implementation MPDatabaseSettingsWindowController
|
||||||
|
|
||||||
|
- (NSString *)windowNibName {
|
||||||
|
return @"DatabaseSettingsWindow";
|
||||||
|
}
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
self = [self initWithDocument:nil];
|
self = [self initWithDocument:nil];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithDocument:(MPDocument *)document {
|
- (id)initWithDocument:(MPDocument *)document {
|
||||||
self = [super initWithWindowNibName:@"DatabaseSettingsWindow"];
|
self = [super initWithWindow:nil];
|
||||||
if(self) {
|
if(self) {
|
||||||
_document = document;
|
_document = document;
|
||||||
_missingFeature = NSLocalizedString(@"KDBX_ONLY_FEATURE", "Feature only available in kdbx databases");
|
_missingFeature = NSLocalizedString(@"KDBX_ONLY_FEATURE", "Feature only available in kdbx databases");
|
||||||
|
|||||||
@@ -27,9 +27,8 @@ typedef NS_ENUM(NSUInteger, MPDatePreset) {
|
|||||||
|
|
||||||
@implementation MPDatePickingViewController
|
@implementation MPDatePickingViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
self = [self initWithNibName:@"DatePickingView" bundle:nil];
|
return @"DatePickingView";
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ APPKIT_EXTERN NSString *const MPDocumentDidLockDatabaseNotification;
|
|||||||
APPKIT_EXTERN NSString *const MPDocumentDidUnlockDatabaseNotification;
|
APPKIT_EXTERN NSString *const MPDocumentDidUnlockDatabaseNotification;
|
||||||
|
|
||||||
FOUNDATION_EXTERN NSString *const MPDocumentCurrentItemChangedNotification;
|
FOUNDATION_EXTERN NSString *const MPDocumentCurrentItemChangedNotification;
|
||||||
FOUNDATION_EXTERN NSString *const MPDocumentItemAddedNotification;
|
FOUNDATION_EXTERN NSString *const MPDocumentDidAddEntryNotification;
|
||||||
|
|
||||||
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
||||||
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ NSString *const MPDocumentDidLockDatabaseNotification = @"com.hicknhack.macp
|
|||||||
NSString *const MPDocumentDidUnlockDatabaseNotification = @"com.hicknhack.macpass.MPDocumentDidUnlockDatabaseNotification";
|
NSString *const MPDocumentDidUnlockDatabaseNotification = @"com.hicknhack.macpass.MPDocumentDidUnlockDatabaseNotification";
|
||||||
|
|
||||||
NSString *const MPDocumentCurrentItemChangedNotification = @"com.hicknhack.macpass.MPDocumentCurrentItemChangedNotification";
|
NSString *const MPDocumentCurrentItemChangedNotification = @"com.hicknhack.macpass.MPDocumentCurrentItemChangedNotification";
|
||||||
NSString *const MPDocumentItemAddedNotification = @"com.hicknhack.macpass.MPDocumentItemAddedNotification";
|
NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification";
|
||||||
|
|
||||||
NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey";
|
NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey";
|
||||||
NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||||
@@ -454,7 +454,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
|||||||
}
|
}
|
||||||
[parent addEntry:newEntry];
|
[parent addEntry:newEntry];
|
||||||
[parent.undoManager setActionName:NSLocalizedString(@"ADD_ENTRY", "")];
|
[parent.undoManager setActionName:NSLocalizedString(@"ADD_ENTRY", "")];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentItemAddedNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddEntryNotification object:self];
|
||||||
return newEntry;
|
return newEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,12 @@ typedef void (^MPPasswordChangedBlock)(void);
|
|||||||
|
|
||||||
@implementation MPDocumentWindowController
|
@implementation MPDocumentWindowController
|
||||||
|
|
||||||
|
- (NSString *)windowNibName {
|
||||||
|
return @"DocumentWindow";
|
||||||
|
}
|
||||||
|
|
||||||
-(id)init {
|
-(id)init {
|
||||||
self = [super initWithWindowNibName:@"DocumentWindow" owner:self];
|
self = [super initWithWindow:nil];
|
||||||
if( self ) {
|
if( self ) {
|
||||||
_firstResponder = nil;
|
_firstResponder = nil;
|
||||||
_toolbarDelegate = [[MPToolbarDelegate alloc] init];
|
_toolbarDelegate = [[MPToolbarDelegate alloc] init];
|
||||||
@@ -85,14 +89,14 @@ typedef void (^MPPasswordChangedBlock)(void);
|
|||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didRevertDocument:) name:MPDocumentDidRevertNotifiation object:document];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didRevertDocument:) name:MPDocumentDidRevertNotifiation object:document];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showEntries) name:MPDocumentDidUnlockDatabaseNotification object:document];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showEntries) name:MPDocumentDidUnlockDatabaseNotification object:document];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddEntry:) name:MPDocumentDidAddEntryNotification object:document];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document];
|
||||||
|
|
||||||
[self.entryViewController regsiterNotificationsForDocument:document];
|
[self.entryViewController regsiterNotificationsForDocument:document];
|
||||||
[self.inspectorViewController regsiterNotificationsForDocument:document];
|
[self.inspectorViewController regsiterNotificationsForDocument:document];
|
||||||
[self.outlineViewController regsiterNotificationsForDocument:document];
|
[self.outlineViewController regsiterNotificationsForDocument:document];
|
||||||
[self.toolbarDelegate registerNotificationsForDocument:document];
|
[self.toolbarDelegate registerNotificationsForDocument:document];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainWindowToolbar"];
|
self.toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainWindowToolbar"];
|
||||||
[self.toolbar setAutosavesConfiguration:YES];
|
[self.toolbar setAutosavesConfiguration:YES];
|
||||||
[self.toolbar setAllowsUserCustomization:YES];
|
[self.toolbar setAllowsUserCustomization:YES];
|
||||||
@@ -169,6 +173,14 @@ typedef void (^MPPasswordChangedBlock)(void);
|
|||||||
[self showPasswordInput];
|
[self showPasswordInput];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)_didAddEntry:(NSNotification *)notification {
|
||||||
|
[self showInspector:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_didAddGroup:(NSNotification *)notification {
|
||||||
|
[self showInspector:self];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark Actions
|
#pragma mark Actions
|
||||||
- (void)saveDocument:(id)sender {
|
- (void)saveDocument:(id)sender {
|
||||||
self.passwordChangedBlock = nil;
|
self.passwordChangedBlock = nil;
|
||||||
@@ -324,7 +336,9 @@ typedef void (^MPPasswordChangedBlock)(void);
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)showInspector:(id)sender {
|
- (void)showInspector:(id)sender {
|
||||||
// TODO;
|
if(![self _isInspectorVisible]) {
|
||||||
|
[self toggleInspector:sender];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)focusEntries:(id)sender {
|
- (void)focusEntries:(id)sender {
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
|||||||
|
|
||||||
@implementation MPEntryInspectorViewController
|
@implementation MPEntryInspectorViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
return [self initWithNibName:@"EntryInspectorView" bundle:nil];
|
return @"EntryInspectorView";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
@@ -123,8 +123,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
|||||||
|
|
||||||
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
|
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(_didAddItem:)
|
selector:@selector(_didAddEntry:)
|
||||||
name:MPDocumentItemAddedNotification
|
name:MPDocumentDidAddEntryNotification
|
||||||
object:document];
|
object:document];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MPDocument Notifications
|
#pragma mark MPDocument Notifications
|
||||||
|
|
||||||
- (void)_didAddItem:(NSNotification *)notification {
|
- (void)_didAddEntry:(NSNotification *)notification {
|
||||||
[self.tabView selectTabViewItemAtIndex:MPEntryTabGeneral];
|
[self.tabView selectTabViewItemAtIndex:MPEntryTabGeneral];
|
||||||
[self.titleTextField becomeFirstResponder];
|
[self.titleTextField becomeFirstResponder];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,9 +93,8 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
|
|
||||||
@implementation MPEntryViewController
|
@implementation MPEntryViewController
|
||||||
|
|
||||||
|
- (NSString *)nibName {
|
||||||
- (id)init {
|
return @"EntryView";
|
||||||
return [[MPEntryViewController alloc] initWithNibName:@"EntryView" bundle:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
@@ -208,7 +207,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(_didAddItem:)
|
selector:@selector(_didAddItem:)
|
||||||
name:MPDocumentItemAddedNotification
|
name:MPDocumentDidAddEntryNotification
|
||||||
object:document];
|
object:document];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
@@ -653,7 +652,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
NSTableColumn *column = [self.entryTable tableColumns][[self.entryTable clickedColumn]];
|
NSTableColumn *column = [self.entryTable tableColumns][[self.entryTable clickedColumn]];
|
||||||
NSString *identifier = [column identifier];
|
NSString *identifier = [column identifier];
|
||||||
if([identifier isEqualToString:MPEntryTableTitleColumnIdentifier]) {
|
if([identifier isEqualToString:MPEntryTableTitleColumnIdentifier]) {
|
||||||
|
[[self windowController] showInspector:nil];
|
||||||
}
|
}
|
||||||
else if([identifier isEqualToString:MPEntryTablePasswordColumnIdentifier]) {
|
else if([identifier isEqualToString:MPEntryTablePasswordColumnIdentifier]) {
|
||||||
[self copyPassword:nil];
|
[self copyPassword:nil];
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
|
|||||||
|
|
||||||
@implementation MPGeneralSettingsController
|
@implementation MPGeneralSettingsController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
return [self initWithNibName:@"GeneralSettings" bundle:[NSBundle mainBundle]];
|
return @"GeneralSettings";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)identifier {
|
- (NSString *)identifier {
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
@implementation MPGroupInspectorViewController
|
@implementation MPGroupInspectorViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
return [self initWithNibName:@"GroupInspectorView" bundle:nil];
|
return @"GroupInspectorView";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
|||||||
@@ -18,9 +18,8 @@ NSInteger const kMPDefaultIcon = -1;
|
|||||||
|
|
||||||
@implementation MPIconSelectViewController
|
@implementation MPIconSelectViewController
|
||||||
|
|
||||||
|
- (NSString *)nibName {
|
||||||
- (id)init {
|
return @"IconSelection";
|
||||||
return [self initWithNibName:@"IconSelection" bundle:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
|
|
||||||
@implementation MPInspectorViewController
|
@implementation MPInspectorViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
return [[MPInspectorViewController alloc] initWithNibName:@"InspectorView" bundle:nil];
|
return @"InspectorView";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
@implementation MPIntegrationSettingsController
|
@implementation MPIntegrationSettingsController
|
||||||
|
|
||||||
|
- (NSString *)nibName {
|
||||||
|
return @"IntegrationSettings";
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)identifier {
|
- (NSString *)identifier {
|
||||||
return @"Integration";
|
return @"Integration";
|
||||||
}
|
}
|
||||||
@@ -30,11 +34,6 @@
|
|||||||
return NSLocalizedString(@"INTEGRATION_SETTINGS", "");
|
return NSLocalizedString(@"INTEGRATION_SETTINGS", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init {
|
|
||||||
self = [super initWithNibName:@"IntegrationSettings" bundle:nil];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||||
NSString *serverKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableHttpServer];
|
NSString *serverKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableHttpServer];
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
|
|
||||||
@implementation MPOutlineViewController
|
@implementation MPOutlineViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
return [[MPOutlineViewController alloc] initWithNibName:@"OutlineView" bundle:nil];
|
return @"OutlineView";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
@@ -78,6 +78,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
[self.outlineView setFloatsGroupRows:NO];
|
[self.outlineView setFloatsGroupRows:NO];
|
||||||
[self.outlineView registerForDraggedTypes:@[ KPKGroupUTI, KPKEntryUTI ]];
|
[self.outlineView registerForDraggedTypes:@[ KPKGroupUTI, KPKEntryUTI ]];
|
||||||
[self.outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
|
[self.outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
|
||||||
|
[self.outlineView setDoubleAction:@selector(_doubleClickedGroup:)];
|
||||||
[self.bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight];
|
[self.bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight];
|
||||||
[self.addGroupButton setAction:[MPActionHelper actionOfType:MPActionAddGroup]];
|
[self.addGroupButton setAction:[MPActionHelper actionOfType:MPActionAddGroup]];
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
|
|
||||||
#pragma mark Notifications
|
#pragma mark Notifications
|
||||||
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
|
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
|
||||||
// Nothing to do anymore
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clearSelection {
|
- (void)clearSelection {
|
||||||
@@ -156,6 +157,11 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
document.selectedItem = document.selectedGroup;
|
document.selectedItem = document.selectedGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# pragma mark MPDocument Notifications
|
||||||
|
- (void)_didAddGroup:(NSNotification *)notification {
|
||||||
|
//TODO: find group to expand!
|
||||||
|
}
|
||||||
|
|
||||||
- (id)itemUnderMouse {
|
- (id)itemUnderMouse {
|
||||||
NSPoint mouseLocation = [[self.outlineView window] mouseLocationOutsideOfEventStream];
|
NSPoint mouseLocation = [[self.outlineView window] mouseLocationOutsideOfEventStream];
|
||||||
NSPoint localPoint = [self.outlineView convertPoint:mouseLocation fromView:[[self.outlineView window] contentView]];
|
NSPoint localPoint = [self.outlineView convertPoint:mouseLocation fromView:[[self.outlineView window] contentView]];
|
||||||
@@ -187,6 +193,10 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
[[[self windowController] document] deleteGroup:[self _clickedOrSelectedGroup]];
|
[[[self windowController] document] deleteGroup:[self _clickedOrSelectedGroup]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)_doubleClickedGroup:(id)sender {
|
||||||
|
[[self windowController] showInspector:sender];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark NSOutlineViewDelegate
|
#pragma mark NSOutlineViewDelegate
|
||||||
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
||||||
NSTableCellView *view;
|
NSTableCellView *view;
|
||||||
|
|||||||
@@ -23,11 +23,15 @@
|
|||||||
static MPOverlayWindowController *sharedInstance;
|
static MPOverlayWindowController *sharedInstance;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
sharedInstance = [[MPOverlayWindowController alloc] initWithWindowNibName:@"OverlayWindow"];
|
sharedInstance = [[MPOverlayWindowController alloc] initWithWindow:nil];
|
||||||
});
|
});
|
||||||
return sharedInstance;
|
return sharedInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)windowNibName {
|
||||||
|
return @"OverlayWindow";
|
||||||
|
}
|
||||||
|
|
||||||
- (id)initWithWindow:(NSWindow *)window {
|
- (id)initWithWindow:(NSWindow *)window {
|
||||||
self = [super initWithWindow:window];
|
self = [super initWithWindow:window];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
|||||||
@@ -62,8 +62,12 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
|
|||||||
|
|
||||||
@implementation MPPasswordCreatorViewController
|
@implementation MPPasswordCreatorViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
self = [super initWithNibName:@"PasswordCreatorView" bundle:nil];
|
return @"PasswordCreatorView";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||||
if (self) {
|
if (self) {
|
||||||
_password = @"";
|
_password = @"";
|
||||||
_passwordLength = [[NSUserDefaults standardUserDefaults] integerForKey:kMPSettingsKeyDefaultPasswordLength];
|
_passwordLength = [[NSUserDefaults standardUserDefaults] integerForKey:kMPSettingsKeyDefaultPasswordLength];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithDocument:(MPDocument *)document {
|
- (id)initWithDocument:(MPDocument *)document {
|
||||||
self = [super init];
|
self = [super initWithWindow:nil];
|
||||||
if(self){
|
if(self){
|
||||||
_allowsEmptyPasswordOrKey = YES;
|
_allowsEmptyPasswordOrKey = YES;
|
||||||
_showPassword = NO;
|
_showPassword = NO;
|
||||||
|
|||||||
@@ -34,9 +34,8 @@
|
|||||||
|
|
||||||
@implementation MPPasswordInputController
|
@implementation MPPasswordInputController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
self = [self initWithNibName:@"PasswordInputView" bundle:nil];
|
return @"PasswordInputView";
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
@implementation MPPreviewViewController
|
@implementation MPPreviewViewController
|
||||||
|
|
||||||
- (instancetype)init {
|
- (NSString *)nibName {
|
||||||
self = [self initWithNibName:@"PreviewView" bundle:nil];
|
return @"PreviewView";
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
|
|
||||||
@implementation MPSavePanelAccessoryViewController
|
@implementation MPSavePanelAccessoryViewController
|
||||||
|
|
||||||
- (id)init {
|
- (NSString *)nibName {
|
||||||
self = [super initWithNibName:@"SavePanelAccessoryView" bundle:nil];
|
return @"SavePanelAccessoryView";
|
||||||
if(self) {
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didLoadView {
|
- (void)didLoadView {
|
||||||
|
|||||||
@@ -25,8 +25,12 @@
|
|||||||
|
|
||||||
@implementation MPSettingsWindowController
|
@implementation MPSettingsWindowController
|
||||||
|
|
||||||
|
- (NSString *)windowNibName {
|
||||||
|
return @"SettingsWindow";
|
||||||
|
}
|
||||||
|
|
||||||
-(id)init {
|
-(id)init {
|
||||||
self = [super initWithWindowNibName:@"SettingsWindow"];
|
self = [super initWithWindow:nil];
|
||||||
if(self) {
|
if(self) {
|
||||||
_toolbar = [[NSToolbar alloc] initWithIdentifier:@"SettingsToolBar"];
|
_toolbar = [[NSToolbar alloc] initWithIdentifier:@"SettingsToolBar"];
|
||||||
[self.toolbar setAllowsUserCustomization:NO];
|
[self.toolbar setAllowsUserCustomization:NO];
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
@implementation MPUpdateSettingsController
|
@implementation MPUpdateSettingsController
|
||||||
|
|
||||||
- (instancetype)init {
|
- (NSString *)nibName {
|
||||||
self = [super initWithNibName:@"UpdateSettings" bundle:nil];
|
return @"UpdateSettings";
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)identifier {
|
- (NSString *)identifier {
|
||||||
|
|||||||
@@ -16,10 +16,8 @@
|
|||||||
|
|
||||||
@implementation MPWorkflowSettingsController
|
@implementation MPWorkflowSettingsController
|
||||||
|
|
||||||
#pragma mark LifeCycle
|
- (NSString *)nibName {
|
||||||
- (id)init {
|
return @"WorkflowSettings";
|
||||||
self = [self initWithNibName:@"WorkflowSettings" bundle:nil];
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didLoadView {
|
- (void)didLoadView {
|
||||||
|
|||||||
Reference in New Issue
Block a user