summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_menus.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-02-27 09:59:53 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-02-27 09:59:53 +0000
commit2e51a3103f26ca7a9fec8f96baf56f4d51fd0112 (patch)
tree239feacbe6263d41b7bb021f4e226e2687775904 /plugins/Dropbox/src/dropbox_menus.cpp
parent9b5210ac07c6e4e00af25eb90fdf653da791299a (diff)
Dropbox:
- added error notifications - fixed menu items behavior git-svn-id: http://svn.miranda-ng.org/main/trunk@8283 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_menus.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp34
1 files changed, 17 insertions, 17 deletions
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