Windows XP: Fix directory chooser dialog.

Set initial directory and title correctly in native file dialog.

Task-number: QTBUG-31098

Change-Id: I87c4383bdf0b26beda6a075a186d0a951c86f8a7
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2013-06-26 12:21:49 +02:00 committed by The Qt Project
parent a98b60edfc
commit fb2a25e756

View File

@ -1720,7 +1720,9 @@ int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM
{
switch (uMsg) {
case BFFM_INITIALIZED: {
const QString initialFile = m_data.selectedFile();
if (!m_title.isEmpty())
SetWindowText(hwnd, (wchar_t *)m_title.utf16());
const QString initialFile = QDir::toNativeSeparators(m_data.directory());
if (!initialFile.isEmpty())
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initialFile.utf16()));
}
@ -1743,8 +1745,7 @@ QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner)
initPath[0] = 0;
bi.hwndOwner = owner;
bi.pidlRoot = NULL;
//### This does not seem to be respected? - the dialog always displays "Browse for folder"
bi.lpszTitle = (wchar_t*)m_title.utf16();
bi.lpszTitle = 0;
bi.pszDisplayName = initPath;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
bi.lpfn = xpFileDialogGetExistingDirCallbackProc;