summaryrefslogtreecommitdiff
path: root/plugins/Import/src
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
parent589b7562b76ade5afb5e50e7eacf74782205c498 (diff)
fixes #1622 (Add ability to copy text from Import log)
Diffstat (limited to 'plugins/Import/src')
-rw-r--r--plugins/Import/src/progress.cpp39
-rw-r--r--plugins/Import/src/resource.h8
-rw-r--r--plugins/Import/src/stdafx.h1
3 files changed, 45 insertions, 3 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();
diff --git a/plugins/Import/src/resource.h b/plugins/Import/src/resource.h
index 7857ea0834..f75f1d2a15 100644
--- a/plugins/Import/src/resource.h
+++ b/plugins/Import/src/resource.h
@@ -14,7 +14,8 @@
#define IDD_MIRANDADB 110
#define IDD_PROGRESS 111
#define IDD_ADVOPTIONS 112
-#define IDI_IMPORT 177
+#define IDR_LIST 113
+#define IDI_IMPORT 114
#define IDC_DONTLOADPLUGIN 1001
#define IDC_MIRANDA 1002
#define IDC_OTHER 1005
@@ -51,14 +52,15 @@
#define IDC_FT 1040
#define IDC_OPEN_FILE 1042
#define IDC_CHECK_DUPS 1043
+#define IDM_COPY 40001
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 111
-#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_RESOURCE_VALUE 115
+#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1044
#define _APS_NEXT_SYMED_VALUE 101
#endif
diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h
index 06c0454843..c30d02c3b0 100644
--- a/plugins/Import/src/stdafx.h
+++ b/plugins/Import/src/stdafx.h
@@ -115,6 +115,7 @@ public:
void OnNext() override;
void OnTimer(CTimer*);
+ void OnContextMenu(CCtrlBase*);
void AddMessage(const wchar_t *pMsg);
void SetProgress(int);