nsFileSpecWithUIImpl.cpp:ChooseOutputFile starting directory

VERIFIED FIXED

Status

()

Core
XUL
P3
enhancement
VERIFIED FIXED
19 years ago
18 years ago

People

(Reporter: Andrew Stone, Assigned: Steve Dagley)

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

19 years ago
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

Updated

19 years ago
Assignee: trudelle → sdagley

Comment 1

19 years ago
Thanks again!  reassigning to sdagley for consideration.  Steve, if Andrew is
contributing good code, we should also consider giving him tree access.
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 2

19 years ago
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);
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
(Assignee)

Comment 3

19 years ago
Code checked in.  Test case should probably be derived from 8330 since that's the
bug that spawned this one.

Updated

18 years ago
Status: RESOLVED → VERIFIED

Comment 4

18 years ago
VERIFIED with 19991115 builds
You need to log in before you can comment on or make changes to this bug.