From e2056d849b38b2f32556abc44abe5f50f040040f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 12 Mar 2014 15:15:05 +0000 Subject: stduihist: contact menu item to be hidden when there's no history for a contact git-svn-id: http://svn.miranda-ng.org/main/trunk@8579 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stduihist/history.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core/stduihist') diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index cc356ec781..e6c97c1ade 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static HANDLE hWindowList = 0; +static HGENMENU hContactMenu = 0; ///////////////////////////////////////////////////////////////////////////////////////// // Fills the events list @@ -389,7 +390,13 @@ static int HistoryContactDelete(WPARAM wParam, LPARAM) return 0; } -int PreShutdownHistoryModule(WPARAM, LPARAM) +static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) +{ + Menu_ShowItem(hContactMenu, db_event_last(hContact) != NULL); + return 0; +} + +static int PreShutdownHistoryModule(WPARAM, LPARAM) { if (hWindowList) { WindowList_Broadcast(hWindowList, WM_DESTROY, 0, 0); @@ -405,11 +412,12 @@ int LoadHistoryModule(void) mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_HISTORY); mi.pszName = LPGEN("View &history"); mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; - Menu_AddContactMenuItem(&mi); + hContactMenu = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, UserHistoryCommand); hWindowList = WindowList_Create(); HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); return 0; } -- cgit v1.2.3