mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
* open MDI cabinet folders instead of new mainframe windows
* avoid accessing floppy drive when browsing "My Computer" svn path=/trunk/; revision=6193
This commit is contained in:
parent
99bf2fc3b8
commit
0ddc55f416
9 changed files with 64 additions and 22 deletions
|
@ -267,7 +267,7 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
|
||||
HRESULT DesktopWindow::OnDefaultCommand(LPIDA pIDList)
|
||||
{
|
||||
if (MainFrame::OpenShellFolders(pIDList))
|
||||
if (MainFrame::OpenShellFolders(pIDList, 0))
|
||||
return S_OK;
|
||||
|
||||
return E_NOTIMPL;
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_RESOURCE_VALUE 133
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
|
|
@ -143,5 +143,9 @@ SOURCE=.\makefile
|
|||
|
||||
SOURCE=.\Makefile.MinGW
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Makefile.Wine
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
@ -211,7 +211,7 @@ ChildWindow* MainFrame::CreateChild(LPCITEMIDLIST pidl, int mode)
|
|||
}
|
||||
|
||||
|
||||
int MainFrame::OpenShellFolders(LPIDA pIDList)
|
||||
int MainFrame::OpenShellFolders(LPIDA pIDList, HWND hFrameWnd)
|
||||
{
|
||||
int cnt = 0;
|
||||
|
||||
|
@ -226,8 +226,15 @@ int MainFrame::OpenShellFolders(LPIDA pIDList)
|
|||
|
||||
if (SUCCEEDED(hr) && (attribs&SFGAO_FOLDER))
|
||||
try {
|
||||
if (MainFrame::Create(ShellPath(pidl).create_absolute_pidl(parent_pidl), FALSE))
|
||||
++cnt;
|
||||
ShellPath pidl_abs = ShellPath(pidl).create_absolute_pidl(parent_pidl);
|
||||
|
||||
if (hFrameWnd) {
|
||||
if (SendMessage(hFrameWnd, PM_OPEN_WINDOW, OWM_PIDL, (LPARAM)(LPCITEMIDLIST)pidl_abs))
|
||||
++cnt;
|
||||
} else {
|
||||
if (MainFrame::Create(pidl_abs, 0))
|
||||
++cnt;
|
||||
}
|
||||
} catch(COMException& e) {
|
||||
HandleException(e, g_Globals._hMainWnd);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ struct MainFrame : public PreTranslateWindow
|
|||
static HWND Create();
|
||||
static HWND Create(LPCTSTR path, int mode=OWM_EXPLORE|OWM_DETAILS);
|
||||
static HWND Create(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
|
||||
static int OpenShellFolders(LPIDA pIDList);
|
||||
static int OpenShellFolders(LPIDA pIDList, HWND hFrameWnd);
|
||||
|
||||
ChildWindow* CreateChild(LPCTSTR path=NULL, int mode=OWM_EXPLORE|OWM_DETAILS);
|
||||
ChildWindow* CreateChild(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
|
||||
|
|
|
@ -310,14 +310,25 @@ void ShellBrowserChild::OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv)
|
|||
ShellDirectory* entry = (ShellDirectory*)TreeView_GetItemData(_left_hwnd, pnmtv->itemNew.hItem);
|
||||
|
||||
if (entry)
|
||||
InsertSubitems(pnmtv->itemNew.hItem, entry, entry->_folder);
|
||||
if (!InsertSubitems(pnmtv->itemNew.hItem, entry, entry->_folder)) {
|
||||
// remove subitem "+"
|
||||
TV_ITEM tvItem;
|
||||
|
||||
tvItem.mask = TVIF_CHILDREN;
|
||||
tvItem.hItem = pnmtv->itemNew.hItem;
|
||||
tvItem.cChildren = 0;
|
||||
|
||||
TreeView_SetItem(_left_hwnd, &tvItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShellBrowserChild::InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder)
|
||||
int ShellBrowserChild::InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder)
|
||||
{
|
||||
WaitCursor wait;
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
SendMessage(_left_hwnd, WM_SETREDRAW, FALSE, 0);
|
||||
|
||||
try {
|
||||
|
@ -354,9 +365,13 @@ void ShellBrowserChild::InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShe
|
|||
|
||||
TreeView_InsertItem(_left_hwnd, &tvInsert);
|
||||
}
|
||||
|
||||
++cnt;
|
||||
}
|
||||
|
||||
SendMessage(_left_hwnd, WM_SETREDRAW, TRUE, 0);
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void ShellBrowserChild::OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv)
|
||||
|
@ -470,8 +485,13 @@ HRESULT ShellBrowserChild::OnDefaultCommand(LPIDA pIDList)
|
|||
}
|
||||
}
|
||||
} else { // no tree control
|
||||
if (MainFrame::OpenShellFolders(pIDList))
|
||||
if (MainFrame::OpenShellFolders(pIDList, _hWndFrame))
|
||||
return S_OK;
|
||||
|
||||
/* create new Frame Window
|
||||
if (MainFrame::OpenShellFolders(pIDList, 0))
|
||||
return S_OK;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ protected:
|
|||
|
||||
LRESULT Init(LPCREATESTRUCT);
|
||||
void InitializeTree(/*const FileChildWndInfo& info*/);
|
||||
void InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder);
|
||||
int InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder);
|
||||
bool InitDragDrop();
|
||||
|
||||
HRESULT OnDefaultCommand(LPIDA pIDList);
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
#include "shellfs.h"
|
||||
|
||||
|
||||
bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA* pw32fdata, BY_HANDLE_FILE_INFORMATION* pbhfi)
|
||||
bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA* pw32fdata, BY_HANDLE_FILE_INFORMATION* pbhfi, bool access)
|
||||
{
|
||||
bool bhfi_valid = false;
|
||||
|
||||
if (!( (attribs & SFGAO_FILESYSTEM) && SUCCEEDED(
|
||||
if (access && !( (attribs & SFGAO_FILESYSTEM) && SUCCEEDED(
|
||||
SHGetDataFromIDList(_folder, pidl, SHGDFIL_FINDDATA, pw32fdata, sizeof(WIN32_FIND_DATA))) )) {
|
||||
WIN32_FILE_ATTRIBUTE_DATA fad;
|
||||
IDataObject* pDataObj;
|
||||
|
@ -88,7 +88,7 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
|
|||
}
|
||||
}
|
||||
|
||||
if (!(attribs & SFGAO_FILESYSTEM)) // Archiv files should not be displayed as folders in explorer view.
|
||||
if (!(attribs & SFGAO_FILESYSTEM) || !access) // Archiv files should not be displayed as folders in explorer view.
|
||||
if (attribs & (SFGAO_FOLDER|SFGAO_HASSUBFOLDER))
|
||||
pw32fdata->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
|
||||
|
@ -213,6 +213,7 @@ void ShellDirectory::read_directory()
|
|||
|
||||
ShellItemEnumerator enumerator(_folder, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREABLE|SHCONTF_STORAGE);
|
||||
|
||||
TCHAR name[MAX_PATH];
|
||||
HRESULT hr_next = S_OK;
|
||||
|
||||
do {
|
||||
|
@ -239,17 +240,27 @@ void ShellDirectory::read_directory()
|
|||
|
||||
memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
|
||||
|
||||
SFGAOF attribs = ~SFGAO_FILESYSTEM; //SFGAO_HASSUBFOLDER|SFGAO_FOLDER; SFGAO_FILESYSTEM sorgt dafür, daß "My Documents" anstatt von "Martin's Documents" angezeigt wird
|
||||
SFGAOF attribs_before = ~SFGAO_READONLY&~SFGAO_VALIDATE;
|
||||
SFGAOF attribs = attribs_before;
|
||||
HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (attribs != (SFGAOF)~SFGAO_FILESYSTEM)
|
||||
bhfi_valid = fill_w32fdata_shell(pidls[n], attribs, &w32fd, &bhfi);
|
||||
else
|
||||
attribs = 0;
|
||||
if (SUCCEEDED(hr) && attribs!=attribs_before) {
|
||||
// avoid accessing floppy drives when browsing "My Computer"
|
||||
if (attribs & SFGAO_REMOVABLE)
|
||||
attribs |= SFGAO_HASSUBFOLDER;
|
||||
else {
|
||||
DWORD attribs2 = SFGAO_READONLY;
|
||||
|
||||
HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs2);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
attribs |= attribs2;
|
||||
}
|
||||
} else
|
||||
attribs = 0;
|
||||
|
||||
bhfi_valid = fill_w32fdata_shell(pidls[n], attribs, &w32fd, &bhfi, !(attribs&SFGAO_REMOVABLE));
|
||||
|
||||
Entry* entry;
|
||||
|
||||
if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
|
@ -268,8 +279,8 @@ void ShellDirectory::read_directory()
|
|||
if (bhfi_valid)
|
||||
memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION));
|
||||
|
||||
if (!entry->_data.cFileName[0])
|
||||
/*hr = */name_from_pidl(_folder, pidls[n], entry->_data.cFileName, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/);
|
||||
if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/)))
|
||||
_tcscpy(entry->_data.cFileName, name);
|
||||
|
||||
// get display icons for files and virtual objects
|
||||
if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
|
||||
|
|
|
@ -103,7 +103,7 @@ struct ShellDirectory : public ShellEntry, public Directory
|
|||
HWND _hwnd;
|
||||
|
||||
protected:
|
||||
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*);
|
||||
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*, bool access=true);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue