HRESULT DesktopWindow::OnDefaultCommand(LPIDA pIDList)
{
- if (MainFrame::OpenShellFolders(pIDList))
+ if (MainFrame::OpenShellFolders(pIDList, 0))
return S_OK;
return E_NOTIMPL;
//
#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
SOURCE=.\Makefile.MinGW
# End Source File
+# Begin Source File
+
+SOURCE=.\Makefile.Wine
+# End Source File
# End Target
# End Project
}
-int MainFrame::OpenShellFolders(LPIDA pIDList)
+int MainFrame::OpenShellFolders(LPIDA pIDList, HWND hFrameWnd)
{
int cnt = 0;
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);
}
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);
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 {
TreeView_InsertItem(_left_hwnd, &tvInsert);
}
+
+ ++cnt;
}
SendMessage(_left_hwnd, WM_SETREDRAW, TRUE, 0);
+
+ return cnt;
}
void ShellBrowserChild::OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv)
}
}
} 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;
+*/
}
}
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);
#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;
}
}
- 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;
ShellItemEnumerator enumerator(_folder, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREABLE|SHCONTF_STORAGE);
+ TCHAR name[MAX_PATH];
HRESULT hr_next = S_OK;
do {
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)
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) ||
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);
};