mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 08:12:28 +00:00
Changed initial empty database layout to conform to KeePass standards
This commit is contained in:
15
MacPass/Kdb3Tree+NewTree.h
Normal file
15
MacPass/Kdb3Tree+NewTree.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Kdb3Tree+NewTree.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 21.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Kdb3Node.h"
|
||||||
|
|
||||||
|
@interface Kdb3Tree (NewTree)
|
||||||
|
|
||||||
|
+ (Kdb3Tree *)newTemplateTree;
|
||||||
|
|
||||||
|
@end
|
||||||
55
MacPass/Kdb3Tree+NewTree.m
Normal file
55
MacPass/Kdb3Tree+NewTree.m
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
//
|
||||||
|
// Kdb3Tree+NewTree.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 21.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Kdb3Tree+NewTree.h"
|
||||||
|
|
||||||
|
@implementation Kdb3Tree (NewTree)
|
||||||
|
|
||||||
|
+ (Kdb3Tree *)newTemplateTree {
|
||||||
|
Kdb3Tree *tree = [[Kdb3Tree alloc] init];
|
||||||
|
|
||||||
|
Kdb3Group *rootGroup = [[Kdb3Group alloc] init];
|
||||||
|
rootGroup.name = @"%ROOT%";
|
||||||
|
tree.root = rootGroup;
|
||||||
|
|
||||||
|
KdbGroup *parentGroup = [tree createGroup:rootGroup];
|
||||||
|
parentGroup.name = @"General";
|
||||||
|
parentGroup.image = 48;
|
||||||
|
[rootGroup addGroup:parentGroup];
|
||||||
|
|
||||||
|
KdbGroup *group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Windows";
|
||||||
|
group.image = 38;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Network";
|
||||||
|
group.image = 3;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Internet";
|
||||||
|
group.image = 1;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"eMail";
|
||||||
|
group.image = 19;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Homebanking";
|
||||||
|
group.image = 37;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
[rootGroup release];
|
||||||
|
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
15
MacPass/Kdb4Tree+NewTree.h
Normal file
15
MacPass/Kdb4Tree+NewTree.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Kdb4Tree+NewTree.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 21.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Kdb4Node.h"
|
||||||
|
|
||||||
|
@interface Kdb4Tree (NewTree)
|
||||||
|
|
||||||
|
+(Kdb4Tree *)newTemplateTree;
|
||||||
|
|
||||||
|
@end
|
||||||
77
MacPass/Kdb4Tree+NewTree.m
Normal file
77
MacPass/Kdb4Tree+NewTree.m
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
//
|
||||||
|
// Kdb4Tree+NewTree.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 21.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Kdb4Tree+NewTree.h"
|
||||||
|
|
||||||
|
@implementation Kdb4Tree (NewTree)
|
||||||
|
|
||||||
|
+ (Kdb4Tree *)newTemplateTree {
|
||||||
|
NSDate *currentTime = [NSDate date];
|
||||||
|
|
||||||
|
Kdb4Tree *tree = [[Kdb4Tree alloc] init];
|
||||||
|
tree.generator = @"MiniKeePass";
|
||||||
|
tree.databaseName = @"";
|
||||||
|
tree.databaseNameChanged = currentTime;
|
||||||
|
tree.databaseDescription = @"";
|
||||||
|
tree.databaseDescriptionChanged = currentTime;
|
||||||
|
tree.defaultUserName = @"";
|
||||||
|
tree.defaultUserNameChanged = currentTime;
|
||||||
|
tree.maintenanceHistoryDays = 365;
|
||||||
|
tree.color = @"";
|
||||||
|
tree.masterKeyChanged = currentTime;
|
||||||
|
tree.masterKeyChangeRec = -1;
|
||||||
|
tree.masterKeyChangeForce = -1;
|
||||||
|
tree.protectTitle = NO;
|
||||||
|
tree.protectUserName = NO;
|
||||||
|
tree.protectPassword = YES;
|
||||||
|
tree.protectUrl = NO;
|
||||||
|
tree.protectNotes = NO;
|
||||||
|
tree.recycleBinEnabled = YES;
|
||||||
|
tree.recycleBinUuid = [UUID nullUuid];
|
||||||
|
tree.recycleBinChanged = currentTime;
|
||||||
|
tree.entryTemplatesGroup = [UUID nullUuid];
|
||||||
|
tree.entryTemplatesGroupChanged = currentTime;
|
||||||
|
tree.historyMaxItems = 10;
|
||||||
|
tree.historyMaxSize = 6 * 1024 * 1024; // 6 MB
|
||||||
|
tree.lastSelectedGroup = [UUID nullUuid];
|
||||||
|
tree.lastTopVisibleGroup = [UUID nullUuid];
|
||||||
|
|
||||||
|
KdbGroup *parentGroup = [tree createGroup:nil];
|
||||||
|
parentGroup.name = @"General";
|
||||||
|
parentGroup.image = 48;
|
||||||
|
tree.root = parentGroup;
|
||||||
|
|
||||||
|
KdbGroup *group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Windows";
|
||||||
|
group.image = 38;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Network";
|
||||||
|
group.image = 3;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Internet";
|
||||||
|
group.image = 1;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"eMail";
|
||||||
|
group.image = 19;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
group = [tree createGroup:parentGroup];
|
||||||
|
group.name = @"Homebanking";
|
||||||
|
group.image = 37;
|
||||||
|
[parentGroup addGroup:group];
|
||||||
|
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
#import "KdbGroup+KVOAdditions.h"
|
#import "KdbGroup+KVOAdditions.h"
|
||||||
#import "KdbGroup+MPTreeTools.h"
|
#import "KdbGroup+MPTreeTools.h"
|
||||||
#import "KdbEntry+Undo.h"
|
#import "KdbEntry+Undo.h"
|
||||||
|
#import "Kdb3Tree+NewTree.h"
|
||||||
|
#import "Kdb4Tree+NewTree.h"
|
||||||
|
|
||||||
NSString *const MPDocumentDidAddGroupNotification = @"MPDocumentDidAddGroupNotification";
|
NSString *const MPDocumentDidAddGroupNotification = @"MPDocumentDidAddGroupNotification";
|
||||||
NSString *const MPDocumentWillDelteGroupNotification = @"MPDocumentDidDelteGroupNotification";
|
NSString *const MPDocumentWillDelteGroupNotification = @"MPDocumentDidDelteGroupNotification";
|
||||||
@@ -52,18 +54,15 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
_isProtected = NO;
|
_isProtected = NO;
|
||||||
switch(version) {
|
switch(version) {
|
||||||
case MPDatabaseVersion3:
|
case MPDatabaseVersion3:
|
||||||
self.tree = [[[Kdb3Tree alloc] init] autorelease];
|
_tree = [Kdb3Tree newTemplateTree];
|
||||||
break;
|
break;
|
||||||
case MPDatabaseVersion4:
|
case MPDatabaseVersion4:
|
||||||
self.tree = [[[Kdb4Tree alloc] init] autorelease];
|
_tree = [Kdb4Tree newTemplateTree];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
[self release];
|
[self release];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
KdbGroup *newGroup = [self.tree createGroup:self.tree.root];
|
|
||||||
newGroup.name = @"Default";
|
|
||||||
self.tree.root = newGroup;
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user