Closed Bug 17694 Opened 25 years ago Closed 25 years ago

nsFileSpecWithUIImpl.cpp:ChooseOutputFile starting directory

Categories

(Core :: XUL, enhancement, P3)

x86
Windows NT
enhancement

Tracking

()

VERIFIED FIXED

People

(Reporter: vxir, Assigned: sdagley)

Details

To the owner of this module:
(using Milestone 10:

While solving bug 8330, I am also making it so that whenever
the user saves a file, the directory that the dialog starts in
is the same as the last directory saved to (even when the program
is restarted).  To do that, I need a way to tell ChooseOutputFile
what directory to start in.  An easy way to do this is to start in
the directory specified by the nsIFileSpecWithUI object (if one is
specified).

The following patch will do it:

ChooseOutputFile(...)
  {
  ...

   fileWidget->SetDefaultString(suggestedLeafName);
    SetFileWidgetFilterList(fileWidget, outMask, nsnull, nsnull);

 // ADD THESE 3 LINES
    nsFileSpec spec;
    GetFileSpec(&spec);  // If there is a filespec specified, then start there.
    fileWidget->SetDisplayDirectory(spec);

    nsString winTitle(windowTitle);
    nsFileDlgResults result = fileWidget->PutFile(nsnull, winTitle, spec);

If this looks good, could you apply it to the tree, since I do not have
access.

Thanks,
Andrew
Assignee: trudelle → sdagley
Thanks again!  reassigning to sdagley for consideration.  Steve, if Andrew is
contributing good code, we should also consider giving him tree access.
Status: NEW → ASSIGNED
Looks like a good change to me (with the slight addition of some error checking
as shown below) and I'll see about landing it for the next milestone.  For
getting Andrew tree access I'll have to check and see who in mozilla.org grants
checkin permission (there's some paperwork involved I'm sure).

// If there is a filespec specified, then start there.
if (GetFileSpec(&spec) != NS_ERROR_NOT_INITIALIZED)
    fileWidget->SetDisplayDirectory(spec);
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Code checked in.  Test case should probably be derived from 8330 since that's the
bug that spawned this one.
Status: RESOLVED → VERIFIED
VERIFIED with 19991115 builds
You need to log in before you can comment on or make changes to this bug.