- the colums in the shellview are now created depending on the

attributes of the folder object shown
- get all attributes from the shellfolder instead directly from the idlist
- header fields localized (only engl. and german till now)
- small fixes
This commit is contained in:
Juergen Schmied 1999-11-14 21:33:23 +00:00 committed by Alexandre Julliard
parent 1679f2c250
commit 46e8fff46d
9 changed files with 463 additions and 145 deletions

View File

@ -1580,11 +1580,13 @@ DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
DWORD dwSize; DWORD dwSize;
switch (pdata->type) switch (pdata->type)
{ case PT_VALUE: {
case PT_VALUE:
dwSize = pdata->u.file.dwFileSize; dwSize = pdata->u.file.dwFileSize;
if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize); if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize);
return dwSize; return dwSize;
} }
if (pOut) *pOut = 0x00;
return 0; return 0;
} }

View File

@ -12,3 +12,14 @@ FONT 10, "System"
LTEXT "Wine was brought to you by:", 98, 8, 55, 137, 10 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

View File

@ -12,3 +12,14 @@ FONT 10, "System"
LTEXT "Wine was brought to you by:", 98, 8, 55, 137, 10 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

View File

@ -61,6 +61,9 @@ extern HRESULT (WINAPI* pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
extern HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd); extern HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd);
BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList); 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); HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl);
/* Iconcache */ /* Iconcache */

View File

