• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument annoying warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument annoying warning


  • Subject: Re: NSDocument annoying warning
  • From: Randall Meadows <email@hidden>
  • Date: Mon, 17 Nov 2008 22:12:06 -0700

On Nov 14, 2008, at 4:52 PM, Quincey Morris wrote:
On Nov 14, 2008, at 15:21, Randall Meadows wrote:
Is there something I can do to tell NSDocument (or whomever) that these changes that it thinks are made by another application are on purpose, and that it needs to keep its opinions regarding them to itself? If <whatever> ends up marking the file as "dirty", that's fine by me. I'll go continue scouring the docs, but if someone has a pointer, I'd appreciate it.

For changing the extension, you could try -[NSDocument setFileURL:] after you change the extension (both to and from the temporary one). You might also have to override -[NSDocument displayName] if you don't want to show the temporary extension in the window title, but that's purely cosmetic.

So, to "lock" the document, I get the current name, change the extension, use NSFileManager to move the file from the "unlocked" name to the "locked" name, call -setFileType: to the locked type, and call - setFileURL: with the new, locked pathname converted to an NSURL. When I then save the document, I get the following:


"This document has been renamed to "newname"
It will be saved under this new name, or you can provide another name.
[Save As]    [Cancel] [Save]"

The code used to use -setFileName: instead, but that's deprecated in 10.5 (as of 10.4 actually).

Shirley there must be some way to tell the system "yes, I'm changing this file name, yes, the user is already aware of it and would appreciate you not annoying the living snot out of him by informing him of this useless detail."


Calling -setFileModificationDate: had a similar affect on my other issue (that is, nothing) but I used the other suggestion and moved the actually modification of the bundle contents to the save function, and that took care of that problem.
_______________________________________________


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


  • Follow-Ups:
    • Re: NSDocument annoying warning
      • From: Quincey Morris <email@hidden>
References: 
 >NSDocument annoying warning (From: Randall Meadows <email@hidden>)
 >Re: NSDocument annoying warning (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Next by Date: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Previous by thread: Re: NSDocument annoying warning
  • Next by thread: Re: NSDocument annoying warning
  • Index(es):
    • Date
    • Thread