summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_menus.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-03-07 19:41:15 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-03-07 19:41:15 +0000
commit3997c1912c9ef57697452f357b02b10b8f5bc6a7 (patch)
tree06003caf27213aa4bd5ecaf36992b03037c7b1b3 /plugins/Dropbox/src/dropbox_menus.cpp
parent370996a4a7ced75fe363bc1c3eb34f77f5d7aee1 (diff)
Dropbox:
- code cleaning and reorganization - added "/help" command - more informative authorization request - version bumped git-svn-id: http://svn.miranda-ng.org/main/trunk@8456 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_menus.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp53
1 files changed, 8 insertions, 45 deletions
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index 0dcac861a8..a227bb4bb0 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-void CDropbox::InitMenus()
+void CDropbox::InitializeMenus()
{
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(CLISTMENUITEM);
@@ -10,60 +10,23 @@ void CDropbox::InitMenus()
mi.ptszName = LPGENT("Send files to Dropbox");
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 = 1000030000 + CMI_AUTH_REQUEST;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
- ContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, RequestApiAuthorization);
-
- mi.pszService = MODULE"/RevokeAuthorization";
- mi.ptszName = LPGENT("Revoke authorization");
- mi.position = 1000030000 + CMI_AUTH_REVOKE;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REVOKE);
- ContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, RevokeApiAuthorization);
+ contactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunctionObj(mi.pszService, SendFilesToDropbox, this);
}
-void CDropbox::Menu_DisableItem(HGENMENU hMenuItem, BOOL bDisable)
+int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM lParam)
{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.cbSize = sizeof(CLISTMENUITEM);
- clmi.flags = CMIM_FLAGS;
- if (bDisable)
- clmi.flags |= CMIF_GRAYED;
-
- Menu_ModifyItem(hMenuItem, &clmi);
-}
+ CDropbox *instance = (CDropbox*)obj;
-int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam)
-{
if (!hContact)
return 0;
- Menu_DisableItem(ContactMenuItems[CMI_SEND_FILES], FALSE);
-
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_REQUEST], FALSE);
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_REVOKE], FALSE);
- Menu_ShowItem(ContactMenuItems[CMI_SEND_FILES], FALSE);
+ Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], FALSE);
WORD status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
- if (hContact == GetDefaultContact())
- {
- if (!HasAccessToken())
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_REQUEST], TRUE);
- else
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_REVOKE], 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);
+ if (hContact != instance->GetDefaultContact() && status != ID_STATUS_OFFLINE && instance->HasAccessToken() && !instance->hTransferContact)
+ Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], TRUE);
return 0;
} \ No newline at end of file