[PATCH] Fallback to IShellDetails while filling shell view columns if IShellFolder2 is missed
Nikolay Sivov
nsivov at codeweavers.com
Sun Apr 18 09:51:45 CDT 2010
---
dlls/shell32/shlview.c | 39 +++++++++++++++++++++++----------------
include/shlobj.h | 22 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 938ec13..c7d9ee8 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -389,40 +389,47 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
*/
static void ShellView_InitList(IShellViewImpl *This)
{
+ IShellDetails *details = NULL;
LVCOLUMNW lvColumn;
SHELLDETAILS sd;
WCHAR nameW[50];
+ HRESULT hr;
+ INT i;
TRACE("(%p)\n", This);
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
+ SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
+ SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.pszText = nameW;
- if (This->pSF2Parent)
+ if (!This->pSF2Parent)
{
- HRESULT hr;
- INT i;
-
- for (i = 0; 1; i++)
+ hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
+ if (hr != S_OK)
{
- hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
- if (FAILED(hr)) break;
-
- lvColumn.fmt = sd.fmt;
- lvColumn.cx = sd.cxChar*8; /* chars->pixel */
- StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
- SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
+ WARN("IShellFolder2/IShellDetails not supported\n");
+ return;
}
}
- else
+
+ for (i = 0; 1; i++)
{
- FIXME("no SF2\n");
+ if (This->pSFParent)
+ hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
+ else
+ hr = IShellDetails_GetDetailsOf(details, NULL, i, &sd);
+ if (FAILED(hr)) break;
+
+ lvColumn.fmt = sd.fmt;
+ lvColumn.cx = sd.cxChar*8; /* chars->pixel */
+ StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
+ SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
}
- SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
- SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
+ if (details) IShellDetails_Release(details);
}
/**********************************************************
diff --git a/include/shlobj.h b/include/shlobj.h
index 9f87a0a..a463ca1 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -346,6 +346,28 @@ typedef struct
#define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0)
#define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1)
+#define INTERFACE IShellDetails
+DECLARE_INTERFACE_(IShellDetails, IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD_(HRESULT,QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+ /*** IShellDetails methods ***/
+ STDMETHOD(GetDetailsOf)(THIS_ PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *pDetails) PURE;
+ STDMETHOD(ColumnClick)(THIS_ UINT iColumn) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IShellDetails_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IShellDetails_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IShellDetails_Release(p) (p)->lpVtbl->Release(p)
+/*** IShellDetails methods ***/
+#define IShellDetails_GetDetailsOf(p,a,b,c) (p)->lpVtbl->GetDetailsOf(p,a,b,c)
+#define IShellDetails_ColumnClick(p,a) (p)->lpVtbl->ColumnClick(p,a)
+#endif
/****************************************************************************
* IShellIcon interface
--
1.5.6.5
--=-Pr8FvHZ5bj7ls6sgSTAG--
More information about the wine-patches
mailing list