diff options
author | George Hazan <ghazan@miranda.im> | 2022-08-15 14:20:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-08-15 14:20:38 +0300 |
commit | 2e35c505b2f25b479e2017d3107cd2db56c74e5a (patch) | |
tree | 744177b084cfc038bf57a7308de80af4d00dda80 /src/core | |
parent | bc7254837f6d2948976ec0da26853e20a4536778 (diff) |
StdUserInfo: tree adaptation for hContact == 0
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 25 |
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);
|