From bbf7a2bcf24ca620d44a397e1c289d25bcb03ec2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 10 Mar 2018 19:11:14 +0300 Subject: service for the custom import procedure --- plugins/Import/import.vcxproj.filters | 15 ++++++++++++++- plugins/Import/src/main.cpp | 20 ++++++++++++++++++-- plugins/Import/src/stdafx.h | 25 +------------------------ plugins/Import/src/version.h | 2 +- plugins/Import/src/wizard.cpp | 12 ++++++------ 5 files changed, 40 insertions(+), 34 deletions(-) (limited to 'plugins/Import') diff --git a/plugins/Import/import.vcxproj.filters b/plugins/Import/import.vcxproj.filters index de5ad9f66c..c474fadf2b 100644 --- a/plugins/Import/import.vcxproj.filters +++ b/plugins/Import/import.vcxproj.filters @@ -1,4 +1,17 @@  + + + {0775b44c-fe4d-4330-9c89-2718336516b8} + + - \ No newline at end of file + + + dbrw + + + dbrw + + + diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 151e8509c9..02214a87dd 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -57,7 +57,10 @@ static INT_PTR ImportCommand(WPARAM, LPARAM) SetForegroundWindow(hwndWizard); SetFocus(hwndWizard); } - else hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); + else { + hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); + PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc); + } return 0; } @@ -106,16 +109,29 @@ static int OnExit(WPARAM, LPARAM) static INT_PTR ServiceMode(WPARAM, LPARAM) { g_bServiceMode = true; - CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); + hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); + PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc); return SERVICE_ONLYDB; } +static INT_PTR CustomImport(WPARAM wParam, LPARAM) +{ + MImportOptions *param = (MImportOptions*)wParam; + wcsncpy_s(importFile, MAX_PATH, param->pwszFileName, _TRUNCATE); + nImportOptions = param->dwFlags; + + hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); + PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressPageProc); + return 0; +} + extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); CreateServiceFunction(IMPORT_SERVICE, ImportCommand); CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode); + CreateServiceFunction(MS_IMPORT_RUN, CustomImport); RegisterIcons(); // menu item diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h index d0e0e976ee..2e0db401d8 100644 --- a/plugins/Import/src/stdafx.h +++ b/plugins/Import/src/stdafx.h @@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "version.h" #include "resource.h" @@ -66,30 +67,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PROGM_ADDMESSAGE (WM_USER+11) //lParam=(char*)szText #define ICQOSCPROTONAME "ICQ" -#define MSNPROTONAME "MSN" -#define YAHOOPROTONAME "YAHOO" -#define NSPPROTONAME "NET_SEND" -#define ICQCORPPROTONAME "ICQ Corp" -#define AIMPROTONAME "AIM" - -// Custom import options -#define IOPT_ADDUNKNOWN 0x00000001 -#define IOPT_MSGSENT 0x00000002 -#define IOPT_MSGRECV 0x00000004 -#define IOPT_URLSENT 0x00000008 -#define IOPT_URLRECV 0x00000010 -#define IOPT_AUTHREQ 0x00000020 -#define IOPT_ADDED 0x00000040 -#define IOPT_FILESENT 0x00000080 -#define IOPT_FILERECV 0x00000100 -#define IOPT_OTHERSENT 0x00000200 -#define IOPT_OTHERRECV 0x00000400 -#define IOPT_SYSTEM 0x00000800 -#define IOPT_CONTACTS 0x00001000 -#define IOPT_GROUPS 0x00002000 -#define IOPT_SYS_SETTINGS 0x00004000 - -#define IOPT_HISTORY 0x000007FE void AddMessage(const wchar_t* fmt, ...); diff --git a/plugins/Import/src/version.h b/plugins/Import/src/version.h index 851fc2f554..6fc4c509d7 100644 --- a/plugins/Import/src/version.h +++ b/plugins/Import/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 95 #define __RELEASE_NUM 8 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index f7c4a4e68c..f23bf6ce1b 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -90,20 +90,18 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - static HWND hwndPage; + static HWND hwndPage = nullptr; + bool bFirstLaunch = hwndPage == nullptr; switch (message) { case WM_INITDIALOG: TranslateDialogDefault(hdlg); - hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARDINTRO), hdlg, WizardIntroPageProc); - SetWindowPos(hwndPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - ShowWindow(hwndPage, SW_SHOW); - ShowWindow(hdlg, SW_SHOW); Window_SetIcon_IcoLib(hdlg, GetIconHandle(IDI_IMPORT)); return TRUE; case WIZM_GOTOPAGE: - DestroyWindow(hwndPage); + if (hwndPage) + DestroyWindow(hwndPage); EnableWindow(GetDlgItem(hdlg, IDC_BACK), TRUE); EnableWindow(GetDlgItem(hdlg, IDOK), TRUE); EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE); @@ -111,6 +109,8 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam); SetWindowPos(hwndPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); ShowWindow(hwndPage, SW_SHOW); + if (bFirstLaunch) + ShowWindow(hdlg, SW_SHOW); break; case WIZM_DISABLEBUTTON: -- cgit v1.2.3