The following is my implementation of the reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo: method of NSDocumentController:
I want to close and save each document manually, preferably without ever calling the super. However, if I neglect to call the super the application never terminates and I suspect other housekeeping is not take care of.
When each unsaved window containing unsaved document(s) is closed, I put up an alert listing those documents by calling NSAlert's beginSheetModalForWindow:modalDelegate: method. This lets the method return while the sheet is still open.
I need some way to wait until the alert for each window has completed (and calls alertDidEnd:returnCode:contextInfo so that I can call the super from the reviewUnsavedDocumentsWithAlertTitle:... method. I would use callback like NSAlert but then I am no longer able to call the aforementioned super.
Thanks for any input.
Code:
- (void)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title cancellable:(BOOL)cancellable delegate:(id)delegate didReviewAllSelector:(SEL)didReviewAllSelector contextInfo:(void *)contextInfo
{
// close each window with unsaved document(s) here
// this is called immediately before each window can close & save its documents
[super reviewUnsavedDocumentsWithAlertTitle:title cancellable:cancellable delegate:delegate didReviewAllSelector:didReviewAllSelector contextInfo:contextInfo];
}
I want to close and save each document manually, preferably without ever calling the super. However, if I neglect to call the super the application never terminates and I suspect other housekeeping is not take care of.
When each unsaved window containing unsaved document(s) is closed, I put up an alert listing those documents by calling NSAlert's beginSheetModalForWindow:modalDelegate: method. This lets the method return while the sheet is still open.
I need some way to wait until the alert for each window has completed (and calls alertDidEnd:returnCode:contextInfo so that I can call the super from the reviewUnsavedDocumentsWithAlertTitle:... method. I would use callback like NSAlert but then I am no longer able to call the aforementioned super.
Thanks for any input.