mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 15:12:21 +00:00
Cleaned up old KdbEntry and KdbGroup categories
Fixed dealloc bug in MPDocumentWindowController Introduced undo category for entries and groups
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
//
|
||||
// Kdb4Entry+Copying.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 18.03.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KdbLib.h"
|
||||
#import "Kdb4Node.h"
|
||||
|
||||
@interface Kdb4Entry (Copying)
|
||||
|
||||
@end
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// Kdb4Entry+Copying.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 18.03.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Kdb4Entry+Copying.h"
|
||||
#import "KdbEntry+Copying.h"
|
||||
|
||||
@implementation Kdb4Entry (Copying)
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
Kdb4Entry *entry = [[Kdb4Entry allocWithZone:zone] init];
|
||||
entry.uuid = [[self.uuid copy] autorelease];
|
||||
entry.titleStringField = [[self.titleStringField copy] autorelease];
|
||||
entry.usernameStringField = [[self.usernameStringField copy] autorelease];
|
||||
entry.passwordStringField = [[self.passwordStringField copy] autorelease];
|
||||
entry.urlStringField = [[self.urlStringField copy] autorelease];
|
||||
entry.notesStringField = [[self.notesStringField copy] autorelease];
|
||||
entry.customIconUuid = self.customIconUuid;
|
||||
entry.foregroundColor = self.foregroundColor;
|
||||
entry.backgroundColor = self.backgroundColor;
|
||||
entry.overrideUrl = self.overrideUrl;
|
||||
entry.tags = self.tags;
|
||||
entry.locationChanged = self.locationChanged;
|
||||
//entry.stringFields = self.stringFields;
|
||||
//entry.binaries = self.binaries;
|
||||
entry.autoType = self.autoType;
|
||||
//entry.history = self.history;
|
||||
return entry;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// KdbEntry+Copying.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 18.03.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Kdb.h"
|
||||
|
||||
@interface KdbEntry (Copying) <NSCopying>
|
||||
|
||||
@end
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// KdbEntry+Copying.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 18.03.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KdbEntry+Copying.h"
|
||||
|
||||
@implementation KdbEntry (Copying)
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
25
MacPass/KdbEntry+Undo.h
Normal file
25
MacPass/KdbEntry+Undo.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// KdbEntry+Undo.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 12.05.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Kdb.h"
|
||||
|
||||
@interface KdbEntry (Undo)
|
||||
|
||||
- (NSString *)titleUndoable;
|
||||
- (NSString *)usernameUndoable;
|
||||
- (NSString *)passwordUndoable;
|
||||
- (NSString *)urlUndoable;
|
||||
- (NSString *)notesUndoable;
|
||||
|
||||
- (void)setTitleUndoable:(NSString *)title;
|
||||
- (void)setUsernameUndoable:(NSString *)username;
|
||||
- (void)setPasswordUndoable:(NSString *)password;
|
||||
- (void)setUrlUndoable:(NSString *)url;
|
||||
- (void)setNotesUndoable:(NSString *)notes;
|
||||
|
||||
@end
|
||||
68
MacPass/KdbEntry+Undo.m
Normal file
68
MacPass/KdbEntry+Undo.m
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// KdbEntry+Undo.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 12.05.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KdbEntry+Undo.h"
|
||||
|
||||
@implementation KdbEntry (Undo)
|
||||
|
||||
- (NSString *)titleUndoable {
|
||||
return [self title];
|
||||
}
|
||||
|
||||
- (NSString *)usernameUndoable {
|
||||
return [self username];
|
||||
}
|
||||
|
||||
- (NSString *)passwordUndoable {
|
||||
return [self password];
|
||||
}
|
||||
|
||||
- (NSString *)urlUndoable {
|
||||
return [self url];
|
||||
}
|
||||
|
||||
- (NSString *)notesUndoable {
|
||||
return [self notes];
|
||||
}
|
||||
|
||||
|
||||
- (void)setTitleUndoable:(NSString *)title {
|
||||
NSDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[[document undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.title];
|
||||
[[document undoManager] setActionName:NSLocalizedString(@"UNDO_SET_TITLE", "Undo set title")];
|
||||
[self setTitle:title];
|
||||
}
|
||||
|
||||
- (void)setUsernameUndoable:(NSString *)username {
|
||||
NSDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[[document undoManager] registerUndoWithTarget:self selector:@selector(setUsernameUndoable:) object:self.username];
|
||||
[[document undoManager] setActionName:NSLocalizedString(@"UNDO_SET_USERNAME", "Undo set username")];
|
||||
[self setUsername:username];
|
||||
}
|
||||
|
||||
- (void)setPasswordUndoable:(NSString *)password {
|
||||
NSDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[[document undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.password];
|
||||
[[document undoManager] setActionName:NSLocalizedString(@"UNDO_SET_PASSWORT", "Undo set password")];
|
||||
[self setPassword:password];
|
||||
}
|
||||
|
||||
- (void)setUrlUndoable:(NSString *)url {
|
||||
NSDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[[document undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.url];
|
||||
[[document undoManager] setActionName:NSLocalizedString(@"UNDO_SET_URL", "Undo set URL")];
|
||||
[self setUrl:url];
|
||||
}
|
||||
|
||||
- (void)setNotesUndoable:(NSString *)notes {
|
||||
NSDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[[document undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.notes];
|
||||
[[document undoManager] setActionName:NSLocalizedString(@"UNDO_SET_NOTES", "Undo set notes")];
|
||||
[self setNotes:notes];
|
||||
}
|
||||
@end
|
||||
@@ -33,8 +33,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
- (id)initWithVersion:(MPDatabaseVersion)version;
|
||||
- (BOOL)decryptWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL;
|
||||
|
||||
|
||||
|
||||
- (KdbGroup *)createGroup:(KdbGroup *)parent;
|
||||
- (KdbEntry *)createEntry:(KdbGroup *)parent;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
||||
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(deleteGroup:) object:newGroup];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"ADD_GROUP_UNDO", @"Create Group Undo")];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_GROUP", @"Create Group Undo")];
|
||||
[parent addGroup:newGroup];
|
||||
NSDictionary *userInfo = @{ MPDocumentGroupKey:newGroup };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddGroupNotification object:self userInfo:userInfo];
|
||||
@@ -176,7 +176,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
- (void)deleteGroup:(KdbGroup *)group {
|
||||
if(group.parent) {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(addGroup:) object:@[group.parent, group]];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"DELETE_GROUP_UNDO", @"Create Group Undo")];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_GROUP", @"Create Group Undo")];
|
||||
[group.parent removeGroup:group];
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey:group };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidDelteGroupNotification object:self userInfo:userInfo];
|
||||
@@ -185,4 +185,5 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[_welcomeView release];
|
||||
[_welcomeText release];
|
||||
[_toolbar release];
|
||||
|
||||
[_passwordInputController release];
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#import "MPPopupImageView.h"
|
||||
#import "MPIconSelectViewController.h"
|
||||
#import "KdbLib.h"
|
||||
#import "KdbEntry+Undo.h"
|
||||
|
||||
@interface MPInspectorTabViewController ()
|
||||
|
||||
@@ -52,8 +53,6 @@
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[_selectedGroup release];
|
||||
[_selectedEntry release];
|
||||
[_iconPopup release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -99,7 +98,8 @@
|
||||
[self.itemNameTextfield setStringValue:self.selectedEntry.title];
|
||||
[self.itemImageView setImage:[MPIconHelper icon:(MPIconType)self.selectedEntry.image ]];
|
||||
[self.passwordTextField setStringValue:self.selectedEntry.password];
|
||||
[self.usernameTextField setStringValue:self.selectedEntry.username];
|
||||
[self.usernameTextField bind:NSValueBinding toObject:self.selectedEntry withKeyPath:@"usernameUndoable" options:nil];
|
||||
//[self.usernameTextField setStringValue:self.selectedEntry.username];
|
||||
[self.titleOrNameLabel setStringValue:NSLocalizedString(@"TITLE",@"")];
|
||||
[self.titleTextField setStringValue:self.selectedEntry.title];
|
||||
[self.URLTextField setStringValue:self.selectedEntry.url];
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>69B</string>
|
||||
<string>6AA</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user