diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-08-17 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:00 +0300 |
commit | c99f3ebdd639c2adb03d8b44001b10af18516504 (patch) | |
tree | 92aaf34e5edbd7287c3f55037190da75ab0a8000 /CPP/7zip/UI/FileManager/RootFolder.cpp | |
parent | 829409452d85cd6dd9dfc9151f109d6e13a2bb1c (diff) |
9.06 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager/RootFolder.cpp')
-rwxr-xr-x | CPP/7zip/UI/FileManager/RootFolder.cpp | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/CPP/7zip/UI/FileManager/RootFolder.cpp b/CPP/7zip/UI/FileManager/RootFolder.cpp index ea6f5080..1f4886d2 100755 --- a/CPP/7zip/UI/FileManager/RootFolder.cpp +++ b/CPP/7zip/UI/FileManager/RootFolder.cpp @@ -4,14 +4,17 @@ #include "Common/StringConvert.h" +#include "Windows/DLL.h" #include "Windows/PropVariant.h" #include "../../PropID.h" -#include "FSDrives.h" #include "FSFolder.h" #include "LangUtils.h" +#ifndef UNDER_CE #include "NetFolder.h" +#include "FSDrives.h" +#endif #include "RootFolder.h" #include "SysIconUtils.h" @@ -26,7 +29,11 @@ static const STATPROPSTG kProps[] = UString RootFolder_GetName_Computer(int &iconIndex) { + #ifdef UNDER_CE + GetRealIconIndex(L"\\", FILE_ATTRIBUTE_DIRECTORY, iconIndex); + #else iconIndex = GetIconIndexForCSIDL(CSIDL_DRIVES); + #endif return LangString(IDS_COMPUTER, 0x03020300); } @@ -42,20 +49,29 @@ UString RootFolder_GetName_Documents(int &iconIndex) return LangString(IDS_DOCUMENTS, 0x03020302); ; } -const int ROOT_INDEX_COMPUTER = 0; -const int ROOT_INDEX_DOCUMENTS = 1; -const int ROOT_INDEX_NETWORK = 2; -const int ROOT_INDEX_VOLUMES = 3; +enum +{ + ROOT_INDEX_COMPUTER = 0 + #ifndef UNDER_CE + , ROOT_INDEX_DOCUMENTS + , ROOT_INDEX_NETWORK + , ROOT_INDEX_VOLUMES + #endif +}; -static const wchar_t *kVolPrefix = L"\\\\.\\"; +#ifndef UNDER_CE +static const wchar_t *kVolPrefix = L"\\\\."; +#endif void CRootFolder::Init() { _names[ROOT_INDEX_COMPUTER] = RootFolder_GetName_Computer(_iconIndices[ROOT_INDEX_COMPUTER]); + #ifndef UNDER_CE _names[ROOT_INDEX_DOCUMENTS] = RootFolder_GetName_Documents(_iconIndices[ROOT_INDEX_DOCUMENTS]); _names[ROOT_INDEX_NETWORK] = RootFolder_GetName_Network(_iconIndices[ROOT_INDEX_NETWORK]); _names[ROOT_INDEX_VOLUMES] = kVolPrefix; _iconIndices[ROOT_INDEX_VOLUMES] = GetIconIndexForCSIDL(CSIDL_DRIVES); + #endif }; STDMETHODIMP CRootFolder::LoadItems() @@ -90,7 +106,11 @@ UString GetMyDocsPath() UString us; WCHAR s[MAX_PATH + 1]; SHGetSpecialFolderPathWp getW = (SHGetSpecialFolderPathWp) - ::GetProcAddress(::GetModuleHandleA("shell32.dll"), "SHGetSpecialFolderPathW"); + #ifdef UNDER_CE + My_GetProcAddress(GetModuleHandle(TEXT("coredll.dll")), "SHGetSpecialFolderPath"); + #else + My_GetProcAddress(GetModuleHandle(TEXT("shell32.dll")), "SHGetSpecialFolderPathW"); + #endif if (getW && getW(0, s, CSIDL_PERSONAL, FALSE)) us = s; #ifndef _UNICODE @@ -112,6 +132,14 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde { *resultFolder = NULL; CMyComPtr<IFolderFolder> subFolder; + #ifdef UNDER_CE + if (index == ROOT_INDEX_COMPUTER) + { + NFsFolder::CFSFolder *fsFolder = new NFsFolder::CFSFolder; + subFolder = fsFolder; + fsFolder->InitToRoot(); + } + #else if (index == ROOT_INDEX_COMPUTER || index == ROOT_INDEX_VOLUMES) { CFSDrives *fsDrivesSpec = new CFSDrives; @@ -134,6 +162,7 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde RINOK(fsFolderSpec->Init(s, NULL)); } } + #endif else return E_INVALIDARG; *resultFolder = subFolder.Detach(); @@ -161,9 +190,14 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu for (int i = 0; i < kNumRootFolderItems; i++) if (AreEqualNames(name2, _names[i])) return BindToFolder((UInt32)i, resultFolder); + #ifdef UNDER_CE + if (name2 == L"\\") + return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder); + #else if (AreEqualNames(name2, L"My Documents") || AreEqualNames(name2, L"Documents")) return BindToFolder((UInt32)ROOT_INDEX_DOCUMENTS, resultFolder); + #endif if (AreEqualNames(name2, L"My Computer") || AreEqualNames(name2, L"Computer")) return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder); @@ -179,6 +213,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu CMyComPtr<IFolderFolder> subFolder; + #ifndef UNDER_CE if (name2.Left(4) == kVolPrefix) { CFSDrives *folderSpec = new CFSDrives; @@ -186,6 +221,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu folderSpec->Init(true); } else + #endif { if (name2[name2.Length () - 1] != WCHAR_PATH_SEPARATOR) name2 += WCHAR_PATH_SEPARATOR; @@ -193,6 +229,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu subFolder = fsFolderSpec; if (fsFolderSpec->Init(name2, 0) != S_OK) { + #ifndef UNDER_CE if (name2[0] == WCHAR_PATH_SEPARATOR) { CNetFolder *netFolderSpec = new CNetFolder; @@ -200,6 +237,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu netFolderSpec->Init(name2); } else + #endif return E_INVALIDARG; } } |