Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
- Subject: Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
- From: Kyle Sluder <email@hidden>
- Date: Mon, 23 Jul 2012 09:22:13 -0700
On Jul 23, 2012, at 8:12 AM, Markus Spoettl <email@hidden> wrote:
> 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).
I don't have my crazy autosave flowchart handy, but I *think* you should be able to simply override -hasUnautosavedChanges to return YES if either super returns YES or if your preferences file needs to be saved. -autosaveWithImplicitCancellability:: is documented to check -hasUnautosavedChanges, so I would assume that it is called unconditionally at all places where AppKit wants to ensure the document is written to disk if necessary.
Of course, this assumes you are returning YES from +autosavesInPlace.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden