Setting initial filename for Save As
Setting initial filename for Save As
- Subject: Setting initial filename for Save As
- From: Derrick Bass <email@hidden>
- Date: Mon, 12 Dec 2005 04:11:42 -0600
I would like set an initial filename in my Save As dialog that is
different from the default. (It does some pretty destructive editing.
I've disabled Save... so you can't trivially overwrite the source
file, but in the Save As… dialog the default name comes up as the
name of the file that was opened, so it is still too easy to save
over your old file.)
I want to create a new filename from the old name (say Movie.mov ->
Movie-modded.mov) and present that as the default name to save under.
But I'm not quite sure how to go about it. I haven't noticed any
simple way to do it.
I see that NSDocument has a prepareSavePanel: method, but there seems
to be no way to set a save panel's filename. That seems to occur only
in –
beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:
contextInfo:. Setting a breakpoint on that, I see that it gets called
from
runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:
but I'm not sure how to properly override that method. (When I tried,
my save panel wouldn't do anything; I discovered that didSaveSelector
and delegate are set to nil when the method is called.)
For the moment I am doing a setFileName to the new name in the -
[readFromFile: ofType:] method, but that has the unfortunate side
effects that files don't get added to the "Open Recent" menu and the
title of the document gets changed also.
On a related note, by appending something to filename, I might make
it too long to be valid. How can I prevent that?
Derrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden