From 8fdc4e2ef0de78cd447d156a4f45c4eb5e372978 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 3 Jun 2020 16:38:41 +0300 Subject: tabSRMM: why text is restored only for private chats? --- plugins/TabSRMM/src/msgdialog.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index c0acfbd068..10ddae9188 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -595,25 +595,6 @@ bool CMsgDialog::OnInitDialog() DM_OptionsApplied(); - // restore saved msg if any... - ptrW wszSavedMsg(g_plugin.getWStringA(m_hContact, "SavedMsg")); - if (wszSavedMsg != 0) { - SETTEXTEX stx = { ST_DEFAULT, 1200 }; - m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, wszSavedMsg); - UpdateSaveAndSendButton(); - if (m_pContainer->m_hwndActive == m_hwnd) - UpdateReadChars(); - } - - if (wszInitialText) { - m_message.SetText(wszInitialText); - int len = GetWindowTextLength(m_message.GetHwnd()); - PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len); - if (len) - EnableSendButton(true); - mir_free(wszInitialText); - } - for (MEVENT hdbEvent = db_event_last(m_hContact); hdbEvent; hdbEvent = db_event_prev(m_hContact, hdbEvent)) { DBEVENTINFO dbei = {}; db_event_get(hdbEvent, &dbei); @@ -625,6 +606,25 @@ bool CMsgDialog::OnInitDialog() } } + // restore saved msg if any... + ptrW wszSavedMsg(g_plugin.getWStringA(m_hContact, "SavedMsg")); + if (wszSavedMsg != 0) { + SETTEXTEX stx = { ST_DEFAULT, 1200 }; + m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, wszSavedMsg); + UpdateSaveAndSendButton(); + if (m_pContainer->m_hwndActive == m_hwnd) + UpdateReadChars(); + } + + if (wszInitialText) { + m_message.SetText(wszInitialText); + int len = GetWindowTextLength(m_message.GetHwnd()); + PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len); + if (len) + EnableSendButton(true); + mir_free(wszInitialText); + } + SendMessage(m_pContainer->m_hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); SetWindowPos(m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), m_bActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE); -- cgit v1.2.3