shell32: Load shell folder column names as A/W strings depending on 9x/NT selector.

This commit is contained in:
Nikolay Sivov 2010-04-18 18:48:58 +04:00 committed by Alexandre Julliard
parent c51b248b48
commit 1b31b377b6
3 changed files with 57 additions and 33 deletions

View File

@ -548,8 +548,20 @@ HRESULT SHELL32_GetColumnDetails(const shvheader *data, int column, SHELLDETAILS
{
details->fmt = data[column].fmt;
details->cxChar = data[column].cxChar;
details->str.uType = STRRET_CSTR;
LoadStringA (shell32_hInstance, data[column].colnameid, details->str.u.cStr, MAX_PATH);
if (SHELL_OsIsUnicode())
{
details->str.u.pOleStr = CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR));
if (!details->str.u.pOleStr) return E_OUTOFMEMORY;
details->str.uType = STRRET_WSTR;
LoadStringW(shell32_hInstance, data[column].colnameid, details->str.u.pOleStr, MAX_PATH);
}
else
{
details->str.uType = STRRET_CSTR;
LoadStringA(shell32_hInstance, data[column].colnameid, details->str.u.cStr, MAX_PATH);
}
return S_OK;
}

View File

@ -387,42 +387,44 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
*
* - adds all needed columns to the shellview
*/
static BOOL ShellView_InitList(IShellViewImpl * This)
static void ShellView_InitList(IShellViewImpl *This)
{
LVCOLUMNW lvColumn;
SHELLDETAILS sd;
int i;
WCHAR szTemp[50];
LVCOLUMNW lvColumn;
SHELLDETAILS sd;
WCHAR nameW[50];
TRACE("%p\n",This);
TRACE("(%p)\n", This);
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.pszText = szTemp;
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.pszText = nameW;
if (This->pSF2Parent)
{
HRESULT hr;
INT i;
for (i = 0; 1; i++)
{
hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
if (FAILED(hr)) break;
if (This->pSF2Parent)
{
for (i=0; 1; i++)
{
if (FAILED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd)))
break;
lvColumn.fmt = sd.fmt;
lvColumn.cx = sd.cxChar*8; /* chars->pixel */
StrRetToStrNW( szTemp, 50, &sd.str, NULL);
StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
}
}
else
{
FIXME("no SF2\n");
}
}
}
else
{
FIXME("no SF2\n");
}
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
return TRUE;
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
}
/**********************************************************
* ShellView_CompareItems()
*
@ -688,10 +690,8 @@ static LRESULT ShellView_OnCreate(IShellViewImpl *This)
if (ShellView_CreateList(This))
{
if (ShellView_InitList(This))
{
ShellView_FillList(This);
}
ShellView_InitList(This);
ShellView_FillList(This);
}
hr = IShellView2_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pdt);

View File

@ -33,6 +33,11 @@
#include "wine/test.h"
static inline BOOL SHELL_OsIsUnicode(void)
{
return !(GetVersion() & 0x80000000);
}
/* Tests for My Network Places */
static void test_parse_for_entire_network(void)
{
@ -129,8 +134,8 @@ static void test_printers_folder(void)
SHELLDETAILS details;
SHCOLSTATEF state;
LPITEMIDLIST pidl1, pidl2;
INT i;
HRESULT hr;
INT i;
CoInitialize( NULL );
@ -166,6 +171,9 @@ if (0)
ok(hr == S_OK, "got 0x%08x\n", hr);
/* all columns are left-aligned */
ok(details.fmt == LVCFMT_LEFT, "got 0x%x\n", details.fmt);
/* can't be on w9x at this point, IShellFolder2 unsupported there,
check present for running Wine with w9x setup */
if (SHELL_OsIsUnicode()) SHFree(details.str.u.pOleStr);
hr = IShellFolder2_GetDefaultColumnState(folder, i, &state);
ok(hr == S_OK, "got 0x%08x\n", hr);
@ -176,6 +184,10 @@ if (0)
ok(state == (SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
}
hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, &details);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(details.str.uType == STRRET_WSTR, "got %d\n", details.str.uType);
/* default pidl */
hr = IShellFolder2_QueryInterface(folder, &IID_IPersistFolder2, (void**)&pf);
ok(hr == S_OK, "got 0x%08x\n", hr);