Create initial folder structure
This commit is contained in:
parent
0916b50bf4
commit
328b497040
|
@ -33,16 +33,6 @@
|
|||
#pragma mark -
|
||||
#pragma mark MADocument
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Add your subclass-specific initialization here.
|
||||
// If an error occurs here, send a [self release] message and return nil.
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
This is the name of the Core Data store file contained within the document package.
|
||||
You can change this whatever you want -- the user will not see this file.
|
||||
|
@ -51,6 +41,29 @@ static NSString *StoreFileName = @"MediannoDB.sql";
|
|||
|
||||
@implementation MADocument
|
||||
|
||||
- (id)initWithType:(NSString *)typeName error:(NSError **)outError
|
||||
{
|
||||
self = [super initWithType:typeName error:outError];
|
||||
if (self) {
|
||||
/*
|
||||
* Start with a root folder and an inbox folder
|
||||
*/
|
||||
NSManagedObjectContext *moc = [self managedObjectContext];
|
||||
[[moc undoManager] disableUndoRegistration];
|
||||
MAFolder * rootFolder = [NSEntityDescription insertNewObjectForEntityForName:@"MAFolder"
|
||||
inManagedObjectContext:moc];
|
||||
[rootFolder setName:@""];
|
||||
MAFolder * inboxFolder = [NSEntityDescription insertNewObjectForEntityForName:@"MAFolder"
|
||||
inManagedObjectContext:moc];
|
||||
[inboxFolder setName:@"Inbox"];
|
||||
[inboxFolder setParent:rootFolder];
|
||||
|
||||
[moc processPendingChanges];
|
||||
[[moc undoManager] enableUndoRegistration];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)windowNibName
|
||||
{
|
||||
// Override returning the nib file name of the document
|
||||
|
|
Loading…
Reference in New Issue
Block a user