Implemented 'My Documents' folder.

This commit is contained in:
Michael Jung 2005-08-26 10:05:34 +00:00 committed by Alexandre Julliard
parent 93ab695a5c
commit b0b4777422
10 changed files with 72 additions and 17 deletions

View File

@ -9,6 +9,7 @@ folder.ico
folder_open.ico
libshell32.def
mycomputer.ico
mydocs.ico
netdrive.ico
netdrive2.ico
printer.ico

View File

@ -61,6 +61,7 @@ RC_BINARIES = \
folder.ico \
folder_open.ico \
mycomputer.ico \
mydocs.ico \
netdrive.ico \
netdrive2.ico \
printer.ico \

View File

@ -266,7 +266,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
if(IsEqualGUID(riid, &CLSID_MyComputer))
*piIndex = -IDI_SHELL_MY_COMPUTER;
else if(IsEqualGUID(riid, &CLSID_MyDocuments))
*piIndex = -IDI_SHELL_FOLDER;
*piIndex = -IDI_SHELL_MY_DOCUMENTS;
else if(IsEqualGUID(riid, &CLSID_NetworkPlaces))
*piIndex = -IDI_SHELL_MY_NETWORK_PLACES;
else if(IsEqualGUID(riid, &CLSID_UnixFolder) ||

View File

@ -399,7 +399,7 @@ BOOL SIC_Initialize(void)
ImageList_SetBkColor(ShellSmallIconList, CLR_NONE);
ImageList_SetBkColor(ShellBigIconList, CLR_NONE);
for (index=1; index<39; index++)
for (index=1; index<=IDI_SHELL_MY_DOCUMENTS; index++)
{
hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED);

View File

@ -630,6 +630,15 @@ static struct regsvr_coclass const coclass_list[] = {
SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK,
SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR
},
{ &CLSID_MyDocuments,
"My Documents",
NULL,
"shell32.dll",
"Apartment",
SHELLFOLDER_WANTSFORPARSING|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES,
SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER,
SFGAO_FILESYSTEM
},
{ NULL } /* list terminator */
};
@ -646,6 +655,7 @@ static struct regsvr_interface const interface_list[] = {
*/
static const WCHAR wszDesktop[] = { 'D','e','s','k','t','o','p',0 };
static const WCHAR wszSlash[] = { '/', 0 };
static const WCHAR wszMyDocuments[] = { 'M','y',' ','D','o','c','u','m','e','n','t','s', 0 };
static struct regsvr_namespace const namespace_extensions_list[] = {
{
@ -653,6 +663,11 @@ static struct regsvr_namespace const namespace_extensions_list[] = {
wszDesktop,
wszSlash
},
{
&CLSID_MyDocuments,
wszDesktop,
wszMyDocuments
},
{ NULL }
};

View File

@ -95,6 +95,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
extern HRESULT CPanel_GetIconLocationW(LPITEMIDLIST, LPWSTR, UINT, int*);
HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);

View File

@ -74,6 +74,7 @@ struct {
{&CLSID_UnixFolder, &UnixFolder_Constructor},
{&CLSID_UnixDosFolder, &UnixDosFolder_Constructor},
{&CLSID_FolderShortcut, &FolderShortcut_Constructor},
{&CLSID_MyDocuments, &MyDocuments_Constructor},
{NULL,NULL}
};

View File

@ -594,6 +594,9 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_EnumObjects(IShellFolder2* iface,
return hr;
}
static HRESULT CreateUnixFolder(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, DWORD dwPathMode,
const CLSID *pCLSID);
static HRESULT WINAPI UnixFolder_IShellFolder2_BindToObject(IShellFolder2* iface, LPCITEMIDLIST pidl,
LPBC pbcReserved, REFIID riid, void** ppvOut)
{
@ -608,11 +611,8 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_BindToObject(IShellFolder2* iface
if (!pidl || !pidl->mkid.cb)
return E_INVALIDARG;
if (This->m_dwPathMode == PATHMODE_DOS)
hr = UnixDosFolder_Constructor(NULL, &IID_IPersistFolder3, (void**)&persistFolder);
else
hr = UnixFolder_Constructor(NULL, &IID_IPersistFolder3, (void**)&persistFolder);
hr = CreateUnixFolder(NULL, &IID_IPersistFolder3, (void**)&persistFolder, This->m_dwPathMode,
This->m_pCLSID);
if (!SUCCEEDED(hr)) return hr;
hr = IPersistFolder_QueryInterface(persistFolder, riid, (void**)ppvOut);
@ -1109,23 +1109,29 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_Initialize(IPersistFolder3* ifa
/* Find the UnixFolderClass root */
while (current->mkid.cb) {
if (_ILIsSpecialFolder(current) &&
(IsEqualIID(&CLSID_UnixFolder, _ILGetGUIDPointer(current)) ||
IsEqualIID(&CLSID_UnixDosFolder, _ILGetGUIDPointer(current))))
{
if (_ILIsSpecialFolder(current) && IsEqualIID(This->m_pCLSID, _ILGetGUIDPointer(current)))
break;
}
current = ILGetNext(current);
}
if (current && current->mkid.cb) {
if (IsEqualIID(&CLSID_MyDocuments, _ILGetGUIDPointer(current))) {
WCHAR wszMyDocumentsPath[MAX_PATH];
if (!SHGetSpecialFolderPathW(0, wszMyDocumentsPath, CSIDL_PERSONAL, FALSE))
return E_FAIL;
PathAddBackslashW(wszMyDocumentsPath);
if (!UNIXFS_get_unix_path(wszMyDocumentsPath, szBasePath))
return E_FAIL;
dwPathLen = strlen(szBasePath) + 1;
} else {
dwPathLen = 2; /* For the '/' prefix and the terminating '\0' */
}
root = current = ILGetNext(current);
dwPathLen = 2; /* For the '/' prefix and the terminating '\0' */
} else if (_ILIsDesktop(pidl) || _ILIsValue(pidl) || _ILIsFolder(pidl)) {
/* Path rooted at Desktop */
WCHAR wszDesktopPath[MAX_PATH];
if (FAILED(SHGetSpecialFolderPathW(0, wszDesktopPath, CSIDL_DESKTOP, FALSE)))
return E_FAIL;
if (!SHGetSpecialFolderPathW(0, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE))
return E_FAIL;
PathAddBackslashW(wszDesktopPath);
if (!UNIXFS_get_unix_path(wszDesktopPath, szBasePath))
return E_FAIL;
@ -1154,7 +1160,7 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_Initialize(IPersistFolder3* ifa
current = root;
strcpy(pNextDir, szBasePath);
pNextDir += strlen(szBasePath);
if (This->m_dwPathMode == PATHMODE_UNIX)
if (This->m_dwPathMode == PATHMODE_UNIX || IsEqualCLSID(&CLSID_MyDocuments, This->m_pCLSID))
This->m_dwAttributes |= SFGAO_FILESYSTEM;
if (!(This->m_dwAttributes & SFGAO_FILESYSTEM)) {
*pNextDir = '\0';
@ -1550,6 +1556,11 @@ HRESULT WINAPI FolderShortcut_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVO
return CreateUnixFolder(pUnkOuter, riid, ppv, PATHMODE_DOS, &CLSID_FolderShortcut);
}
HRESULT WINAPI MyDocuments_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv) {
TRACE("(pUnkOuter=%p, riid=%p, ppv=%p)\n", pUnkOuter, riid, ppv);
return CreateUnixFolder(pUnkOuter, riid, ppv, PATHMODE_DOS, &CLSID_MyDocuments);
}
/******************************************************************************
* UnixSubFolderIterator
*

View File

@ -10291,6 +10291,30 @@ IDI_SHELL_DESKTOP ICON desktop.ico
'FF FF FF FF FF FF'
} */
/* BINRES mydocs.ico */
IDI_SHELL_MY_DOCUMENTS ICON mydocs.ico
/* {
'00 00 01 00 01 00 10 10 10 00 01 00 04 00 28 01'
'00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00'
'00 00 01 00 04 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 99 99 00 66 CC CC 00 99 CC FF 00 99 FF'
'FF 00 F8 F8 F8 00 FF FF FF 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 11 11 11 11 11 11 00 00 15'
'34 34 33 33 21 00 01 54 43 43 43 33 20 10 01 54'
'44 44 34 33 10 10 15 44 44 34 43 42 00 20 15 44'
'44 44 34 32 06 00 11 11 11 11 11 11 46 60 01 54'
'06 66 66 66 66 00 01 54 40 66 66 65 50 20 01 54'
'44 06 56 66 01 10 00 15 55 50 66 60 00 00 00 01'
'11 11 06 00 00 00 00 00 00 00 00 00 00 00 FF FF'
'00 00 FF FF 00 00 E0 00 00 00 C0 00 00 00 C0 00'
'00 00 80 00 00 00 80 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 80 00 00 00 80 00 00 00 80 01'
'00 00 C0 0F 00 00 E0 1F 00 00 FF BF 00 00'
} */
/*--------------------- END FIXME ------------------------*/

View File

@ -117,5 +117,6 @@
#define IDI_SHELL_CONTROL_PANEL 36
#define IDI_SHELL_PRINTERS_FOLDER 38
#define IDI_SHELL_FONTS_FOLDER 39
#define IDI_SHELL_MY_DOCUMENTS 235
#endif