diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 17:38:35 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 17:38:35 +0000 |
commit | e62bc2a6f28f6a7b7fcb3996e9fab86fae3239f7 (patch) | |
tree | 6fc970809eb2fbbbf383c1639f83c93a2edf406b /plugins/Dropbox/src/dropbox_menus.cpp | |
parent | 994443d6cdca5a5a1204575a0cea2a198c9d01bb (diff) |
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
Diffstat (limited to 'plugins/Dropbox/src/dropbox_menus.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_menus.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
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 |