Hello,

when I close my document window without terminating the application, -canCloseDocumentWithDelegate::: is called, independent of whether the document is dirty.

When I quit the application, -canCloseDocumentWithDelegate::: is only called if the document reports it is dirty. If it is not dirty, AppKit takes a shortcut calls into -close directly. NSDocumentController doesn't seem to be involved either.

Why do I need this?

My document is stored in a package that contains a preferences file. When the document is saved, the preferences file is saved as part of the package. So, if it is dirty at the time of closing it's going to be saved. If the document isn't dirty, I'd like to update the preference file only.

A good place would have been -canCloseDocumentWithDelegate::: because I can check whether the document is dirty and save the preferences file if necessary. That doesn't work if it's not getting called of course. -close is called after the document is saved, so the dirty flag there isn't helpful.

Are there better options to do a last-minute save? I do not want to change the design, meaning I don't want preferences to contribute to the change count state or even worse be undoable. Plus I do want the preferences to be stored in the package, not someplace else (restoration state for example).

Thanks for any pointers!

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to