Skip to content
This repository has been archived by the owner on Mar 4, 2025. It is now read-only.

Have WFSetAttr refresh tree #414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/wfcomman.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,45 @@ ChangeFileSystem(

dwFSCOperation = FSC_Operation(dwFunction);

// Check if an attribute change refers to a directory. If it does, the
// tree views might want to remove it or insert it based on its new
// hidden/system attributes
if (dwFSCOperation == FSC_ATTRIBUTES)
{
DWORD dwFileAttribs;
DWORD dwFilterAttribs;

dwFileAttribs = GetFileAttributes(szFrom);
if (dwFileAttribs != INVALID_FILE_ATTRIBUTES &&
(dwFileAttribs & ATTR_DIR) != 0)
{

/* Update the tree. */
for (hwnd = GetWindow(hwndMDIClient, GW_CHILD);
hwnd != NULL;
hwnd = GetWindow(hwnd, GW_HWNDNEXT))
{
dwFilterAttribs = (DWORD)GetWindowLongPtr(hwnd, GWL_ATTRIBS);

// If the view is hiding hidden/system, perform an insert or
// remove based on whether the new attributes include
// hidden/system or not.
if ((dwFilterAttribs & ATTR_HS) == 0 &&
(hwndTree = HasTreeWindow(hwnd)))
{
if ((dwFileAttribs & ATTR_HS) == 0)
{
SendMessage(hwndTree, WM_FSC, FSC_MKDIR | FSC_QUIET, (LPARAM)szFrom);
}
else
{
SendMessage(hwndTree, WM_FSC, FSC_RMDIR | FSC_QUIET, (LPARAM)szFrom);
}
}
}
}
}

switch (dwFSCOperation)
{
case ( FSC_RENAME ) :
Expand Down
2 changes: 1 addition & 1 deletion src/winfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ INT atoiW(LPWSTR sz);
#define UNDELETE_ENTRYW "UndeleteFileW"

#define FILE_NOTIFY_CHANGE_FLAGS (FILE_NOTIFY_CHANGE_FILE_NAME | \
FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_SIZE)
FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_ATTRIBUTES)

#define DwordAlign(cb) (((cb) + 3) & ~3)
#define ISDOTDIR(x) (x[0]==CHAR_DOT && (!x[1] || (x[1] == CHAR_DOT && !x[2])))
Expand Down