summaryrefslogtreecommitdiff
path: root/plugins/Import/src/progress.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-18 21:50:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-18 21:50:13 +0300
commitd0b5caf64e6a01112a8fce4b93340fb0cb88edbe (patch)
tree29188b25368162bfdfbecfb1dd3c960808191cef /plugins/Import/src/progress.cpp
parent589b7562b76ade5afb5e50e7eacf74782205c498 (diff)
fixes #1622 (Add ability to copy text from Import log)
Diffstat (limited to 'plugins/Import/src/progress.cpp')
-rw-r--r--plugins/Import/src/progress.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/Import/src/progress.cpp b/plugins/Import/src/progress.cpp
index 87b89a76ea..434f072bd6 100644
--- a/plugins/Import/src/progress.cpp
+++ b/plugins/Import/src/progress.cpp
@@ -33,6 +33,8 @@ CProgressPageDlg::CProgressPageDlg() :
m_list(this, IDC_STATUS),
m_timer(this, 1)
{
+ m_list.OnBuildMenu = Callback(this, &CProgressPageDlg::OnContextMenu);
+
m_timer.OnEvent = Callback(this, &CProgressPageDlg::OnTimer);
}
@@ -57,6 +59,43 @@ void CProgressPageDlg::OnNext()
PostMessage(m_hwndParent, WIZM_GOTOPAGE, 0, (LPARAM)new CFinishedPageDlg());
}
+void CProgressPageDlg::OnContextMenu(CCtrlBase*)
+{
+ POINT pt;
+ ::GetCursorPos(&pt);
+
+ HMENU hMenu = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_LIST));
+ switch (::TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) {
+ case IDM_COPY:
+ CMStringW wszText;
+ int nLines = m_list.GetCount();
+ for (int i = 0; i < nLines; i++) {
+ ptrW wszLine(m_list.GetItemText(i));
+ if (wszLine) {
+ wszText.Append(wszLine);
+ wszText.Append(L"\r\n");
+ }
+ }
+ if (wszText.IsEmpty())
+ break;
+
+ if (::OpenClipboard(m_hwnd)) {
+ size_t i = sizeof(wchar_t) * (wszText.GetLength() + 1);
+
+ ::EmptyClipboard();
+ HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, i);
+
+ memcpy((void*)::GlobalLock(hData), wszText, i);
+ ::GlobalUnlock(hData);
+ ::SetClipboardData(CF_UNICODETEXT, hData);
+ ::CloseClipboard();
+ }
+ break;
+ }
+
+ ::DestroyMenu(hMenu);
+}
+
void CProgressPageDlg::OnTimer(CTimer*)
{
m_timer.Stop();