From 060f3c97377b45aa12cdd4f01baab1a52748f4a3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Dec 2019 20:10:30 +0300 Subject: fixes #2141 (StdUserInfo doesn't handle OK button properly) --- src/core/stduserinfo/src/userinfo.cpp | 55 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index e5eec70837..f5f874239a 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -288,6 +288,34 @@ public: return true; } + bool OnApply() override + { + PSHNOTIFY pshn; + pshn.hdr.idFrom = 0; + pshn.lParam = (LPARAM)m_hContact; + if (m_currentPage != -1) { + pshn.hdr.code = PSN_KILLACTIVE; + pshn.hdr.hwndFrom = m_pages[m_currentPage].hwnd; + if (SendMessage(m_pages[m_currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn)) + return false; + } + + pshn.hdr.code = PSN_APPLY; + for (auto &odp : m_pages) { + if (odp->hwnd == nullptr || !odp->changed) + continue; + pshn.hdr.hwndFrom = odp->hwnd; + if (SendMessage(odp->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) { + m_tree.Select(odp->hItem, TVGN_CARET); + if (m_currentPage != -1) ShowWindow(m_pages[m_currentPage].hwnd, SW_HIDE); + m_currentPage = m_pages.indexOf(&odp); + ShowWindow(m_pages[m_currentPage].hwnd, SW_SHOW); + return false; + } + } + return true; + } + void OnDestroy() override { wchar_t name[128]; @@ -478,33 +506,6 @@ public: } } - void onClick_Ok(CCtrlButton *) - { - PSHNOTIFY pshn; - pshn.hdr.idFrom = 0; - pshn.lParam = (LPARAM)m_hContact; - if (m_currentPage != -1) { - pshn.hdr.code = PSN_KILLACTIVE; - pshn.hdr.hwndFrom = m_pages[m_currentPage].hwnd; - if (SendMessage(m_pages[m_currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn)) - return; - } - - pshn.hdr.code = PSN_APPLY; - for (auto &odp : m_pages) { - if (odp->hwnd == nullptr || !odp->changed) - continue; - pshn.hdr.hwndFrom = odp->hwnd; - if (SendMessage(odp->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) { - m_tree.Select(odp->hItem, TVGN_CARET); - if (m_currentPage != -1) ShowWindow(m_pages[m_currentPage].hwnd, SW_HIDE); - m_currentPage = m_pages.indexOf(&odp); - ShowWindow(m_pages[m_currentPage].hwnd, SW_SHOW); - return; - } - } - } - void onClick_Update(CCtrlButton *) { if (m_infosUpdated != NULL) { -- cgit v1.2.3