From 2948d9339597f89a03d3f91a71b9732c3799b428 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 16 Aug 2022 19:50:49 +0300 Subject: fixes #3159 (various quirks in the View/Change my details window) --- src/core/stduserinfo/src/userinfo.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index f2ef8788bd..bd81ec66d7 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -133,11 +133,20 @@ class CUserInfoDlg : public CDlgBase const wchar_t *pwszPrevGroup = nullptr; for (auto &it : items) { + int iImage = 1; + if ((it->dwFlags & ODPF_ICON) && it->lParam) { + HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam); + if (hIcon) { + iImage = ImageList_AddIcon(m_imageList, hIcon); + IcoLib_ReleaseIcon(hIcon); + } + } + if (hParent == nullptr || (!hContact && mir_wstrcmp(pwszPrevGroup, it->pwszGroup))) { TVINSERTSTRUCT tvis = {}; tvis.hInsertAfter = TVI_LAST; tvis.item.lParam = (LPARAM)it; - tvis.item.iImage = tvis.item.iSelectedImage = iFolderImage; + tvis.item.iImage = tvis.item.iSelectedImage = (it->pwszGroup == 0) ? iFolderImage : iImage; tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; tvis.item.pszText = (it->pwszGroup == 0) ? pwszRoot : it->pwszGroup; @@ -145,15 +154,6 @@ class CUserInfoDlg : public CDlgBase pwszPrevGroup = it->pwszGroup; } - int iImage = 1; - if ((it->dwFlags & ODPF_ICON) && it->lParam) { - HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam); - if (hIcon) { - iImage = ImageList_AddIcon(m_imageList, hIcon); - IcoLib_ReleaseIcon(hIcon); - } - } - TVINSERTSTRUCT tvis; tvis.hParent = hParent; tvis.hInsertAfter = TVI_LAST; -- cgit v1.2.3