diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-10 19:11:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-10 19:11:14 +0300 |
commit | bbf7a2bcf24ca620d44a397e1c289d25bcb03ec2 (patch) | |
tree | 0ae631c827851b0ff0a9416ecdda0ee3929befa3 | |
parent | 74e6676bf5bf17dac4632d3c4bf95f4df19458f7 (diff) |
service for the custom import procedure
-rw-r--r-- | include/m_import.h | 58 | ||||
-rw-r--r-- | plugins/Import/import.vcxproj.filters | 15 | ||||
-rw-r--r-- | plugins/Import/src/main.cpp | 20 | ||||
-rw-r--r-- | plugins/Import/src/stdafx.h | 25 | ||||
-rw-r--r-- | plugins/Import/src/version.h | 2 | ||||
-rw-r--r-- | plugins/Import/src/wizard.cpp | 12 |
6 files changed, 98 insertions, 34 deletions
diff --git a/include/m_import.h b/include/m_import.h new file mode 100644 index 0000000000..2da63b215d --- /dev/null +++ b/include/m_import.h @@ -0,0 +1,58 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org) +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef M_IMPORT_H__ +#define M_IMPORT_H__ 1 + +// launches the import wizard with given file name & options +// always returns 0 + +// 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 + +struct MImportOptions +{ + const wchar_t *pwszFileName; + DWORD dwFlags; // IOPT_* flags combination +}; + +#define MS_IMPORT_RUN "Import/Run" + +#endif // M_IMPORT_H__ 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 @@ <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="dbrw">
+ <UniqueIdentifier>{0775b44c-fe4d-4330-9c89-2718336516b8}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
<Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
-</Project>
\ No newline at end of file + <ItemGroup>
+ <ClCompile Include="src\dbrw\*.cpp">
+ <Filter>dbrw</Filter>
+ </ClCompile>
+ <ClInclude Include="src\dbrw\*.h">
+ <Filter>dbrw</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
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 <m_clist.h>
#include <m_db_int.h>
#include <m_metacontacts.h>
+#include <m_import.h>
#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 <stdver.h>
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:
|