Author: gadamopoulos
Date: Tue Nov 4 11:45:05 2014
New Revision: 65243
URL:
http://svn.reactos.org/svn/reactos?rev=65243&view=rev
Log:
[SHELL32]
- Simplify CMyDocsFolder folder to use a CFSFolder internally
- Note that while CAdminToolsFolder and CFontsFolder should aggregate CFSFolder,
CMyDocsFolder shouldn't and this is implementation is much closer to windows.
Modified:
branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp
branches/shell-experiments/dll/win32/shell32/folders/mydocuments.h
Modified: branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp [iso-8859-1] Tue
Nov 4 11:45:05 2014
@@ -33,65 +33,26 @@
* MyDocumentsfolder implementation
*/
-class CFileSysEnumX :
- public IEnumIDListImpl
-{
- private:
- public:
- CFileSysEnumX();
- ~CFileSysEnumX();
- HRESULT WINAPI Initialize(DWORD dwFlags);
-
- BEGIN_COM_MAP(CFileSysEnumX)
- COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
- END_COM_MAP()
-};
-
-static const shvheader MyDocumentsSFHeader[] = {
- {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 MYDOCUMENTSSHELLVIEWCOLUMNS 5
-
-CFileSysEnumX::CFileSysEnumX()
-{
-}
-
-CFileSysEnumX::~CFileSysEnumX()
-{
-}
-
-HRESULT WINAPI CFileSysEnumX::Initialize(DWORD dwFlags)
-{
- WCHAR szPath[MAX_PATH];
-
- if (SHGetSpecialFolderPathW(0, szPath, CSIDL_PERSONAL, FALSE) == FALSE)
- return E_FAIL;
- return CreateFolderEnumList(szPath, dwFlags);
-}
-
CMyDocsFolder::CMyDocsFolder()
{
+ m_pisfInner = NULL;
+ m_pisf2Inner = NULL;
pidlRoot = NULL;
sPathTarget = NULL;
- mFSDropTarget = NULL;
}
CMyDocsFolder::~CMyDocsFolder()
{
- TRACE ("-- destroying IShellFolder(%p)\n", this);
SHFree(pidlRoot);
- HeapFree(GetProcessHeap(), 0, sPathTarget);
- mFSDropTarget->Release();
+ if (sPathTarget)
+ HeapFree(GetProcessHeap(), 0, sPathTarget);
+ m_pisfInner.Release();
+ m_pisf2Inner.Release();
}
HRESULT WINAPI CMyDocsFolder::FinalConstruct()
{
- WCHAR szMyPath[MAX_PATH];
+ WCHAR szMyPath[MAX_PATH];
if (!SHGetSpecialFolderPathW(0, szMyPath, CSIDL_PERSONAL, TRUE))
return E_UNEXPECTED;
@@ -100,318 +61,103 @@
sPathTarget = (LPWSTR)SHAlloc((wcslen(szMyPath) + 1) * sizeof(WCHAR));
wcscpy(sPathTarget, szMyPath);
- LPITEMIDLIST pidl = NULL;
-
WCHAR szPath[MAX_PATH];
lstrcpynW(szPath, sPathTarget, MAX_PATH);
- PathAddBackslashW(szPath);
- CComPtr<IShellFolder> psfDesktop = NULL;
-
- HRESULT hr = SHGetDesktopFolder(&psfDesktop);
- if (SUCCEEDED(hr))
- hr = psfDesktop->ParseDisplayName(NULL, NULL, szPath, NULL, &pidl, NULL);
- else
- ERR("Error getting desktop folder\n");
-
- if (SUCCEEDED(hr))
- {
- hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IDropTarget,
&mFSDropTarget));
- CoTaskMemFree(pidl);
- if (FAILED(hr))
- ERR("Error Binding");
- }
- else
- ERR("Error creating from %s\n", debugstr_w(szPath));
-
- return S_OK;
+
+ HRESULT hr;
+ CComPtr<IPersistFolder3> ppf3;
+
+ hr = SHCoCreateInstance(NULL, &CLSID_ShellFSFolder, NULL,
IID_PPV_ARG(IShellFolder, &m_pisfInner));
+ if (FAILED(hr))
+ return hr;
+
+ hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pisf2Inner));
+ if (FAILED(hr))
+ return hr;
+
+ hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IPersistFolder3, &ppf3));
+ if (FAILED(hr))
+ return hr;
+
+ PERSIST_FOLDER_TARGET_INFO info;
+ ZeroMemory(&info, sizeof(PERSIST_FOLDER_TARGET_INFO));
+ info.csidl = CSIDL_PERSONAL;
+ hr = ppf3->InitializeEx(NULL, pidlRoot, &info);
+
+ return hr;
}
HRESULT WINAPI CMyDocsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR
lpszDisplayName,
- DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
-{
- WCHAR szElement[MAX_PATH];
- LPCWSTR szNext = NULL;
- LPITEMIDLIST pidlTemp = NULL;
- HRESULT hr = S_OK;
- CLSID clsid;
-
- TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
- this, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
- pchEaten, ppidl, pdwAttributes);
-
- if (!lpszDisplayName || !ppidl)
- return E_INVALIDARG;
-
- *ppidl = 0;
-
- if (pchEaten)
- *pchEaten = 0; /* strange but like the original */
-
- if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
- {
- szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
- TRACE("-- element: %s\n", debugstr_w (szElement));
- CLSIDFromString(szElement + 2, &clsid);
- pidlTemp = _ILCreateGuid (PT_GUID, clsid);
- }
- else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
- {
- *ppidl = pidlTemp;
- return S_OK;
- }
- else
- {
- /* it's a filesystem path on the desktop. Let a FSFolder parse it */
-
- if (*lpszDisplayName)
- {
- WCHAR szPath[MAX_PATH];
- LPWSTR pathPtr;
-
- /* build a complete path to create a simple pidl */
- lstrcpynW(szPath, sPathTarget, MAX_PATH);
- pathPtr = PathAddBackslashW(szPath);
- if (pathPtr)
- {
- lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath));
- hr = _ILCreateFromPathW(szPath, &pidlTemp);
- }
- else
- {
- /* should never reach here, but for completeness */
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- }
- else
- pidlTemp = _ILCreateMyDocuments();
-
- szNext = NULL;
- }
-
- if (SUCCEEDED(hr) && pidlTemp)
- {
- if (szNext && *szNext)
- {
- hr = SHELL32_ParseNextElement(this, hwndOwner, pbc,
- &pidlTemp, (LPOLESTR) szNext, pchEaten,
pdwAttributes);
- }
- else
- {
- if (pdwAttributes && *pdwAttributes)
- hr = SHELL32_GetItemAttributes(this, pidlTemp, pdwAttributes);
- }
- }
-
- *ppidl = pidlTemp;
-
- TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
-
- return hr;
-}
-
-/**************************************************************************
- * ISF_MyDocuments_fnEnumObjects
- */
+ ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
+{
+ return m_pisfInner->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten,
ppidl, pdwAttributes);
+}
+
HRESULT WINAPI CMyDocsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- return ShellObjectCreatorInit<CFileSysEnumX>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
-}
-
-/**************************************************************************
- * CMyDocsFolder::BindToObject
- */
+ return m_pisfInner->EnumObjects(hwndOwner, dwFlags, ppEnumIDList);
+}
+
HRESULT WINAPI CMyDocsFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved,
REFIID riid, LPVOID *ppvOut)
{
- TRACE("(%p)->(pidl=%p,%p,%s,%p)\n",
- this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
-
- return SHELL32_BindToChild( pidlRoot, sPathTarget, pidl, riid, ppvOut );
-}
-
-/**************************************************************************
- * CMyDocsFolder::BindToStorage
- */
+ return m_pisfInner->BindToObject(pidl, pbcReserved, riid, ppvOut);
+}
+
HRESULT WINAPI CMyDocsFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved,
REFIID riid, LPVOID *ppvOut)
{
- FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n",
- this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
-
- *ppvOut = NULL;
- return E_NOTIMPL;
-}
-
-/**************************************************************************
- * CMyDocsFolder::CompareIDs
- */
+ return m_pisfInner->BindToStorage(pidl, pbcReserved, riid, ppvOut);
+}
+
HRESULT WINAPI CMyDocsFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1,
PCUIDLIST_RELATIVE pidl2)
{
- int nReturn;
-
- TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam, pidl1,
pidl2);
- nReturn = SHELL32_CompareIDs (this, lParam, pidl1, pidl2);
- TRACE ("-- %i\n", nReturn);
- return nReturn;
-}
-
-/**************************************************************************
- * CMyDocsFolder::CreateViewObject
- */
+ return m_pisfInner->CompareIDs(lParam, pidl1, pidl2);
+}
+
HRESULT WINAPI CMyDocsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID
*ppvOut)
{
- CComPtr<IShellView> pShellView;
- HRESULT hr = E_INVALIDARG;
-
- TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
- this, hwndOwner, shdebugstr_guid (&riid), ppvOut);
-
- if (!ppvOut)
- return hr;
-
- *ppvOut = NULL;
-
- if (IsEqualIID (riid, IID_IDropTarget))
- {
- hr = this->QueryInterface (IID_IDropTarget, ppvOut);
- }
- else if (IsEqualIID (riid, IID_IContextMenu))
- {
- WARN ("IContextMenu not implemented\n");
- hr = E_NOTIMPL;
- }
- else if (IsEqualIID (riid, IID_IShellView))
- {
- hr = IShellView_Constructor ((IShellFolder *)this, &pShellView);
- if (pShellView)
- {
- hr = pShellView->QueryInterface(riid, ppvOut);
- }
- }
- TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
- return hr;
-}
-
-/**************************************************************************
- * CMyDocsFolder::GetAttributesOf
- */
+ return m_pisfInner->CreateViewObject(hwndOwner, riid, ppvOut);
+}
+
HRESULT WINAPI CMyDocsFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
DWORD *rgfInOut)
{
- HRESULT hr = S_OK;
static const DWORD dwMyDocumentsAttributes =
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_CANCOPY |
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER |
SFGAO_CANRENAME | SFGAO_CANDELETE;
- TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
- this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
-
- if (!rgfInOut)
- return E_INVALIDARG;
- if (cidl && !apidl)
- return E_INVALIDARG;
-
- if (*rgfInOut == 0)
- *rgfInOut = ~0;
-
- if(cidl == 0) {
+ if(cidl)
+ {
+ return m_pisfInner->GetAttributesOf(cidl, apidl, rgfInOut);
+ }
+ else
+ {
+ if (!rgfInOut)
+ return E_INVALIDARG;
+ if (cidl && !apidl)
+ return E_INVALIDARG;
+
+ if (*rgfInOut == 0)
+ *rgfInOut = ~0;
+
*rgfInOut &= dwMyDocumentsAttributes;
- } else {
- while (cidl > 0 && *apidl) {
- pdump (*apidl);
- if (_ILIsMyDocuments(*apidl)) {
- *rgfInOut &= dwMyDocumentsAttributes;
- } else {
- SHELL32_GetItemAttributes (this, *apidl, rgfInOut);
- }
- apidl++;
- cidl--;
- }
- }
- /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
- *rgfInOut &= ~SFGAO_VALIDATE;
-
- TRACE ("-- result=0x%08x\n", *rgfInOut);
-
- return hr;
-}
-
-/**************************************************************************
- * CMyDocsFolder::GetUIObjectOf
- *
- * PARAMETERS
- * HWND hwndOwner, //[in ] Parent window for any output
- * UINT cidl, //[in ] array size
- * LPCITEMIDLIST* apidl, //[in ] simple pidl array
- * REFIID riid, //[in ] Requested Interface
- * UINT* prgfInOut, //[ ] reserved
- * LPVOID* ppvObject) //[out] Resulting Interface
- *
- */
+
+ /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
+ *rgfInOut &= ~SFGAO_VALIDATE;
+
+ return S_OK;
+ }
+}
+
HRESULT WINAPI CMyDocsFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl,
REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
{
- LPITEMIDLIST pidl;
- IUnknown *pObj = NULL;
- HRESULT hr = E_INVALIDARG;
-
- TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
- this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut,
ppvOut);
-
- if (!ppvOut)
- return hr;
-
- *ppvOut = NULL;
-
- if (IsEqualIID (riid, IID_IContextMenu))
- {
- IContextMenu * pCm = NULL;
- hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl,
static_cast<IShellFolder*>(this), NULL, 0, NULL, &pCm);
- pObj = pCm;
- }
- else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
- {
- IDataObject * pDo = NULL;
- hr = IDataObject_Constructor(hwndOwner, pidlRoot, apidl, cidl, &pDo);
- pObj = pDo;
- }
- else if (IsEqualIID (riid, IID_IExtractIconA) && (cidl == 1))
- {
- pidl = ILCombine (pidlRoot, apidl[0]);
- pObj = IExtractIconA_Constructor (pidl);
- SHFree (pidl);
- hr = S_OK;
- }
- else if (IsEqualIID (riid, IID_IExtractIconW) && (cidl == 1))
- {
- pidl = ILCombine (pidlRoot, apidl[0]);
- pObj = IExtractIconW_Constructor (pidl);
- SHFree (pidl);
- hr = S_OK;
- }
- else if (IsEqualIID (riid, IID_IDropTarget) && (cidl >= 1))
- {
- IDropTarget * pDt = NULL;
- hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
- pObj = pDt;
- }
- else if ((IsEqualIID(riid, IID_IShellLinkW) ||
- IsEqualIID(riid, IID_IShellLinkA)) && (cidl == 1))
- {
- pidl = ILCombine (pidlRoot, apidl[0]);
- hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
- SHFree (pidl);
- }
- else
- hr = E_NOINTERFACE;
-
- if (SUCCEEDED(hr) && !pObj)
- hr = E_OUTOFMEMORY;
-
- *ppvOut = pObj;
- TRACE ("(%p)->hr=0x%08x\n", this, hr);
- return hr;
+ return m_pisfInner->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut,
ppvOut);
}
HRESULT WINAPI CMyDocsFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags,
LPSTRRET strRet)
{
+ if (!_ILIsSpecialFolder(pidl))
+ return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
+
HRESULT hr = S_OK;
LPWSTR pszPath;
@@ -427,7 +173,7 @@
ZeroMemory(pszPath, (MAX_PATH + 1) * sizeof(WCHAR));
- if (_ILIsMyDocuments (pidl))
+ if (_ILIsMyDocuments (pidl) || !pidl->mkid.cb)
{
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
(GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
@@ -436,106 +182,9 @@
HCR_GetClassNameW(CLSID_MyDocuments, pszPath, MAX_PATH);
TRACE("CP\n");
}
- else if (_ILIsPidlSimple (pidl))
- {
- GUID const *clsid;
-
- if ((clsid = _ILGetGUIDPointer (pidl)))
- {
- if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
- {
- int bWantsForParsing;
-
- /*
- * We can only get a filesystem path from a shellfolder if the
- * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
- *
- * Exception: The MyComputer folder doesn't have this key,
- * but any other filesystem backed folder it needs it.
- */
- if (IsEqualIID (*clsid, CLSID_MyDocuments))
- {
- bWantsForParsing = TRUE;
- }
- else
- {
- /* get the "WantsFORPARSING" flag from the registry */
- static const WCHAR clsidW[] = L"CLSID\\";
- static const WCHAR shellfolderW[] = L"shellfolder";
- static const WCHAR wantsForParsingW[] =
L"WantsForParsing";
- WCHAR szRegPath[100];
- LONG r;
-
- wcscpy (szRegPath, clsidW);
- SHELL32_GUIDToStringW (*clsid, &szRegPath[6]);
- wcscat (szRegPath, shellfolderW);
- r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
- wantsForParsingW, NULL, NULL, NULL);
- if (r == ERROR_SUCCESS)
- bWantsForParsing = TRUE;
- else
- bWantsForParsing = FALSE;
- }
-
- if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
- bWantsForParsing)
- {
- /*
- * we need the filesystem path to the destination folder.
- * Only the folder itself can know it
- */
- hr = SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags,
- pszPath,
- MAX_PATH);
- TRACE("CP\n");
- }
- else
- {
- /* parsing name like ::{...} */
- pszPath[0] = ':';
- pszPath[1] = ':';
- SHELL32_GUIDToStringW (*clsid, &pszPath[2]);
- TRACE("CP\n");
- }
- }
- else
- {
- /* user friendly name */
- HCR_GetClassNameW (*clsid, pszPath, MAX_PATH);
- TRACE("CP\n");
- }
- }
- else
- {
- int cLen = 0;
-
- /* file system folder or file rooted at the desktop */
- if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
- (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
- {
- lstrcpynW(pszPath, sPathTarget, MAX_PATH - 1);
- TRACE("CP %s\n", debugstr_w(pszPath));
- }
-
- if (!_ILIsDesktop(pidl))
- {
- PathAddBackslashW(pszPath);
- cLen = wcslen(pszPath);
- _ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
- if (!_ILIsFolder(pidl))
- {
- SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
- TRACE("CP\n");
- }
- }
- }
- }
- else
- {
- /* a complex pidl, let the subfolder do the work */
- hr = SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags,
- pszPath, MAX_PATH);
- TRACE("CP\n");
+ else
+ {
+ hr = E_INVALIDARG;
}
if (SUCCEEDED(hr))
@@ -551,112 +200,48 @@
}
HRESULT WINAPI CMyDocsFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /*
simple pidl */
- LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD
*pPidlOut)
-{
- FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
- debugstr_w (lpName), dwFlags, pPidlOut);
-
- return E_FAIL;
+ LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
+{
+ return m_pisfInner->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
}
HRESULT WINAPI CMyDocsFolder::GetDefaultSearchGUID(GUID *pguid)
{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
-}
-
-HRESULT WINAPI CMyDocsFolder::EnumSearches(IEnumExtraSearch **ppenum)
-{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
+ return m_pisf2Inner->GetDefaultSearchGUID(pguid);
+}
+
+HRESULT WINAPI CMyDocsFolder::EnumSearches(IEnumExtraSearch ** ppenum)
+{
+ return m_pisf2Inner->EnumSearches(ppenum);
}
HRESULT WINAPI CMyDocsFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG
*pDisplay)
{
- TRACE ("(%p)\n", this);
-
- if (pSort)
- *pSort = 0;
- if (pDisplay)
- *pDisplay = 0;
-
- return S_OK;
+ return m_pisf2Inner->GetDefaultColumn(dwRes, pSort, pDisplay);
}
HRESULT WINAPI CMyDocsFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
{
- TRACE ("(%p)\n", this);
-
- if (!pcsFlags || iColumn >= MYDOCUMENTSSHELLVIEWCOLUMNS)
- return E_INVALIDARG;
-
- *pcsFlags = MyDocumentsSFHeader[iColumn].pcsFlags;
-
- return S_OK;
+ return m_pisf2Inner->GetDefaultColumnState(iColumn, pcsFlags);
}
HRESULT WINAPI CMyDocsFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid,
VARIANT *pv)
{
- FIXME ("(%p)\n", this);
-
- return E_NOTIMPL;
+ return m_pisf2Inner->GetDetailsEx(pidl, pscid, pv);
}
HRESULT WINAPI CMyDocsFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn,
SHELLDETAILS *psd)
{
- HRESULT hr = S_OK;
-
- TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
-
- if (!psd || iColumn >= MYDOCUMENTSSHELLVIEWCOLUMNS)
- return E_INVALIDARG;
-
- if (!pidl)
- {
- psd->fmt = MyDocumentsSFHeader[iColumn].fmt;
- psd->cxChar = MyDocumentsSFHeader[iColumn].cxChar;
- psd->str.uType = STRRET_CSTR;
- LoadStringA (shell32_hInstance, MyDocumentsSFHeader[iColumn].colnameid,
- psd->str.cStr, MAX_PATH);
- return S_OK;
- }
-
- /* the data from the pidl */
- psd->str.uType = STRRET_CSTR;
- switch (iColumn)
- {
- case 0: /* name */
- hr = GetDisplayNameOf(pidl,
- SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
- break;
- case 1: /* size */
- _ILGetFileSize (pidl, psd->str.cStr, MAX_PATH);
- break;
- case 2: /* type */
- _ILGetFileType (pidl, psd->str.cStr, MAX_PATH);
- break;
- case 3: /* date */
- _ILGetFileDate (pidl, psd->str.cStr, MAX_PATH);
- break;
- case 4: /* attributes */
- _ILGetFileAttributes (pidl, psd->str.cStr, MAX_PATH);
- break;
- }
-
- return hr;
-}
-
-HRESULT WINAPI CMyDocsFolder::MapColumnToSCID (UINT column, SHCOLUMNID *pscid)
-{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
+ return m_pisf2Inner->GetDetailsOf(pidl, iColumn, psd);
+}
+
+HRESULT WINAPI CMyDocsFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
+{
+ return m_pisf2Inner->MapColumnToSCID(column, pscid);
}
HRESULT WINAPI CMyDocsFolder::GetClassID(CLSID *lpClassId)
{
- static GUID const CLSID_MyDocuments =
- { 0x450d8fba, 0xad25, 0x11d0, {0x98, 0xa8, 0x08, 0x00, 0x36, 0x1b, 0x11, 0x03} };
-
TRACE ("(%p)\n", this);
if (!lpClassId)
@@ -682,26 +267,3 @@
*pidl = ILClone (pidlRoot);
return S_OK;
}
-
-HRESULT WINAPI CMyDocsFolder::DragEnter(IDataObject *pDataObject,
- DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
-{
- return mFSDropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect);
-}
-
-HRESULT WINAPI CMyDocsFolder::DragOver(DWORD dwKeyState, POINTL pt,
- DWORD *pdwEffect)
-{
- return mFSDropTarget->DragOver(dwKeyState, pt, pdwEffect);
-}
-
-HRESULT WINAPI CMyDocsFolder::DragLeave()
-{
- return mFSDropTarget->DragLeave();
-}
-
-HRESULT WINAPI CMyDocsFolder::Drop(IDataObject *pDataObject,
- DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
-{
- return mFSDropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect);
-}
Modified: branches/shell-experiments/dll/win32/shell32/folders/mydocuments.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/mydocuments.h [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/mydocuments.h [iso-8859-1] Tue
Nov 4 11:45:05 2014
@@ -26,14 +26,15 @@
public CComCoClass<CMyDocsFolder, &CLSID_MyDocuments>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IShellFolder2,
- public IPersistFolder2,
- public IDropTarget
+ public IPersistFolder2
{
private:
+ CComPtr<IShellFolder> m_pisfInner;
+ CComPtr<IShellFolder2> m_pisf2Inner;
+
/* both paths are parsible from the MyDocuments */
LPWSTR sPathTarget; /* complete path to target used for enumeration and
ChangeNotify */
LPITEMIDLIST pidlRoot; /* absolute pidl */
- IDropTarget *mFSDropTarget;
public:
CMyDocsFolder();
~CMyDocsFolder();
@@ -69,12 +70,6 @@
// IPersistFolder2
virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
- // IDropTarget
- virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState,
POINTL pt, DWORD *pdwEffect);
- virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
- virtual HRESULT WINAPI DragLeave();
- virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL
pt, DWORD *pdwEffect);
-
DECLARE_REGISTRY_RESOURCEID(IDR_MYDOCUMENTS)
DECLARE_NOT_AGGREGATABLE(CMyDocsFolder)
@@ -86,7 +81,6 @@
COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
- COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
END_COM_MAP()
};