Added category for easy item copying with respect to UUID uniqueness

This commit is contained in:
michael starke
2013-12-01 23:09:45 +01:00
parent 2bc5e8a337
commit d16ebfc4d7
5 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
//
// KPKEntry+TemplateCopy.h
// MacPass
//
// Created by Michael Starke on 01/12/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKEntry.h"
@interface KPKEntry (TemplateCopy)
- (instancetype)copyWithTitle:(NSString *)title;
@end

View File

@@ -0,0 +1,22 @@
//
// KPKEntry+TemplateCopy.m
// MacPass
//
// Created by Michael Starke on 01/12/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKEntry+TemplateCopy.h"
#import "KPKTimeInfo.h"
@implementation KPKEntry (TemplateCopy)
- (instancetype)copyWithTitle:(NSString *)title {
KPKEntry *copy = [self copy];
copy.uuid = [[NSUUID alloc] init];
copy.timeInfo.creationTime = [NSDate date];
copy.title = title;
return copy;
}
@end

View File

@@ -0,0 +1,15 @@
//
// KPKGroup+TemplateCopy.h
// MacPass
//
// Created by Michael Starke on 01/12/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKGroup.h"
@interface KPKGroup (TemplateCopy)
- (instancetype)copyWithName:(NSString *)name;
@end

View File

@@ -0,0 +1,22 @@
//
// KPKGroup+TemplateCopy.m
// MacPass
//
// Created by Michael Starke on 01/12/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKGroup+TemplateCopy.h"
#import "KPKTimeInfo.h"
@implementation KPKGroup (TemplateCopy)
- (instancetype)copyWithName:(NSString *)name {
KPKGroup *copy = [self copy];
copy.uuid = [[NSUUID alloc] init];
copy.timeInfo.creationTime = [NSDate date];
copy.name = name;
return copy;
}
@end