Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chrisbdaemon

macrumors newbie
Original poster
Jun 20, 2008
2
0
Hey, I working on a core data app for managing passwords and I have a custom atomic store to handle the file encryption and decryption transparently, however my problem is that the user needs to be able to supply a password that is used to decrypt the store file when the application starts up and it seems that the persistent store gets loaded and processed before I have a chance to do that to do panel/sheet.

I'm using bindings so I'm guessing that might be a factor in it with the persistent store coordinator being loaded automatically from the .xib file but I don't want to throw away bindings entirely just to do this.

Anyone have any ideas how this can be done?
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
Hey, I working on a core data app for managing passwords and I have a custom atomic store to handle the file encryption and decryption transparently, however my problem is that the user needs to be able to supply a password that is used to decrypt the store file when the application starts up and it seems that the persistent store gets loaded and processed before I have a chance to do that to do panel/sheet.

I'm using bindings so I'm guessing that might be a factor in it with the persistent store coordinator being loaded automatically from the .xib file but I don't want to throw away bindings entirely just to do this.

Anyone have any ideas how this can be done?

Try this:

Override in your NSDocument class this function
Code:
- (void)makeWindowControllers {
	//custom subclass of windowcontroller
	MyWindowController *winControl = [[MyWindowController alloc] init];
	[self addWindowController:winControl];//retain count +1
	[winControl release];
}

This functions allows you to use your own NSWindowController, or in your case maybe use the standard windowscontroller.
Instead of loading the window immediately, like I do, you could first do other stuff, such as present a panel that asks for a pasword.

You can use bindings as well in this panel, but I am afraid you will have to play around with coredata functions to provide an NSManagedobject to the panel (or any of your NSWindowcontroller subclasses) and the like. Most of the bindings are still there, though, after some adjustments.

Code:
- (void)makeWindowControllers {

//do what you have to do before loading the .xib file

//custom subclass of windowcontroller
	MyWindowController *winControl = [[MyWindowController alloc] init];
	[self addWindowController:winControl];//retain count +1
	[winControl release];
}
 

chrisbdaemon

macrumors newbie
Original poster
Jun 20, 2008
2
0
That sounds like it works but the only problem is, its not a document based application and I wasn't able to find anything similar in NSApplication (that and I don't know where else to look for it, lol)
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
That sounds like it works but the only problem is, its not a document based application and I wasn't able to find anything similar in NSApplication (that and I don't know where else to look for it, lol)

I just came across this. Maybe it's helpful for you?

In some situations, it is worthwhile to subclass NSDocumentController in non-NSDocument-based applications to get some of its features. For example, the NSDocumentController management of the Open Recent menu is useful in applications that don’t use subclasses of NSDocument.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.