@ -42,7 +42,7 @@ LRESULT WINAPI SHCoCreateInstance(
REFIID refiid, REFIID refiid,
LPVOID *ppv) LPVOID *ppv)
{ {
char xclsid[48], xiid[48], xuout[48]; char xclsid[48], xiid[48];
DWORD hres; DWORD hres;
IID iid; IID iid;
CLSID * myclsid = (CLSID*)clsid; CLSID * myclsid = (CLSID*)clsid;
@ -58,13 +58,11 @@ LRESULT WINAPI SHCoCreateInstance(
WINE_StringFromCLSID(myclsid,xclsid); WINE_StringFromCLSID(myclsid,xclsid);
WINE_StringFromCLSID(refiid,xiid); 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", TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n",
aclsid,xclsid,unknownouter?xuout:"nil",xiid,ppv); 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) if(hres!=S_OK)
{ {

View File

@ -4,7 +4,7 @@
* Copyright 1997 Marcus Meissner * Copyright 1997 Marcus Meissner
* Copyright 1998, 1999 Juergen Schmied * Copyright 1998, 1999 Juergen Schmied
* *
* IShellFolder with IDropTarget, IPersistFolder * IShellFolder2 and related interfaces
* *
*/ */
@ -23,11 +23,21 @@
#include "wine/obj_shellfolder.h" #include "wine/obj_shellfolder.h"
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "shresdef.h"
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell)
#define MEM_DEBUG 1 #define MEM_DEBUG 1
typedef struct
{
int colnameid;
int pcsFlags;
int fmt;
int cxChar;
} shvheader;
/*************************************************************************** /***************************************************************************
* GetNextElement (internal function) * GetNextElement (internal function)
* *
@ -215,6 +225,16 @@ static struct ICOM_VTABLE(IDropTarget) dtvt;
#define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
#define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); #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 * registers clipboardformat once
*/ */
@ -989,7 +1009,7 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID(
GUID *pguid) GUID *pguid)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); FIXME("(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IShellFolder_fnEnumSearches( static HRESULT WINAPI IShellFolder_fnEnumSearches(
@ -997,7 +1017,7 @@ static HRESULT WINAPI IShellFolder_fnEnumSearches(
IEnumExtraSearch **ppenum) IEnumExtraSearch **ppenum)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); FIXME("(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( static HRESULT WINAPI IShellFolder_fnGetDefaultColumn(
@ -1007,8 +1027,13 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumn(
ULONG *pDisplay) ULONG *pDisplay)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
return E_NOTIMPL;
if (pSort) *pSort = 0;
if (pDisplay) *pDisplay = 0;
return S_OK;
} }
static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState(
IShellFolder2 * iface, IShellFolder2 * iface,
@ -1016,8 +1041,14 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState(
DWORD *pcsFlags) DWORD *pcsFlags)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); 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( static HRESULT WINAPI IShellFolder_fnGetDetailsEx(
IShellFolder2 * iface, IShellFolder2 * iface,
@ -1026,7 +1057,8 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsEx(
VARIANT *pv) VARIANT *pv)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); FIXME("(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IShellFolder_fnGetDetailsOf( static HRESULT WINAPI IShellFolder_fnGetDetailsOf(
@ -1036,8 +1068,47 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsOf(
SHELLDETAILS *psd) SHELLDETAILS *psd)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); HRESULT hr = E_FAIL;
return E_NOTIMPL;
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( static HRESULT WINAPI IShellFolder_fnMapNameToSCID(
IShellFolder2 * iface, IShellFolder2 * iface,
@ -1045,7 +1116,7 @@ static HRESULT WINAPI IShellFolder_fnMapNameToSCID(
SHCOLUMNID *pscid) SHCOLUMNID *pscid)
{ {
ICOM_THIS(IGenericSFImpl, iface); ICOM_THIS(IGenericSFImpl, iface);
TRACE("(%p)\n",This); FIXME("(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1081,6 +1152,16 @@ static ICOM_VTABLE(IShellFolder2) sfvt =
*/ */
static struct ICOM_VTABLE(IShellFolder2) sfdvt; 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 * ISF_Desktop_Constructor
* *
@ -1409,6 +1490,121 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf(
return S_OK; 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 = static ICOM_VTABLE(IShellFolder2) sfdvt =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@ -1427,13 +1623,13 @@ static ICOM_VTABLE(IShellFolder2) sfdvt =
IShellFolder_fnSetNameOf, IShellFolder_fnSetNameOf,
/* ShellFolder2 */ /* ShellFolder2 */
IShellFolder_fnGetDefaultSearchGUID, ISF_Desktop_fnGetDefaultSearchGUID,
IShellFolder_fnEnumSearches, ISF_Desktop_fnEnumSearches,
IShellFolder_fnGetDefaultColumn, ISF_Desktop_fnGetDefaultColumn,
IShellFolder_fnGetDefaultColumnState, ISF_Desktop_fnGetDefaultColumnState,
IShellFolder_fnGetDetailsEx, ISF_Desktop_fnGetDetailsEx,
IShellFolder_fnGetDetailsOf, ISF_Desktop_fnGetDetailsOf,
IShellFolder_fnMapNameToSCID ISF_Desktop_fnMapNameToSCID
}; };
@ -1443,6 +1639,15 @@ static ICOM_VTABLE(IShellFolder2) sfdvt =
static struct ICOM_VTABLE(IShellFolder2) sfmcvt; 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 * ISF_MyComputer_Constructor
*/ */
@ -1752,6 +1957,133 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf(
return S_OK; 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 = static ICOM_VTABLE(IShellFolder2) sfmcvt =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@ -1770,13 +2102,13 @@ static ICOM_VTABLE(IShellFolder2) sfmcvt =
IShellFolder_fnSetNameOf, IShellFolder_fnSetNameOf,
/* ShellFolder2 */ /* ShellFolder2 */
IShellFolder_fnGetDefaultSearchGUID, ISF_MyComputer_fnGetDefaultSearchGUID,
IShellFolder_fnEnumSearches, ISF_MyComputer_fnEnumSearches,
IShellFolder_fnGetDefaultColumn, ISF_MyComputer_fnGetDefaultColumn,
IShellFolder_fnGetDefaultColumnState, ISF_MyComputer_fnGetDefaultColumnState,
IShellFolder_fnGetDetailsEx, ISF_MyComputer_fnGetDetailsEx,
IShellFolder_fnGetDetailsOf, ISF_MyComputer_fnGetDetailsOf,
IShellFolder_fnMapNameToSCID ISF_MyComputer_fnMapNameToSCID
}; };

View File

@ -3,21 +3,27 @@
* *
* Copyright 1998,1999 <juergen.schmied@debitel.net> * Copyright 1998,1999 <juergen.schmied@debitel.net>
* *
* FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a * This is the view visualizing the data provied by the shellfolder.
* Release() ??? * 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. * FIXME: The order by part of the background context menu should be
* This implementation is more or less ok for file system folders * buily according to the columns shown.
* 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: 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 <stdlib.h> #include <stdlib.h>
@ -59,6 +65,7 @@ typedef struct
ICOM_VTABLE(IDropSource)* lpvtblDropSource; ICOM_VTABLE(IDropSource)* lpvtblDropSource;
ICOM_VTABLE(IViewObject)* lpvtblViewObject; ICOM_VTABLE(IViewObject)* lpvtblViewObject;
IShellFolder* pSFParent; IShellFolder* pSFParent;
IShellFolder2* pSF2Parent;
IShellBrowser* pShellBrowser; IShellBrowser* pShellBrowser;
ICommDlgBrowser* pCommDlgBrowser; ICommDlgBrowser* pCommDlgBrowser;
HWND hWnd; HWND hWnd;
@ -150,11 +157,10 @@ IShellView * IShellView_Constructor( IShellFolder * pFolder)
sv->lpvtblDropSource=&dsvt; sv->lpvtblDropSource=&dsvt;
sv->lpvtblViewObject=&vovt; sv->lpvtblViewObject=&vovt;
sv->pSFParent = pFolder; sv->pSFParent = pFolder;
if(pFolder) IShellFolder_AddRef(pFolder);
if(pFolder) IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent);
IShellFolder_AddRef(pFolder);
TRACE("(%p)->(%p)\n",sv, pFolder); TRACE("(%p)->(%p)\n",sv, pFolder);
shell32_ObjCount++; shell32_ObjCount++;
return (IShellView *) sv; return (IShellView *) sv;
@ -208,6 +214,9 @@ static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
} }
/********************************************************** /**********************************************************
* set the toolbar of the filedialog buttons * set the toolbar of the filedialog buttons
*
* - activates the buttons from the shellbrowser according to
* the view state
*/ */
static void CheckToolbar(IShellViewImpl * This) static void CheckToolbar(IShellViewImpl * This)
{ {
@ -248,6 +257,7 @@ static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
/********************************************************** /**********************************************************
* ShellView_CreateList() * ShellView_CreateList()
* *
* - creates the list view window
*/ */
static BOOL ShellView_CreateList (IShellViewImpl * This) static BOOL ShellView_CreateList (IShellViewImpl * This)
{ DWORD dwStyle; { DWORD dwStyle;
@ -290,43 +300,42 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
/* UpdateShellSettings(); */ /* UpdateShellSettings(); */
return TRUE; return TRUE;
} }
/********************************************************** /**********************************************************
* ShellView_InitList() * ShellView_InitList()
* *
* NOTES * - adds all needed columns to the shellview
* 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)
*/ */
static BOOL ShellView_InitList(IShellViewImpl * This) static BOOL ShellView_InitList(IShellViewImpl * This)
{ {
LVCOLUMNA lvColumn; LVCOLUMNA lvColumn;
CHAR szString[50]; SHELLDETAILS sd;
int i;
char szTemp[50];
TRACE("%p\n",This); TRACE("%p\n",This);
ListView_DeleteAllItems(This->hWndList); ListView_DeleteAllItems(This->hWndList);
/*initialize the columns */ lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/ lvColumn.pszText = szTemp;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.pszText = szString;
lvColumn.cx = 120; if (This->pSF2Parent)
LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, szString, sizeof(szString)); {
ListView_InsertColumnA(This->hWndList, 0, &lvColumn); for (i=0; 1; i++)
{
lvColumn.cx = 60; if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd)))
LoadStringA(shell32_hInstance, IDS_SHV_COLUMN2, szString, sizeof(szString)); break;
ListView_InsertColumnA(This->hWndList, 1, &lvColumn); lvColumn.fmt = sd.fmt;
lvColumn.cx = sd.cxChar*8; /* chars->pixel */
lvColumn.cx = 120; StrRetToStrNA( szTemp, 50, &sd.str, NULL);
LoadStringA(shell32_hInstance, IDS_SHV_COLUMN3, szString, sizeof(szString)); ListView_InsertColumnA(This->hWndList, i, &lvColumn);
ListView_InsertColumnA(This->hWndList, 2, &lvColumn); }
}
lvColumn.cx = 60; else
LoadStringA(shell32_hInstance, IDS_SHV_COLUMN4, szString, sizeof(szString)); {
ListView_InsertColumnA(This->hWndList, 3, &lvColumn); FIXME("no SF2\n");
}
ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL); ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL);
ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL); ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL);
@ -455,8 +464,9 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
/********************************************************** /**********************************************************
* ShellView_FillList() * ShellView_FillList()
* *
* NOTES * - gets the objectlist from the shellfolder
* internal * - sorts the list
* - fills the list into the view
*/ */
static HRESULT ShellView_FillList(IShellViewImpl * This) 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); pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
/*turn the listview's redrawing off*/ /*turn the listview's redrawing off*/
@ -650,6 +660,8 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
/********************************************************** /**********************************************************
* ShellView_GetSelections() * ShellView_GetSelections()
* *
* - fills the this->apidl list with the selected objects
*
* RETURNS * RETURNS
* number of selected items * number of selected items
*/ */
@ -1009,7 +1021,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
{ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;
NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
STRRET str;
TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); 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); TRACE("-- LVN_GETDISPINFOA %p\n",This);
pidl = (LPITEMIDLIST)lpdi->item.lParam; pidl = (LPITEMIDLIST)lpdi->item.lParam;
if(lpdi->item.mask & LVIF_TEXT) /* text requested */
if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ {
{ if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ if (This->pSF2Parent)
{ if(_ILIsValue(pidl)) /*is This a value or a folder?*/ {
{ switch (lpdi->item.iSubItem) SHELLDETAILS sd;
{ case 1: /* size */ IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
_ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
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;
}
}
TRACE("-- text=%s\n",lpdi->item.pszText); TRACE("-- text=%s\n",lpdi->item.pszText);
} }
else
{
FIXME("no SF2\n");
}
} }
else /*the item text is being requested*/ if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
{ {
if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
{
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);
}
} }
break; break;
@ -1302,6 +1272,9 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
if(This->pSFParent) if(This->pSFParent)
IShellFolder_Release(This->pSFParent); IShellFolder_Release(This->pSFParent);
if(This->pSF2Parent)
IShellFolder2_Release(This->pSF2Parent);
if (This->apidl) if (This->apidl)
SHFree(This->apidl); SHFree(This->apidl);

View File

@ -90,19 +90,6 @@ FONT 8, "Helv"
4, 4, 120, 120 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 special folders
*/ */

View File

@ -10,6 +10,7 @@
#define IDS_SHV_COLUMN4 10 #define IDS_SHV_COLUMN4 10
#define IDS_SHV_COLUMN5 11 #define IDS_SHV_COLUMN5 11
#define IDS_SHV_COLUMN6 12 #define IDS_SHV_COLUMN6 12
#define IDS_SHV_COLUMN7 13
#define IDS_DESKTOP 20 #define IDS_DESKTOP 20
#define IDS_MYCOMPUTER 21 #define IDS_MYCOMPUTER 21