From 5ea47a8634e1facfeab862c62140fd94ff917d62 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 4 Dec 2021 18:46:15 +0300 Subject: fixes #2942 (Msg_export: add "Export history" to contact's menu) --- plugins/Msg_Export/src/main.cpp | 21 +++++++++++++++++++-- plugins/Msg_Export/src/options.cpp | 14 ++------------ plugins/Msg_Export/src/stdafx.h | 22 ++++++++++++++++++++++ plugins/Msg_Export/src/version.h | 2 +- 4 files changed, 44 insertions(+), 15 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 08dfb1c429..7eb98a030b 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -62,7 +62,7 @@ CMPlugin::CMPlugin() : // Developer : KN ///////////////////////////////////////////////////////////////////// -static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/) +static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM) { if (g_bUseIntViewer) bShowFileViewer(wParam); @@ -71,6 +71,14 @@ static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/) return 0; } +static INT_PTR ExportContactHistory(WPARAM hContact, LPARAM) +{ + ExportDialogData* data = new ExportDialogData(); + data->contacts.push_back(hContact); + data->Run(); + return 0; +} + ///////////////////////////////////////////////////////////////////// // Member Function : nSystemShutdown // Type : Global @@ -110,8 +118,15 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) bReadMirandaDirAndPath(); UpdateFileToColWidth(); + CMenuItem mi(&g_plugin); + SET_UID(mi, 0x4e889089, 0x2304, 0x425f, 0x8f, 0xaa, 0x4f, 0x8a, 0x7b, 0x26, 0x4d, 0x4d); // {4E889089-2304-425F-8FAA-4F8A7B264D4D} + mi.hIcolibItem = iconList[0].hIcolib; + mi.position = 1000090101; + mi.name.a = LPGEN("Export history"); + mi.pszService = MS_EXPORT_HISTORY; + Menu_AddContactMenuItem(&mi); + if (!g_bReplaceHistory) { - CMenuItem mi(&g_plugin); SET_UID(mi, 0x701c543, 0xd078, 0x41dd, 0x95, 0xe3, 0x96, 0x49, 0x8a, 0x72, 0xc7, 0x50); mi.hIcolibItem = iconList[0].hIcolib; mi.position = 1000090100; @@ -175,6 +190,8 @@ int CMPlugin::Load() if (!hServiceFunc) hServiceFunc = CreateServiceFunction(MS_SHOW_EXPORT_HISTORY, ShowExportHistory); + CreateServiceFunction(MS_EXPORT_HISTORY, ExportContactHistory); + hInternalWindowList = WindowList_Create(); return 0; } diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 2593fb0a98..33b999466c 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -120,12 +120,7 @@ INT_PTR CALLBACK __stdcall DialogProc(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lP return FALSE; } -struct ExportDialogData { - list contacts; - HWND hDialog; -}; - -void __cdecl exportContactsMessages(ExportDialogData *data) +void __cdecl exportContactsMessages(struct ExportDialogData *data) { HWND hDlg = data->hDialog; HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS); @@ -559,12 +554,7 @@ public: data->contacts.push_back(hContact); } - // Create progress dialog - HWND hDlg = data->hDialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), nullptr, DialogProc); - ShowWindow(hDlg, SW_SHOWNORMAL); - - // Process the export in other thread - mir_forkThread(&exportContactsMessages, data); + data->Run(); } void Details() diff --git a/plugins/Msg_Export/src/stdafx.h b/plugins/Msg_Export/src/stdafx.h index 827cd39447..24989198aa 100755 --- a/plugins/Msg_Export/src/stdafx.h +++ b/plugins/Msg_Export/src/stdafx.h @@ -57,6 +57,7 @@ using namespace std; #define MODULENAME "Msg_Export" #define MSG_BOX_TITEL TranslateT("Miranda NG (Message Export Plugin)") #define MS_SHOW_EXPORT_HISTORY "History/ShowExportHistory" +#define MS_EXPORT_HISTORY "History/ExportHistory" #define szFileViewDB "FileV_" #define WM_RELOAD_FILE (WM_USER+10) @@ -72,4 +73,25 @@ extern MWindowList hInternalWindowList; extern wstring g_sDBPath, g_sMirandaPath; extern IconItem iconList[]; +/////////////////////////////////////////////////////////////////////////////// + +void __cdecl exportContactsMessages(struct ExportDialogData *data); +INT_PTR CALLBACK __stdcall DialogProc(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam); + +struct ExportDialogData +{ + list contacts; + HWND hDialog; + + void Run() + { + // Create progress dialog + hDialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), nullptr, DialogProc); + ShowWindow(hDialog, SW_SHOWNORMAL); + + // Process the export in other thread + mir_forkThread(&exportContactsMessages, this); + } +}; + #endif \ No newline at end of file diff --git a/plugins/Msg_Export/src/version.h b/plugins/Msg_Export/src/version.h index cb05903e6e..f4981448be 100644 --- a/plugins/Msg_Export/src/version.h +++ b/plugins/Msg_Export/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 7 +#define __BUILD_NUM 8 #include -- cgit v1.2.3