diff options
author | George Hazan <ghazan@miranda.im> | 2022-08-05 12:58:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-08-05 12:58:18 +0300 |
commit | b2d136e6c0a2e654aa09adee6d01e2ebe9c02ce1 (patch) | |
tree | 2ba2d43fd7784da2b8cebf83e40b825a7c245dc0 | |
parent | ff9679b7f42879dde78c4f74682eff63ee152e7c (diff) |
StdUserInfo: more compact variant of tree
-rw-r--r-- | protocols/ICQ-WIM/src/userinfo.cpp | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 3 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 1 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 45 |
4 files changed, 21 insertions, 33 deletions
diff --git a/protocols/ICQ-WIM/src/userinfo.cpp b/protocols/ICQ-WIM/src/userinfo.cpp index 3be4624d13..6265dc6a4a 100644 --- a/protocols/ICQ-WIM/src/userinfo.cpp +++ b/protocols/ICQ-WIM/src/userinfo.cpp @@ -52,9 +52,8 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) return 0; USERINFOPAGE uip = {}; - uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; - uip.szGroup.w = m_tszUserName; - + uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE | ODPF_ICON; + uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE); uip.szTitle.w = L"ICQ"; uip.position = -1900000000; uip.pDialog = new IcqUserInfoDlg(this); diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 03b65daf1f..46e52abc77 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -845,8 +845,9 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) { USERINFOPAGE uip = {}; uip.dwInitParam = (LPARAM)this; - uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB; + uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_ICON; uip.szGroup.w = m_tszUserName; + uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE); uip.pDialog = new JabberUserInfoDlg(this); uip.position = -2000000000; diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 9b7f624307..aeefeda9a4 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -465,7 +465,6 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) uip.flags = ODPF_ICON;
uip.pDialog = new CSummaryDlg();
- uip.szGroup.a = LPGEN("General");
uip.szTitle.a = LPGEN("Summary");
uip.dwInitParam = (INT_PTR)g_plugin.getIconHandle(IDI_SUMMARY);
g_plugin.addUserInfo(wParam, &uip);
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 0d24f785b6..4c57fe75cf 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -109,13 +109,11 @@ class CUserInfoDlg : public CDlgBase OBJLIST<DetailsPageData> m_pages;
DetailsPageData *m_pCurrent = nullptr;
- void PopulateContact(MCONTACT hContact, int iFolderImage)
+ void PopulateContact(MCONTACT hContact, int iFolderImage, wchar_t *pwszRoot)
{
ptrW ptszLastTab(g_plugin.getWStringA("LastTab"));
m_pCurrent = nullptr;
- std::map<std::wstring, HTREEITEM> parents;
-
LIST<DetailsPageData> items(1, PageSortProc);
NotifyEventHooks(hDetailsInitEvent, (WPARAM)&items, hContact);
@@ -131,31 +129,19 @@ class CUserInfoDlg : public CDlgBase if (items.getCount() == 0)
return;
- wchar_t *pwszGeneral = TranslateT("General");
+ 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);
+ }
for (auto &it : items) {
- wchar_t *pwszGroup = it->getGroup();
- wchar_t *pwszText = (pwszGroup == nullptr) ? pwszGeneral : pwszGroup;
-
- HTREEITEM hParent;
- auto p = parents.find(pwszText);
- if (p == parents.end()) {
- 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;
- if (pwszGroup != nullptr) {
- tvis.item.pszText = pwszGroup;
- tvis.hParent = (m_bIsMeta) ? parents.find(pwszGeneral)->second : nullptr;
- }
- else tvis.item.pszText = pwszGeneral;
-
- hParent = parents[pwszText] = m_tree.InsertItem(&tvis);
- }
- else hParent = p->second;
-
int iImage = 1;
if ((it->dwFlags & ODPF_ICON) && it->lParam) {
HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam);
@@ -196,7 +182,7 @@ class CUserInfoDlg : public CDlgBase m_tree.SetImageList(m_imageList, TVSIL_NORMAL);
- PopulateContact(m_hContact, 0);
+ PopulateContact(m_hContact, 0, TranslateT("General"));
if (m_bIsMeta) {
int nSubs = db_mc_getSubCount(m_hContact);
@@ -205,7 +191,10 @@ class CUserInfoDlg : public CDlgBase MCONTACT hSub = db_mc_getSub(m_hContact, i);
if (hSub > 0) {
auto *szProto = Proto_GetBaseAccountName(hSub);
- PopulateContact(hSub, ImageList_AddIcon(m_imageList, IcoLib_GetIconByHandle(Skin_GetProtoIcon(szProto, ID_STATUS_ONLINE))));
+ auto *pa = Proto_GetAccount(szProto);
+ PopulateContact(hSub,
+ ImageList_AddIcon(m_imageList, IcoLib_GetIconByHandle(Skin_GetProtoIcon(szProto, ID_STATUS_ONLINE))),
+ pa ? pa->tszAccountName : _A2T(szProto));
}
}
}
|