Commit 08e70861 authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Change the current directory as the user browses the directory tree.

parent 2a53800d
......@@ -26,7 +26,7 @@
*
* FIXME: flags not implemented: OFN_CREATEPROMPT, OFN_DONTADDTORECENT,
* OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_EXTENSIONDIFFERENT,
* OFN_NOCHANGEDIR, OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NOTESTFILECREATE, OFN_OVERWRITEPROMPT, OFN_USEMONIKERS
*
* FIXME: lCustData for lpfnHook (WM_INITDIALOG)
......@@ -58,7 +58,7 @@ DEFAULT_DEBUG_CHANNEL(commdlg);
#define UNIMPLEMENTED_FLAGS \
(OFN_CREATEPROMPT | OFN_DONTADDTORECENT |\
OFN_ENABLEINCLUDENOTIFY | OFN_ENABLESIZING | OFN_EXTENSIONDIFFERENT |\
OFN_NOCHANGEDIR | OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE | OFN_OVERWRITEPROMPT /*| OFN_USEMONIKERS*/)
#define IsHooked(fodInfos) \
......@@ -274,6 +274,7 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
FileOpenDlgInfos *fodInfos;
HINSTANCE hInstance;
LPCSTR lpstrInitialDir = (LPCSTR)-1;
LPSTR lpstrSavDir = NULL;
DWORD dwFlags = 0;
/* Initialise FileOpenDlgInfos structure*/
......@@ -287,6 +288,13 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
hInstance = ofn->hInstance;
fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
/* save current directory */
if (ofn->Flags & OFN_NOCHANGEDIR)
{
lpstrSavDir = MemAlloc(MAX_PATH);
GetCurrentDirectoryA(MAX_PATH, lpstrSavDir);
}
dwFlags = ofn->Flags;
ofn->Flags = ofn->Flags|OFN_WINE;
......@@ -307,6 +315,12 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
ret = 0;
}
if (lpstrSavDir)
{
SetCurrentDirectoryA(lpstrSavDir);
MemFree(lpstrSavDir);
}
if (lpstrInitialDir != (LPCSTR)-1)
{
MemFree((LPVOID)(ofn->lpstrInitialDir));
......
......@@ -71,6 +71,14 @@ extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
* Helper functions
*/
static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos)
{
char lpstrPath[MAX_PATH];
COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath);
SetCurrentDirectoryA(lpstrPath);
TRACE("new current folder %s\n", lpstrPath);
}
/* copied from shell32 to avoid linking to it */
static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
{
......@@ -364,6 +372,8 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
COMDLG32_UpdateCurrentDir(fodInfos);
/* Create the window */
TRACE("create view window\n");
if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment