mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Changed shell namespacew sort order to file name instead of displayed name
svn path=/trunk/; revision=6196
This commit is contained in:
parent
6ef5b3b5fb
commit
550fd767cd
7 changed files with 34 additions and 16 deletions
|
@ -45,6 +45,7 @@ Entry::Entry(ENTRY_TYPE etype)
|
|||
_bhfi_valid = false;
|
||||
_level = 0;
|
||||
_hIcon = 0;
|
||||
_display_name = _data.cFileName;
|
||||
}
|
||||
|
||||
Entry::Entry(Entry* parent)
|
||||
|
@ -58,6 +59,7 @@ Entry::Entry(Entry* parent)
|
|||
_bhfi_valid = false;
|
||||
_level = 0;
|
||||
_hIcon = 0;
|
||||
_display_name = _data.cFileName;
|
||||
}
|
||||
|
||||
// free a directory entry
|
||||
|
@ -65,6 +67,9 @@ Entry::~Entry()
|
|||
{
|
||||
if (_hIcon && _hIcon!=(HICON)-1)
|
||||
DestroyIcon(_hIcon);
|
||||
|
||||
if (_display_name != _data.cFileName)
|
||||
free(_display_name);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
WIN32_FIND_DATA _data;
|
||||
|
||||
SFGAOF _shell_attribs;
|
||||
LPTSTR _display_name;
|
||||
|
||||
ENTRY_TYPE _etype;
|
||||
HICON _hIcon;
|
||||
|
|
|
@ -407,10 +407,10 @@ void FileChildWindow::activate_entry(Pane* pane, HWND hwnd)
|
|||
if (!scanned_old)
|
||||
scan_entry(entry, hwnd);
|
||||
|
||||
if (entry->_data.cFileName[0]=='.' && entry->_data.cFileName[1]=='\0')
|
||||
if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('\0'))
|
||||
return;
|
||||
|
||||
if (entry->_data.cFileName[0]=='.' && entry->_data.cFileName[1]=='.' && entry->_data.cFileName[2]=='\0') {
|
||||
if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')) {
|
||||
entry = _left->_cur->_up;
|
||||
collapse_entry(_left, entry);
|
||||
goto focus_entry;
|
||||
|
|
|
@ -353,7 +353,7 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
|
|||
else
|
||||
img = IMG_FOLDER;
|
||||
} else {
|
||||
LPCTSTR ext = _tcsrchr(entry->_data.cFileName, '.');
|
||||
LPCTSTR ext = _tcsrchr(entry->_data.cFileName, TEXT('.'));
|
||||
if (!ext)
|
||||
ext = TEXT("");
|
||||
|
||||
|
@ -498,9 +498,9 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
|
|||
|
||||
// ouput file name
|
||||
if (calcWidthCol == -1)
|
||||
_out_wrkr.output_text(dis, _positions, col, entry->_data.cFileName, 0);
|
||||
_out_wrkr.output_text(dis, _positions, col, entry->_display_name, 0);
|
||||
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
|
||||
calc_width(dis, col, entry->_data.cFileName);
|
||||
calc_width(dis, col, entry->_display_name);
|
||||
|
||||
++col;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs)
|
|||
|
||||
ClientRect rect(_hwnd);
|
||||
|
||||
SHFILEINFO sfi;
|
||||
SHFILEINFO sfi;
|
||||
|
||||
_himlSmall = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
|
||||
// _himlLarge = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
|
||||
|
@ -276,18 +276,21 @@ void ShellBrowserChild::OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh)
|
|||
LPNMTVDISPINFO lpdi = (LPNMTVDISPINFO)pnmh;
|
||||
ShellEntry* entry = (ShellEntry*)lpdi->item.lParam;
|
||||
|
||||
if (lpdi->item.mask & TVIF_TEXT) {
|
||||
/* if (SHGetFileInfo((LPCTSTR)&*entry->_pidl, 0, &sfi, sizeof(sfi), SHGFI_PIDL|SHGFI_DISPLAYNAME))
|
||||
lstrcpy(lpdi->item.pszText, sfi.szDisplayName); */
|
||||
lstrcpy(lpdi->item.pszText, entry->_data.cFileName);
|
||||
}
|
||||
if (lpdi->item.mask & TVIF_TEXT)
|
||||
lpdi->item.pszText = entry->_display_name;
|
||||
|
||||
if (lpdi->item.mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) {
|
||||
if (lpdi->item.mask & (/*TVIF_TEXT|*/TVIF_IMAGE|TVIF_SELECTEDIMAGE)) {
|
||||
ShellPath pidl_abs = entry->create_absolute_pidl(); // Caching of absolute PIDLs could enhance performance.
|
||||
LPCITEMIDLIST pidl = pidl_abs;
|
||||
|
||||
SHFILEINFO sfi;
|
||||
|
||||
/*
|
||||
if (lpdi->item.mask & TVIF_TEXT)
|
||||
if (SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_PIDL|SHGFI_DISPLAYNAME))
|
||||
lstrcpy(lpdi->item.pszText, sfi.szDisplayName); //TODO: look at cchTextMax if there is enough space available
|
||||
else
|
||||
lpdi->item.pszText = entry->_data.cFileName;
|
||||
*/
|
||||
if (lpdi->item.mask & TVIF_IMAGE)
|
||||
if ((HIMAGELIST)SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_PIDL|SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_LINKOVERLAY) == _himlSmall)
|
||||
lpdi->item.iImage = sfi.iIcon;
|
||||
|
@ -311,6 +314,8 @@ void ShellBrowserChild::OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv)
|
|||
|
||||
if (entry)
|
||||
if (!InsertSubitems(pnmtv->itemNew.hItem, entry, entry->_folder)) {
|
||||
entry->_shell_attribs &= ~SFGAO_HASSUBFOLDER;
|
||||
|
||||
// remove subitem "+"
|
||||
TV_ITEM tvItem;
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
|
|||
LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
|
||||
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
|
||||
// fill out drive names "C:", ...
|
||||
_tcscpy(pw32fdata->cFileName, path);
|
||||
|
||||
if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) {
|
||||
pw32fdata->dwFileAttributes = fad.dwFileAttributes;
|
||||
pw32fdata->ftCreationTime = fad.ftCreationTime;
|
||||
|
@ -281,8 +284,12 @@ void ShellDirectory::read_directory()
|
|||
if (bhfi_valid)
|
||||
memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION));
|
||||
|
||||
if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/)))
|
||||
_tcscpy(entry->_data.cFileName, name);
|
||||
if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) {
|
||||
if (!entry->_data.cFileName[0])
|
||||
_tcscpy(entry->_data.cFileName, name);
|
||||
else if (_tcscmp(entry->_display_name, name))
|
||||
entry->_display_name = _tcsdup(name); // store display name separate from file name; sort display by file name
|
||||
}
|
||||
|
||||
// get display icons for files and virtual objects
|
||||
if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
|
||||
|
|
|
@ -298,7 +298,7 @@ StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, const ShellEntry*
|
|||
for(ShellEntryMap::iterator it=_entries.begin(); it!=_entries.end(); ++it) {
|
||||
StartMenuEntry& sme = it->second;
|
||||
|
||||
if (sme._title == entry_name)
|
||||
if (sme._title == entry_name) //TODO: speed up by using a map indexed by name
|
||||
for(ShellEntrySet::iterator it2=sme._entries.begin(); it2!=sme._entries.end(); ++it2) {
|
||||
if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
// merge the new shell entry with the existing of the same name
|
||||
|
|
Loading…
Reference in a new issue