summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_menus.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-02-27 16:56:39 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-02-27 16:56:39 +0000
commit61e1d6d2882b1582498e412dc94ed4b35de2ed77 (patch)
tree9f5a321b17d455af6dc07b408eec415369be260f /plugins/Dropbox/src/dropbox_menus.cpp
parent3b2b36ee8addccacc150e9600f83d1d09fb2251a (diff)
Dropbox:
- added "Revoke authorization" in contact menu item - added authorization request on first start git-svn-id: http://svn.miranda-ng.org/main/trunk@8302 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_menus.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index d7a1c235ee..0dcac861a8 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -1,7 +1,5 @@
#include "common.h"
-HGENMENU CDropbox::ContactMenuItems[CMI_MAX];
-
void CDropbox::InitMenus()
{
CLISTMENUITEM mi = { 0 };
@@ -17,10 +15,17 @@ void CDropbox::InitMenus()
mi.pszService = MODULE"/RequestAuthorization";
mi.ptszName = LPGENT("Request authorization");
- mi.position = -2000001000 + CMI_API_REQUEST_AUTH;
+ mi.position = 1000030000 + CMI_AUTH_REQUEST;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
- ContactMenuItems[CMI_API_REQUEST_AUTH] = Menu_AddContactMenuItem(&mi);
+ 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);
}
void CDropbox::Menu_DisableItem(HGENMENU hMenuItem, BOOL bDisable)
@@ -41,13 +46,19 @@ int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam)
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(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);
+ {
+ 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);