diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 0e7d212b4c1..636a3fdfbf7 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1580,11 +1580,13 @@ DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DWORD dwSize; switch (pdata->type) - { case PT_VALUE: + { + case PT_VALUE: dwSize = pdata->u.file.dwFileSize; if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize); return dwSize; } + if (pOut) *pOut = 0x00; return 0; } diff --git a/dlls/shell32/shell32_De.rc b/dlls/shell32/shell32_De.rc index a0cc75e90a0..0dc1d61ff51 100644 --- a/dlls/shell32/shell32_De.rc +++ b/dlls/shell32/shell32_De.rc @@ -12,3 +12,14 @@ FONT 10, "System" LTEXT "Wine was brought to you by:", 98, 8, 55, 137, 10 } +/* Namen der Header für die Shellviews */ +STRINGTABLE LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL +BEGIN + IDS_SHV_COLUMN1 "Datei" + IDS_SHV_COLUMN2 "Größe" + IDS_SHV_COLUMN3 "Typ" + IDS_SHV_COLUMN4 "Geändert" + IDS_SHV_COLUMN5 "Attribute" + IDS_SHV_COLUMN6 "Gesammtgröße" + IDS_SHV_COLUMN7 "Freier Speicher" +END diff --git a/dlls/shell32/shell32_En.rc b/dlls/shell32/shell32_En.rc index 964739daf2c..ed4789cc19f 100644 --- a/dlls/shell32/shell32_En.rc +++ b/dlls/shell32/shell32_En.rc @@ -12,3 +12,14 @@ FONT 10, "System" LTEXT "Wine was brought to you by:", 98, 8, 55, 137, 10 } +/* columns in the shellview */ +STRINGTABLE LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +BEGIN + IDS_SHV_COLUMN1 "File" + IDS_SHV_COLUMN2 "Size" + IDS_SHV_COLUMN3 "Type" + IDS_SHV_COLUMN4 "Modified" + IDS_SHV_COLUMN5 "Attributes" + IDS_SHV_COLUMN6 "Size" + IDS_SHV_COLUMN7 "Size avaiable" +END diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 134a5b8cfb1..60c3b009d52 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -61,6 +61,9 @@ extern HRESULT (WINAPI* pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget); extern HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd); BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList); + +HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); +HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); /* Iconcache */ diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 7bbe894bd55..0bff960b50e 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -42,7 +42,7 @@ LRESULT WINAPI SHCoCreateInstance( REFIID refiid, LPVOID *ppv) { - char xclsid[48], xiid[48], xuout[48]; + char xclsid[48], xiid[48]; DWORD hres; IID iid; CLSID * myclsid = (CLSID*)clsid; @@ -58,13 +58,11 @@ LRESULT WINAPI SHCoCreateInstance( WINE_StringFromCLSID(myclsid,xclsid); WINE_StringFromCLSID(refiid,xiid); - if (unknownouter) - WINE_StringFromCLSID(unknownouter,xuout); - TRACE("(%p,\n\tCLSID:\t%s\n\tUOUT:\t%s\n\tIID:\t%s,%p)\n", - aclsid,xclsid,unknownouter?xuout:"nil",xiid,ppv); + TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n", + aclsid,xclsid,unknownouter,xiid,ppv); - hres = CoCreateInstance(myclsid, NULL, CLSCTX_INPROC_SERVER, refiid, ppv); + hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv); if(hres!=S_OK) { diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index f42638ed8d0..97523469de5 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -4,7 +4,7 @@ * Copyright 1997 Marcus Meissner * Copyright 1998, 1999 Juergen Schmied * - * IShellFolder with IDropTarget, IPersistFolder + * IShellFolder2 and related interfaces * */ @@ -23,11 +23,21 @@ #include "wine/obj_shellfolder.h" #include "wine/undocshell.h" #include "shell32_main.h" +#include "shresdef.h" DEFAULT_DEBUG_CHANNEL(shell) #define MEM_DEBUG 1 +typedef struct +{ + int colnameid; + int pcsFlags; + int fmt; + int cxChar; + +} shvheader; + /*************************************************************************** * GetNextElement (internal function) * @@ -215,6 +225,16 @@ static struct ICOM_VTABLE(IDropTarget) dtvt; #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); +static shvheader GenericSFHeader [] = +{ + { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 }, + { IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12 }, + { IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5 } +}; +#define GENERICSHELLVIEWCOLUMNS 5 + /************************************************************************** * registers clipboardformat once */ @@ -989,7 +1009,7 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID( GUID *pguid) { ICOM_THIS(IGenericSFImpl, iface); - TRACE("(%p)\n",This); + FIXME("(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI IShellFolder_fnEnumSearches( @@ -997,7 +1017,7 @@ static HRESULT WINAPI IShellFolder_fnEnumSearches( IEnumExtraSearch **ppenum) { ICOM_THIS(IGenericSFImpl, iface); - TRACE("(%p)\n",This); + FIXME("(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( @@ -1007,8 +1027,13 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( ULONG *pDisplay) { ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); - return E_NOTIMPL; + + if (pSort) *pSort = 0; + if (pDisplay) *pDisplay = 0; + + return S_OK; } static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( IShellFolder2 * iface, @@ -1016,8 +1041,14 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( DWORD *pcsFlags) { ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); - return E_NOTIMPL; + + if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + *pcsFlags = GenericSFHeader[iColumn].pcsFlags; + + return S_OK; } static HRESULT WINAPI IShellFolder_fnGetDetailsEx( IShellFolder2 * iface, @@ -1026,7 +1057,8 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsEx( VARIANT *pv) { ICOM_THIS(IGenericSFImpl, iface); - TRACE("(%p)\n",This); + FIXME("(%p)\n",This); + return E_NOTIMPL; } static HRESULT WINAPI IShellFolder_fnGetDetailsOf( @@ -1036,8 +1068,47 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsOf( SHELLDETAILS *psd) { ICOM_THIS(IGenericSFImpl, iface); - TRACE("(%p)\n",This); - return E_NOTIMPL; + HRESULT hr = E_FAIL; + + TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); + + if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + if (!pidl) + { + /* the header titles */ + psd->fmt = GenericSFHeader[iColumn].fmt; + psd->cxChar = GenericSFHeader[iColumn].cxChar; + psd->str.uType = STRRET_CSTRA; + LoadStringA(shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); + return S_OK; + } + else + { + /* the data from the pidl */ + switch(iColumn) + { + case 0: /* name */ + hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); + break; + case 1: /* size */ + _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); + break; + case 2: /* type */ + _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); + break; + case 3: /* date */ + _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); + break; + case 4: /* attributes */ + _ILGetAttributeStr(pidl, psd->str.u.cStr, MAX_PATH); + break; + } + hr = S_OK; + psd->str.uType = STRRET_CSTRA; + } + + return hr; } static HRESULT WINAPI IShellFolder_fnMapNameToSCID( IShellFolder2 * iface, @@ -1045,7 +1116,7 @@ static HRESULT WINAPI IShellFolder_fnMapNameToSCID( SHCOLUMNID *pscid) { ICOM_THIS(IGenericSFImpl, iface); - TRACE("(%p)\n",This); + FIXME("(%p)\n",This); return E_NOTIMPL; } @@ -1081,6 +1152,16 @@ static ICOM_VTABLE(IShellFolder2) sfvt = */ static struct ICOM_VTABLE(IShellFolder2) sfdvt; +static shvheader DesktopSFHeader [] = +{ + { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 }, + { IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12 }, + { IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5 } +}; +#define DESKTOPSHELLVIEWCOLUMNS 5 + /************************************************************************** * ISF_Desktop_Constructor * @@ -1409,6 +1490,121 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( return S_OK; } +static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID( + IShellFolder2 * iface, + GUID *pguid) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI ISF_Desktop_fnEnumSearches( + IShellFolder2 * iface, + IEnumExtraSearch **ppenum) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn( + IShellFolder2 * iface, + DWORD dwRes, + ULONG *pSort, + ULONG *pDisplay) +{ + ICOM_THIS(IGenericSFImpl, iface); + + TRACE("(%p)\n",This); + + if (pSort) *pSort = 0; + if (pDisplay) *pDisplay = 0; + + return S_OK; +} +static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState( + IShellFolder2 * iface, + UINT iColumn, + DWORD *pcsFlags) +{ + ICOM_THIS(IGenericSFImpl, iface); + + TRACE("(%p)\n",This); + + if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + *pcsFlags = DesktopSFHeader[iColumn].pcsFlags; + + return S_OK; +} +static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + const SHCOLUMNID *pscid, + VARIANT *pv) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + + return E_NOTIMPL; +} +static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + UINT iColumn, + SHELLDETAILS *psd) +{ + ICOM_THIS(IGenericSFImpl, iface); + HRESULT hr = E_FAIL;; + + TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); + + if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + if (!pidl) + { + psd->fmt = DesktopSFHeader[iColumn].fmt; + psd->cxChar = DesktopSFHeader[iColumn].cxChar; + psd->str.uType = STRRET_CSTRA; + LoadStringA(shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); + return S_OK; + } + else + { + /* the data from the pidl */ + switch(iColumn) + { + case 0: /* name */ + hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); + break; + case 1: /* size */ + _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); + break; + case 2: /* type */ + _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); + break; + case 3: /* date */ + _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); + break; + case 4: /* attributes */ + _ILGetAttributeStr(pidl, psd->str.u.cStr, MAX_PATH); + break; + } + hr = S_OK; + psd->str.uType = STRRET_CSTRA; + } + + return hr; +} +static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID( + IShellFolder2 * iface, + LPCWSTR pwszName, + SHCOLUMNID *pscid) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} + static ICOM_VTABLE(IShellFolder2) sfdvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE @@ -1427,13 +1623,13 @@ static ICOM_VTABLE(IShellFolder2) sfdvt = IShellFolder_fnSetNameOf, /* ShellFolder2 */ - IShellFolder_fnGetDefaultSearchGUID, - IShellFolder_fnEnumSearches, - IShellFolder_fnGetDefaultColumn, - IShellFolder_fnGetDefaultColumnState, - IShellFolder_fnGetDetailsEx, - IShellFolder_fnGetDetailsOf, - IShellFolder_fnMapNameToSCID + ISF_Desktop_fnGetDefaultSearchGUID, + ISF_Desktop_fnEnumSearches, + ISF_Desktop_fnGetDefaultColumn, + ISF_Desktop_fnGetDefaultColumnState, + ISF_Desktop_fnGetDetailsEx, + ISF_Desktop_fnGetDetailsOf, + ISF_Desktop_fnMapNameToSCID }; @@ -1443,6 +1639,15 @@ static ICOM_VTABLE(IShellFolder2) sfdvt = static struct ICOM_VTABLE(IShellFolder2) sfmcvt; +static shvheader MyComputerSFHeader [] = +{ + { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 }, + { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN6, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, + { IDS_SHV_COLUMN7, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 }, +}; +#define MYCOMPUTERSHELLVIEWCOLUMNS 4 + /************************************************************************** * ISF_MyComputer_Constructor */ @@ -1752,6 +1957,133 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( return S_OK; } +static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID( + IShellFolder2 * iface, + GUID *pguid) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI ISF_MyComputer_fnEnumSearches( + IShellFolder2 * iface, + IEnumExtraSearch **ppenum) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn( + IShellFolder2 * iface, + DWORD dwRes, + ULONG *pSort, + ULONG *pDisplay) +{ + ICOM_THIS(IGenericSFImpl, iface); + + TRACE("(%p)\n",This); + + if (pSort) *pSort = 0; + if (pDisplay) *pDisplay = 0; + + return S_OK; +} +static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState( + IShellFolder2 * iface, + UINT iColumn, + DWORD *pcsFlags) +{ + ICOM_THIS(IGenericSFImpl, iface); + + TRACE("(%p)\n",This); + + if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags; + + return S_OK; +} +static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + const SHCOLUMNID *pscid, + VARIANT *pv) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + + return E_NOTIMPL; +} + +/* fixme: drive size >4GB is rolling over */ +static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + UINT iColumn, + SHELLDETAILS *psd) +{ + ICOM_THIS(IGenericSFImpl, iface); + HRESULT hr; + + TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); + + if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; + + if (!pidl) + { + psd->fmt = MyComputerSFHeader[iColumn].fmt; + psd->cxChar = MyComputerSFHeader[iColumn].cxChar; + psd->str.uType = STRRET_CSTRA; + LoadStringA(shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); + return S_OK; + } + else + { + char szPath[MAX_PATH]; + ULARGE_INTEGER ulBytes; + + psd->str.u.cStr[0] = 0x00; + psd->str.uType = STRRET_CSTRA; + switch(iColumn) + { + case 0: /* name */ + hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); + break; + case 1: /* type */ + _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); + break; + case 2: /* total size */ + if (_ILIsDrive(pidl)) + { + _ILSimpleGetText(pidl, szPath, MAX_PATH); + GetDiskFreeSpaceExA(szPath, NULL, &ulBytes, NULL); + StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); + } + break; + case 3: /* free size */ + if (_ILIsDrive(pidl)) + { + _ILSimpleGetText(pidl, szPath, MAX_PATH); + GetDiskFreeSpaceExA(szPath, &ulBytes, NULL, NULL); + StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); + } + break; + } + hr = S_OK; + } + + return hr; +} +static HRESULT WINAPI ISF_MyComputer_fnMapNameToSCID( + IShellFolder2 * iface, + LPCWSTR pwszName, + SHCOLUMNID *pscid) +{ + ICOM_THIS(IGenericSFImpl, iface); + FIXME("(%p)\n",This); + return E_NOTIMPL; +} + static ICOM_VTABLE(IShellFolder2) sfmcvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE @@ -1770,13 +2102,13 @@ static ICOM_VTABLE(IShellFolder2) sfmcvt = IShellFolder_fnSetNameOf, /* ShellFolder2 */ - IShellFolder_fnGetDefaultSearchGUID, - IShellFolder_fnEnumSearches, - IShellFolder_fnGetDefaultColumn, - IShellFolder_fnGetDefaultColumnState, - IShellFolder_fnGetDetailsEx, - IShellFolder_fnGetDetailsOf, - IShellFolder_fnMapNameToSCID + ISF_MyComputer_fnGetDefaultSearchGUID, + ISF_MyComputer_fnEnumSearches, + ISF_MyComputer_fnGetDefaultColumn, + ISF_MyComputer_fnGetDefaultColumnState, + ISF_MyComputer_fnGetDetailsEx, + ISF_MyComputer_fnGetDetailsOf, + ISF_MyComputer_fnMapNameToSCID }; diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index b73a004d50c..457ff13eae6 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -3,21 +3,27 @@ * * Copyright 1998,1999 * - * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a - * Release() ??? + * This is the view visualizing the data provied by the shellfolder. + * No direct access to data from pidls should be done from here. + * + * FIXME: There is not jet a official interface defined to manipulate + * the objects shown in the view (rename, move...). This should be + * implemented as additional interface to IShellFolder. * - * FIXME: There is still a design problem in this implementation. - * This implementation is more or less ok for file system folders - * but there are many more kinds of folders. - * The shellview is not supposed to know much about the colums - * appearing in the view. To fix this it should use the IShellFolder2 - * interface when possible to get the informations dynamically - * this will take a lot of work to implemet and wont likely not - * be done in near future - * Please considder this when code new features. Mail me if you - * are in doubt how to do things. (jsch 25/10/99) + * FIXME: The order by part of the background context menu should be + * buily according to the columns shown. * - * FIXME: Set the buttons in the filedialog according to the view state + * FIXME: Load/Save the view state from/into the stream provied by + * the ShellBrowser + * + * FIXME: CheckToolbar: handle the "new folder" and "folder up" button + * + * FIXME: ShellView_FillList: consider sort orders + * + * FIXME: implement the drag and drop in the old (msg-based) way + * + * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a + * Release() ??? */ #include @@ -59,6 +65,7 @@ typedef struct ICOM_VTABLE(IDropSource)* lpvtblDropSource; ICOM_VTABLE(IViewObject)* lpvtblViewObject; IShellFolder* pSFParent; + IShellFolder2* pSF2Parent; IShellBrowser* pShellBrowser; ICommDlgBrowser* pCommDlgBrowser; HWND hWnd; @@ -150,11 +157,10 @@ IShellView * IShellView_Constructor( IShellFolder * pFolder) sv->lpvtblDropSource=&dsvt; sv->lpvtblViewObject=&vovt; - sv->pSFParent = pFolder; - - if(pFolder) - IShellFolder_AddRef(pFolder); - + sv->pSFParent = pFolder; + if(pFolder) IShellFolder_AddRef(pFolder); + IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent); + TRACE("(%p)->(%p)\n",sv, pFolder); shell32_ObjCount++; return (IShellView *) sv; @@ -208,6 +214,9 @@ static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags) } /********************************************************** * set the toolbar of the filedialog buttons + * + * - activates the buttons from the shellbrowser according to + * the view state */ static void CheckToolbar(IShellViewImpl * This) { @@ -248,6 +257,7 @@ static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) /********************************************************** * ShellView_CreateList() * +* - creates the list view window */ static BOOL ShellView_CreateList (IShellViewImpl * This) { DWORD dwStyle; @@ -290,43 +300,42 @@ static BOOL ShellView_CreateList (IShellViewImpl * This) /* UpdateShellSettings(); */ return TRUE; } + /********************************************************** * ShellView_InitList() * -* NOTES -* FIXME: the headers should depend on the kind of shellfolder -* thats creating the shellview. this hack implements only the -* correct headers for a filesystem folder (jsch 25/10/99) +* - adds all needed columns to the shellview */ static BOOL ShellView_InitList(IShellViewImpl * This) { - LVCOLUMNA lvColumn; - CHAR szString[50]; + LVCOLUMNA lvColumn; + SHELLDETAILS sd; + int i; + char szTemp[50]; TRACE("%p\n",This); ListView_DeleteAllItems(This->hWndList); - /*initialize the columns */ - lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/ - lvColumn.fmt = LVCFMT_LEFT; - lvColumn.pszText = szString; + lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; + lvColumn.pszText = szTemp; - lvColumn.cx = 120; - LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, szString, sizeof(szString)); - ListView_InsertColumnA(This->hWndList, 0, &lvColumn); - - lvColumn.cx = 60; - LoadStringA(shell32_hInstance, IDS_SHV_COLUMN2, szString, sizeof(szString)); - ListView_InsertColumnA(This->hWndList, 1, &lvColumn); - - lvColumn.cx = 120; - LoadStringA(shell32_hInstance, IDS_SHV_COLUMN3, szString, sizeof(szString)); - ListView_InsertColumnA(This->hWndList, 2, &lvColumn); - - lvColumn.cx = 60; - LoadStringA(shell32_hInstance, IDS_SHV_COLUMN4, szString, sizeof(szString)); - ListView_InsertColumnA(This->hWndList, 3, &lvColumn); + if (This->pSF2Parent) + { + for (i=0; 1; i++) + { + if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd))) + break; + lvColumn.fmt = sd.fmt; + lvColumn.cx = sd.cxChar*8; /* chars->pixel */ + StrRetToStrNA( szTemp, 50, &sd.str, NULL); + ListView_InsertColumnA(This->hWndList, i, &lvColumn); + } + } + else + { + FIXME("no SF2\n"); + } ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL); ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL); @@ -455,8 +464,9 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam /********************************************************** * ShellView_FillList() * -* NOTES -* internal +* - gets the objectlist from the shellfolder +* - sorts the list +* - fills the list into the view */ static HRESULT ShellView_FillList(IShellViewImpl * This) @@ -496,7 +506,7 @@ static HRESULT ShellView_FillList(IShellViewImpl * This) } } - /*sort the array*/ + /* sort the array */ pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent); /*turn the listview's redrawing off*/ @@ -650,6 +660,8 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu) /********************************************************** * ShellView_GetSelections() * +* - fills the this->apidl list with the selected objects +* * RETURNS * number of selected items */ @@ -1009,7 +1021,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; LPITEMIDLIST pidl; - STRRET str; TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); @@ -1063,64 +1074,23 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn TRACE("-- LVN_GETDISPINFOA %p\n",This); pidl = (LPITEMIDLIST)lpdi->item.lParam; - - if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ - { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ - { if(_ILIsValue(pidl)) /*is This a value or a folder?*/ - { switch (lpdi->item.iSubItem) - { case 1: /* size */ - _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); - break; - case 2: /* extension */ - { char sTemp[64]; - if (_ILGetExtension (pidl, sTemp, 64)) - { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) - && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax, FALSE ))) - { lstrcpynA (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax); - strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax); - } - } - else /* no extension found */ - { lpdi->item.pszText[0]=0x00; - } - } - break; - case 3: /* date */ - _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); - break; - } - } - else /*its a folder*/ - { switch (lpdi->item.iSubItem) - { case 1: - strcpy(lpdi->item.pszText, ""); - break; - case 2: - lstrcpynA (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax); - break; - case 3: - _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); - break; - } - } + if(lpdi->item.mask & LVIF_TEXT) /* text requested */ + { + if (This->pSF2Parent) + { + SHELLDETAILS sd; + IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd); + StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); TRACE("-- text=%s\n",lpdi->item.pszText); } + else + { + FIXME("no SF2\n"); + } } - else /*the item text is being requested*/ - { - if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ - { - if(SUCCEEDED(IShellFolder_GetDisplayNameOf(This->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str))) - { - StrRetToStrNA(lpdi->item.pszText, lpdi->item.cchTextMax, &str, pidl); - } - TRACE("-- text=%s\n",lpdi->item.pszText); - } - - if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ - { - lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); - } + if(lpdi->item.mask & LVIF_IMAGE) /* image requested */ + { + lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); } break; @@ -1302,6 +1272,9 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface) if(This->pSFParent) IShellFolder_Release(This->pSFParent); + if(This->pSF2Parent) + IShellFolder2_Release(This->pSF2Parent); + if (This->apidl) SHFree(This->apidl); diff --git a/dlls/shell32/shres.rc b/dlls/shell32/shres.rc index f619e1ee9dc..ff5f048f20e 100644 --- a/dlls/shell32/shres.rc +++ b/dlls/shell32/shres.rc @@ -90,19 +90,6 @@ FONT 8, "Helv" 4, 4, 120, 120 } -/* - columns in the shellview -*/ -STRINGTABLE DISCARDABLE -{ - IDS_SHV_COLUMN1 "File" - IDS_SHV_COLUMN2 "Size" - IDS_SHV_COLUMN3 "Type" - IDS_SHV_COLUMN4 "Modified" - IDS_SHV_COLUMN5 "Size" /* drive view */ - IDS_SHV_COLUMN6 "Size avaiable" /* drive view */ -} - /* special folders */ diff --git a/dlls/shell32/shresdef.h b/dlls/shell32/shresdef.h index 4256db04e71..068a55a8a0b 100644 --- a/dlls/shell32/shresdef.h +++ b/dlls/shell32/shresdef.h @@ -10,6 +10,7 @@ #define IDS_SHV_COLUMN4 10 #define IDS_SHV_COLUMN5 11 #define IDS_SHV_COLUMN6 12 +#define IDS_SHV_COLUMN7 13 #define IDS_DESKTOP 20 #define IDS_MYCOMPUTER 21