diff options
author | George Hazan <ghazan@miranda.im> | 2022-09-10 08:12:16 -0700 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-09-10 08:12:16 -0700 |
commit | 42dfc34b0a700db3206ca4850af5a517f318a54c (patch) | |
tree | f8b3282e703eb980f7c18d6f4be02133316e6c4d /src | |
parent | a929d4c862a60c9abc1b6e9fe507831326f232dc (diff) |
fixes #3178 (StdUserInfo: page tree isn't rebuilt when info changes)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index bd81ec66d7..9448d5c96f 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -176,6 +176,15 @@ class CUserInfoDlg : public CDlgBase void BuildTree()
{
+ m_tree.SendMsg(WM_SETREDRAW, FALSE, 0);
+
+ if (m_pCurrent) {
+ SaveLocation();
+ m_tree.DeleteAllItems();
+ m_pages.destroy();
+ m_pCurrent = nullptr;
+ }
+
if (m_imageList)
ImageList_Destroy(m_imageList);
m_imageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1);
@@ -201,6 +210,10 @@ class CUserInfoDlg : public CDlgBase }
}
}
+
+ m_tree.SendMsg(WM_SETREDRAW, TRUE, 0);
+ m_tree.SelectItem(m_pCurrent->hItem);
+ SetFocus(m_tree.GetHwnd());
}
void CheckOnline()
@@ -246,6 +259,20 @@ class CUserInfoDlg : public CDlgBase SetWindowPos(m_pCurrent->hwnd, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
}
+ void SaveLocation()
+ {
+ if (m_pCurrent) {
+ wchar_t name[128];
+ TVITEMEX tvi;
+ tvi.mask = TVIF_TEXT;
+ tvi.hItem = m_pCurrent->hItem;
+ tvi.pszText = name;
+ tvi.cchTextMax = _countof(name);
+ m_tree.GetItem(&tvi);
+ g_plugin.setWString("LastTab", name);
+ }
+ }
+
CCtrlBase m_place;
CCtrlButton btnUpdate;
CCtrlTreeView m_tree;
@@ -295,10 +322,6 @@ public: BuildTree();
//////////////////////////////////////////////////////////////////////
-
- m_tree.SelectItem(m_pCurrent->hItem);
-
- //////////////////////////////////////////////////////////////////////
m_updateAnimFrame = 0;
GetDlgItemText(m_hwnd, IDC_UPDATING, m_szUpdating, _countof(m_szUpdating));
CheckOnline();
@@ -308,7 +331,6 @@ public: }
else ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_HIDE);
- SetFocus(m_tree.GetHwnd());
return true;
}
@@ -362,16 +384,7 @@ public: void OnDestroy() override
{
- if (m_pCurrent) {
- wchar_t name[128];
- TVITEMEX tvi;
- tvi.mask = TVIF_TEXT;
- tvi.hItem = m_pCurrent->hItem;
- tvi.pszText = name;
- tvi.cchTextMax = _countof(name);
- m_tree.GetItem(&tvi);
- g_plugin.setWString("LastTab", name);
- }
+ SaveLocation();
if (m_imageList)
ImageList_Destroy(m_imageList);
@@ -441,7 +454,11 @@ public: if (ack->hContact != m_hContact && !(m_bIsMeta && db_mc_getMeta(ack->hContact) == m_hContact))
break;
+ if (ack->result == ACKRESULT_SUCCESS)
+ BuildTree();
+
SendMessage(m_hwnd, PSM_FORCECHANGED, 0, 0);
+
/* if they're not gonna send any more ACK's don't let that mean we should crash */
if (!ack->hProcess && !ack->lParam) {
ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_HIDE);
|