From 5fa7bb1bd7a975178f64a0cd70f88a1de5764dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 17 Sep 2012 15:20:58 +0000 Subject: ProfileManager: Added menu items for restart and dbchecker. git-svn-id: http://svn.miranda-ng.org/main/trunk@1592 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ProfileManager/src/pmanagerEx.cpp | 37 ++++++++++++++++++++++++++++--- plugins/ProfileManager/src/resource.h | 2 ++ 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'plugins/ProfileManager/src') diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp index 175182be67..8a93a997d0 100644 --- a/plugins/ProfileManager/src/pmanagerEx.cpp +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -25,13 +25,13 @@ TCHAR fn[MAX_PATH]; TCHAR lmn[MAX_PATH]; TCHAR* pathn; int hLangpack; -HANDLE hLoadPM, hChangePM; +HANDLE hLoadPM, hChangePM, hDbchecker; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), "Miranda NG Profile Changer", - PLUGIN_MAKE_VERSION(0,0,0,3), - "Adds a menu item to change or load a different profile of Miranda NG.", + PLUGIN_MAKE_VERSION(0,0,0,4), + "Adds a menu item to change or load a different profile of Miranda NG, restart or run a dbchecker.", "Roman Gemini", "woobind@ukr.net", "© 2008 - 2010 Roman Gemini", @@ -66,6 +66,16 @@ static INT_PTR LoadPM(WPARAM wParam, LPARAM lParam) return 0; } +static INT_PTR CheckDb(WPARAM wParam, LPARAM lParam) +{ + if (MessageBox( 0, TranslateT("Miranda NG will exit and Database checker will start.\n\nAre you sure you want to do this?"), TranslateT("Check Database"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) { + GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn)); + ShellExecute(0, _T("open"), fn, _T("/svc:dbchecker"), _T(""), 1); + CallService("CloseAction", 0, 0); + } + return 0; +} + extern "C" __declspec(dllexport) int Load(void) { CLISTMENUITEM mi; @@ -94,6 +104,27 @@ extern "C" __declspec(dllexport) int Load(void) mi.pszService = "Database/ChangePM"; Menu_AddMainMenuItem(&mi); + hDbchecker = CreateServiceFunction("Database/CheckDb", CheckDb); + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = -500200000; + mi.flags = CMIF_TCHAR; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_Dbchecker)); + mi.ptszPopupName = _T("Database"); + mi.ptszName = _T("Check database"); + mi.pszService = "Database/CheckDb"; + Menu_AddMainMenuItem(&mi); + + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = -500200000; + mi.flags = CMIF_TCHAR; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_Restart)); + mi.ptszPopupName = NULL; + mi.ptszName = _T("Restart"); + mi.pszService = "Miranda/System/Restart"; + Menu_AddMainMenuItem(&mi); + return 0; } diff --git a/plugins/ProfileManager/src/resource.h b/plugins/ProfileManager/src/resource.h index 638fcfb4f6..0b3445b3e7 100644 --- a/plugins/ProfileManager/src/resource.h +++ b/plugins/ProfileManager/src/resource.h @@ -4,6 +4,8 @@ // #define IDI_ChangePM 101 #define IDI_LoadPM 102 +#define IDI_Restart 103 +#define IDI_Dbchecker 104 // Next default values for new objects // -- cgit v1.2.3