summaryrefslogtreecommitdiff
path: root/src/core/stduihist
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-12 15:15:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-12 15:15:05 +0000
commite2056d849b38b2f32556abc44abe5f50f040040f (patch)
treee4c7c08f723e8df3dbfa66cf55689d7a98baddc1 /src/core/stduihist
parentde3476b74b3d09629f927d954efeb8127263bd7b (diff)
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
Diffstat (limited to 'src/core/stduihist')
-rw-r--r--src/core/stduihist/history.cpp12
1 files changed, 10 insertions, 2 deletions
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;
}