From e62bc2a6f28f6a7b7fcb3996e9fab86fae3239f7 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 24 Feb 2014 17:38:35 +0000 Subject: Dropbox: - added ability to send files to contacts of other protocols - many other little improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@8263 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_menus.cpp | 39 ++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'plugins/Dropbox/src/dropbox_menus.cpp') diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index aff00f4187..f510858240 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -8,12 +8,12 @@ void CDropbox::InitMenus() mi.cbSize = sizeof(CLISTMENUITEM); mi.flags = CMIF_TCHAR; - /*mi.pszService = MODULE"/SendFilesToDropbox"; + mi.pszService = MODULE"/SendFilesToDropbox"; mi.ptszName = LPGENT("Send files to Dropbox"); - mi.position = -201000000 + CMI_SEND_FILES; + mi.position = -201002000 + CMI_SEND_FILES; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE); ContactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi); - CreateServiceFunction(mi.pszService, SendFilesToDropbox);*/ + CreateServiceFunction(mi.pszService, SendFilesToDropbox); mi.pszService = MODULE"/RequestAuthorization"; mi.ptszName = LPGENT("Request Authorization"); @@ -21,4 +21,37 @@ void CDropbox::InitMenus() mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST); ContactMenuItems[CMI_API_REQUEST_AUTH] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, RequestApiAuthorization); +} + +void CDropbox::Menu_DisableItem(HGENMENU hMenuItem, BOOL bDisable) +{ + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.cbSize = sizeof(CLISTMENUITEM); + clmi.flags = CMIM_FLAGS; + if (bDisable) + clmi.flags |= CMIF_GRAYED; + + Menu_ModifyItem(hMenuItem, &clmi); +} + +int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam) +{ + if ( !hContact) + return 0; + + //bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; + WORD status = CallContactService(hContact, PS_GETSTATUS, 0, 0); + + if (hContact == INSTANCE->GetDefaultContact() || status == ID_STATUS_OFFLINE) + Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_SEND_FILES], FALSE); + else + { + Menu_DisableItem(INSTANCE->ContactMenuItems[CMI_SEND_FILES], INSTANCE->hContactTransfer); + if (strcmp(GetContactProto(hContact), MODULE)) + { + Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_API_REQUEST_AUTH], FALSE); + } + } + + return 0; } \ No newline at end of file -- cgit v1.2.3