From 2e51a3103f26ca7a9fec8f96baf56f4d51fd0112 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 27 Feb 2014 09:59:53 +0000 Subject: Dropbox: - added error notifications - fixed menu items behavior git-svn-id: http://svn.miranda-ng.org/main/trunk@8283 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_menus.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 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 a4047d4be8..ea885779ef 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -10,14 +10,14 @@ void CDropbox::InitMenus() mi.pszService = MODULE"/SendFilesToDropbox"; mi.ptszName = LPGENT("Send files to Dropbox"); - mi.position = -201002000 + CMI_SEND_FILES; + mi.position = -2000020000 + CMI_SEND_FILES; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE); ContactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, SendFilesToDropbox); mi.pszService = MODULE"/RequestAuthorization"; mi.ptszName = LPGENT("Request Authorization"); - mi.position = -201001000 + CMI_API_REQUEST_AUTH; + mi.position = -2000001000 + CMI_API_REQUEST_AUTH; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST); ContactMenuItems[CMI_API_REQUEST_AUTH] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, RequestApiAuthorization); @@ -36,23 +36,23 @@ void CDropbox::Menu_DisableItem(HGENMENU hMenuItem, BOOL bDisable) int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - if ( !hContact) + if (!hContact) return 0; - //bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; - char *module = GetContactProto(hContact); - WORD status = db_get_w(hContact, module, "Status", ID_STATUS_OFFLINE); - 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(module, MODULE)) - { - Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_API_REQUEST_AUTH], FALSE); - } + Menu_DisableItem(ContactMenuItems[CMI_SEND_FILES], FALSE); + + Menu_ShowItem(ContactMenuItems[CMI_SEND_FILES], FALSE); + Menu_ShowItem(ContactMenuItems[CMI_API_REQUEST_AUTH], FALSE); + + WORD status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE); + + if (hContact == GetDefaultContact()) + Menu_ShowItem(ContactMenuItems[CMI_API_REQUEST_AUTH], TRUE); + else if (status != ID_STATUS_OFFLINE && HasAccessToken()) + Menu_ShowItem(ContactMenuItems[CMI_SEND_FILES], TRUE); + + if (INSTANCE->hContactTransfer) + Menu_DisableItem(ContactMenuItems[CMI_SEND_FILES], TRUE); return 0; } \ No newline at end of file -- cgit v1.2.3