summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-15 14:20:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-15 14:20:38 +0300
commit2e35c505b2f25b479e2017d3107cd2db56c74e5a (patch)
tree744177b084cfc038bf57a7308de80af4d00dda80 /src/core
parentbc7254837f6d2948976ec0da26853e20a4536778 (diff)
StdUserInfo: tree adaptation for hContact == 0
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 109fd6bbbf..f2ef8788bd 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -129,19 +129,22 @@ class CUserInfoDlg : public CDlgBase
if (items.getCount() == 0)
return;
- HTREEITEM hParent;
- {
- TVINSERTSTRUCT tvis = {};
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.lParam = (LPARAM)items[0];
- tvis.item.iImage = tvis.item.iSelectedImage = iFolderImage;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- tvis.item.pszText = pwszRoot;
- hParent = m_tree.InsertItem(&tvis);
- }
+ HTREEITEM hParent = nullptr;
+ const wchar_t *pwszPrevGroup = nullptr;
for (auto &it : items) {
+ 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.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;
+ hParent = m_tree.InsertItem(&tvis);
+ pwszPrevGroup = it->pwszGroup;
+ }
+
int iImage = 1;
if ((it->dwFlags & ODPF_ICON) && it->lParam) {
HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam);