mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 16:35:49 +00:00
ShellBrowserChild: jump to addressbar target
svn path=/trunk/; revision=9117
This commit is contained in:
parent
77fbf2134e
commit
bdf792d41a
3 changed files with 53 additions and 30 deletions
|
@ -664,6 +664,7 @@ String FileChildWindow::jump_to_int(LPCTSTR url)
|
|||
if (SplitFileSysURL(url, dir, fname)) {
|
||||
Entry* entry = NULL;
|
||||
|
||||
// call read_tree() to iterate through the hierarchy and open all folders to reach dir
|
||||
if (_root._entry)
|
||||
switch(_root._entry->_etype) {
|
||||
case ET_SHELL: { //@@ separate into FileChildWindow in ShellChildWindow, WinChildWindow, UnixChildWindow ?
|
||||
|
@ -672,27 +673,24 @@ String FileChildWindow::jump_to_int(LPCTSTR url)
|
|||
break;}
|
||||
|
||||
#ifdef __WINE__
|
||||
case ET_UNIX:
|
||||
{
|
||||
case ET_UNIX: {
|
||||
LPCTSTR path = dir;
|
||||
|
||||
if (!_tcsicmp(path, _root._path, _tcslen(_root._path)))
|
||||
path += _tcslen(_root._path);
|
||||
|
||||
entry = _root.read_tree(path);
|
||||
}
|
||||
break;
|
||||
break;}
|
||||
#endif
|
||||
|
||||
default: // ET_UNIX, ET_NTOBJS, ET_REGISTRY, ET_FAT, ET_WINDOWS
|
||||
{
|
||||
default: { // ET_NTOBJS, ET_REGISTRY, ET_FAT, ET_WINDOWS
|
||||
LPCTSTR path = dir;
|
||||
|
||||
if (!_tcsnicmp(path, _root._path, _tcslen(_root._path)))
|
||||
path += _tcslen(_root._path);
|
||||
|
||||
entry = _root.read_tree(path);
|
||||
}
|
||||
break;}
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
|
@ -722,6 +720,8 @@ String FileChildWindow::jump_to_int(LPCTSTR url)
|
|||
}
|
||||
}
|
||||
|
||||
///@todo use fname
|
||||
|
||||
return dir; //FmtString(TEXT("file://%s"), (LPCTSTR)dir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,9 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs)
|
|||
_hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0);
|
||||
|
||||
if (_left_hwnd) {
|
||||
TreeView_SetImageList(_left_hwnd, _himlSmall, TVSIL_NORMAL);
|
||||
TreeView_SetScrollTime(_left_hwnd, 100);
|
||||
|
||||
InitializeTree();
|
||||
|
||||
InitDragDrop();
|
||||
|
@ -121,9 +124,6 @@ void ShellBrowserChild::InitializeTree()
|
|||
{
|
||||
CONTEXT("ShellBrowserChild::InitializeTree()");
|
||||
|
||||
TreeView_SetImageList(_left_hwnd, _himlSmall, TVSIL_NORMAL);
|
||||
TreeView_SetScrollTime(_left_hwnd, 100);
|
||||
|
||||
TV_INSERTSTRUCT tvInsert;
|
||||
|
||||
tvInsert.hParent = 0;
|
||||
|
@ -477,7 +477,7 @@ HRESULT ShellBrowserChild::OnDefaultCommand(LPIDA pida)
|
|||
|
||||
if (entry && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
|
||||
if (entry->_etype == ET_SHELL)
|
||||
if (expand_folder(static_cast<ShellDirectory*>(entry)))
|
||||
if (_last_sel && select_entry(_last_sel, entry))
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
@ -496,28 +496,27 @@ HRESULT ShellBrowserChild::OnDefaultCommand(LPIDA pida)
|
|||
}
|
||||
|
||||
|
||||
bool ShellBrowserChild::expand_folder(ShellDirectory* entry)
|
||||
HTREEITEM ShellBrowserChild::select_entry(HTREEITEM hitem, Entry* entry, bool expand)
|
||||
{
|
||||
CONTEXT("ShellBrowserChild::expand_folder()");
|
||||
CONTEXT("ShellBrowserChild::select_entry()");
|
||||
|
||||
//HTREEITEM hitem_sel = TreeView_GetSelection(_left_hwnd);
|
||||
if (!_last_sel)
|
||||
return false;
|
||||
if (expand && !TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND))
|
||||
return 0;
|
||||
|
||||
if (!TreeView_Expand(_left_hwnd, _last_sel, TVE_EXPAND))
|
||||
return false;
|
||||
for(hitem=TreeView_GetChild(_left_hwnd,hitem); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) {
|
||||
if ((Entry*)TreeView_GetItemData(_left_hwnd,hitem) == entry) {
|
||||
if (TreeView_SelectItem(_left_hwnd, hitem)) {
|
||||
if (expand)
|
||||
TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND);
|
||||
|
||||
for(HTREEITEM hitem=TreeView_GetChild(_left_hwnd,_last_sel); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) {
|
||||
if ((ShellDirectory*)TreeView_GetItemData(_left_hwnd,hitem) == entry) {
|
||||
if (TreeView_SelectItem(_left_hwnd, hitem) &&
|
||||
TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND))
|
||||
return true;
|
||||
return hitem;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,9 +529,13 @@ String ShellBrowserChild::jump_to_int(LPCTSTR url)
|
|||
return url;
|
||||
}
|
||||
|
||||
if (SplitFileSysURL(url, dir, fname))
|
||||
if (SplitFileSysURL(url, dir, fname)) {
|
||||
|
||||
///@todo use fname
|
||||
|
||||
if (jump_to_pidl(ShellPath(dir)))
|
||||
return FmtString(TEXT("file://%s"), (LPCTSTR)dir);
|
||||
}
|
||||
|
||||
return String();
|
||||
}
|
||||
|
@ -540,11 +543,31 @@ String ShellBrowserChild::jump_to_int(LPCTSTR url)
|
|||
|
||||
bool ShellBrowserChild::jump_to_pidl(LPCITEMIDLIST pidl)
|
||||
{
|
||||
if (!_root._entry)
|
||||
return false;
|
||||
|
||||
/*@todo
|
||||
we should call read_tree() here to iterate through the hierarchy and open all folders from shell_info._root_shell_path to shell_info._shell_path
|
||||
-> see FileChildWindow::FileChildWindow()
|
||||
*/
|
||||
// iterate through the hierarchy and open all folders to reach pidl
|
||||
WaitCursor wait;
|
||||
|
||||
HTREEITEM hitem = TreeView_GetRoot(_left_hwnd);
|
||||
Entry* entry = _root._entry;
|
||||
|
||||
for(const void*p=pidl;;) {
|
||||
if (!p)
|
||||
return true;
|
||||
|
||||
if (!entry || !hitem)
|
||||
break;
|
||||
|
||||
entry->smart_scan(SORT_NAME);
|
||||
|
||||
Entry* found = entry->find_entry(p);
|
||||
p = entry->get_next_path_component(p);
|
||||
|
||||
hitem = select_entry(hitem, found);
|
||||
|
||||
entry = found;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -135,5 +135,5 @@ protected:
|
|||
|
||||
void UpdateFolderView(IShellFolder* folder);
|
||||
void Tree_DoItemMenu(HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen);
|
||||
bool expand_folder(ShellDirectory* entry);
|
||||
HTREEITEM select_entry(HTREEITEM hitem, Entry* entry, bool expand=true);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue