From 0e022bdc8e48520231103b0fc11c6525f3b211cc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jun 2018 20:22:12 +0300 Subject: fixes #1442 (UserInfoEx Button on ToolBar) --- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 28 --------- plugins/UserInfoEx/src/dlg_anniversarylist.h | 1 - plugins/UserInfoEx/src/dlg_propsheet.cpp | 80 ++++++++++++-------------- plugins/UserInfoEx/src/init.cpp | 19 +++++- plugins/UserInfoEx/src/svc_reminder.cpp | 30 ---------- plugins/UserInfoEx/src/version.h | 2 +- 6 files changed, 56 insertions(+), 104 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index d784a00ee8..b49a6153c1 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -945,34 +945,6 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) * loading and unloading module ***********************************************************************************************************/ -#define TBB_IDBTN "AnnivList" -#define TBB_ICONAME TOOLBARBUTTON_ICONIDPREFIX TBB_IDBTN TOOLBARBUTTON_ICONIDPRIMARYSUFFIX - -/** - * This function is called by the ME_TTB_MODULELOADED event. - * It adds a set of buttons to the TopToolbar plugin. - * - * @param wParam - none - * - * @return nothing - **/ -void DlgAnniversaryListOnTopToolBarLoaded() -{ - TTBButton ttb = {}; - ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttb.pszService = MS_USERINFO_REMINDER_LIST; - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_ANNIVERSARY); - ttb.name = ttb.pszTooltipUp = LPGEN("Anniversary list"); - g_plugin.addTTB(&ttb); -} - -/** - * This function initially loads all required stuff for the anniversary list. - * - * @param none - * - * @return nothing - **/ void DlgAnniversaryListLoadModule() { CreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.h b/plugins/UserInfoEx/src/dlg_anniversarylist.h index 73c4e7c428..df1edfe141 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.h +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.h @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SET_ANNIVLIST_FILTER_INDEX "AnLstFltIndex" INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam); -void DlgAnniversaryListOnTopToolBarLoaded(); void DlgAnniversaryListLoadModule(); #endif /* _DLGANNIVERSARYLIST_H_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 63a3979aee..d0c212c04b 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -594,44 +594,9 @@ void DlgContactInfoInitTreeIcons() } } -/** -* @name UnLoadModule() -* @desc unload the UserInfo Module -* -* @return nothing -**/ -void DlgContactInfoUnLoadModule() -{ - WindowList_Destroy(g_hWindowList); - DestroyHookableEvent(g_hDetailsInitEvent); -} - -/** -* @name LoadModule() -* @desc load the UserInfo Module -* -* @return nothing -**/ -void DlgContactInfoLoadModule() -{ - g_hDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); - - CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog); - CreateServiceFunction("UserInfo/AddPage", AddPage); - - HookEvent(ME_DB_CONTACT_DELETED, OnDeleteContact); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); - HookEvent(ME_USERINFO_INITIALISE, InitDetails); - g_hWindowList = WindowList_Create(); - - // check whether changing my details via UserInfoEx is basically possible - myGlobals.CanChangeDetails = FALSE; - - for (auto &pa : Accounts()) - if (IsProtoAccountEnabled(pa)) // update my contact information on icq server - if (myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pa->szModuleName, PS_CHANGEINFOEX, NULL, NULL))) - break; -} +/*============================================================================================ + PropertySheet's Dialog Procedures + ============================================================================================*/ static void ResetUpdateInfo(LPPS pPs) { @@ -642,10 +607,6 @@ static void ResetUpdateInfo(LPPS pPs) pPs->nSubContacts = 0; } -/*============================================================================================ - PropertySheet's Dialog Procedures - ============================================================================================*/ - /** * @name DlgProc() * @desc dialog procedure for the main propertysheet dialog box @@ -1631,3 +1592,38 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } return FALSE; } + +/** +* @name LoadModule() +* @desc load the UserInfo Module +**/ +void DlgContactInfoLoadModule() +{ + g_hDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); + + CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog); + CreateServiceFunction("UserInfo/AddPage", AddPage); + + HookEvent(ME_DB_CONTACT_DELETED, OnDeleteContact); + HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); + HookEvent(ME_USERINFO_INITIALISE, InitDetails); + g_hWindowList = WindowList_Create(); + + // check whether changing my details via UserInfoEx is basically possible + myGlobals.CanChangeDetails = FALSE; + + for (auto &pa : Accounts()) + if (IsProtoAccountEnabled(pa)) // update my contact information on icq server + if (myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pa->szModuleName, PS_CHANGEINFOEX, NULL, NULL))) + break; +} + +/** +* @name UnLoadModule() +* @desc unload the UserInfo Module +**/ +void DlgContactInfoUnLoadModule() +{ + WindowList_Destroy(g_hWindowList); + DestroyHookableEvent(g_hDetailsInitEvent); +} diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 3203cc87a6..dc30e6f5ec 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -61,8 +61,23 @@ CMPlugin::CMPlugin() : **/ static int OnTopToolBarLoaded(WPARAM, LPARAM) { - DlgAnniversaryListOnTopToolBarLoaded(); - SvcReminderOnTopToolBarLoaded(); + TTBButton ttb = {}; + ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + ttb.pszService = MS_USERINFO_SHOWDIALOG; + ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_MAIN); + ttb.name = ttb.pszTooltipUp = LPGEN("User &details"); + g_plugin.addTTB(&ttb); + + ttb.dwFlags = TTBBF_SHOWTOOLTIP; + ttb.pszService = MS_USERINFO_REMINDER_LIST; + ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_ANNIVERSARY); + ttb.name = ttb.pszTooltipUp = LPGEN("Anniversary list"); + g_plugin.addTTB(&ttb); + + ttb.pszService = MS_USERINFO_REMINDER_CHECK; + ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_BIRTHDAY); + ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries"); + g_plugin.addTTB(&ttb); return 0; } diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 993bf7dcf5..f887c7bbbd 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -664,28 +664,6 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb return 0; } -#define TBB_IDBTN "CheckAnniv" -#define TBB_ICONAME TOOLBARBUTTON_ICONIDPREFIX TBB_IDBTN TOOLBARBUTTON_ICONIDPRIMARYSUFFIX - -/** -* This function is called by the ME_TTB_MODULELOADED event. -* It adds a set of buttons to the TopToolbar plugin. -* -* @param none -* -* @return nothing -**/ - -void SvcReminderOnTopToolBarLoaded() -{ - TTBButton ttb = {}; - ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttb.pszService = MS_USERINFO_REMINDER_CHECK; - ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries"); - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_BIRTHDAY); - g_plugin.addTTB(&ttb); -} - /*********************************************************************************************************** * services ***********************************************************************************************************/ @@ -884,10 +862,6 @@ void SvcReminderOnModulesLoaded(void) /** * This function initially loads all required stuff for reminder. -* -* @param none -* -* @return nothing **/ void SvcReminderLoadModule(void) @@ -915,10 +889,6 @@ void SvcReminderLoadModule(void) /** * This function unloads the reminder module. -* -* @param none -* -* @return nothing **/ void SvcReminderUnloadModule(void) diff --git a/plugins/UserInfoEx/src/version.h b/plugins/UserInfoEx/src/version.h index df1cc5a311..d8383d418e 100644 --- a/plugins/UserInfoEx/src/version.h +++ b/plugins/UserInfoEx/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 8 #define __RELEASE_NUM 5 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include -- cgit v1.2.3