summaryrefslogtreecommitdiff
path: root/protocols/CloudFile/src/menus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:55 +0300
commit931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch)
tree9fe9a6448d44030e26aa7107ce16044ed413e0d0 /protocols/CloudFile/src/menus.cpp
parentdd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff)
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'protocols/CloudFile/src/menus.cpp')
-rw-r--r--protocols/CloudFile/src/menus.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/protocols/CloudFile/src/menus.cpp b/protocols/CloudFile/src/menus.cpp
new file mode 100644
index 0000000000..3ca1b085b9
--- /dev/null
+++ b/protocols/CloudFile/src/menus.cpp
@@ -0,0 +1,52 @@
+#include "stdafx.h"
+
+HGENMENU hContactMenu;
+
+static INT_PTR UploadMenuCommand(void *obj, WPARAM hContact, LPARAM)
+{
+ CCloudService *service = (CCloudService*)obj;
+ service->OpenUploadDialog(hContact);
+ return 0;
+}
+
+void InitializeMenus()
+{
+ CMenuItem mi(&g_plugin);
+ SET_UID(mi, 0x93d4495b, 0x259b, 0x4fba, 0xbc, 0x14, 0xf9, 0x46, 0x2c, 0xda, 0xfc, 0x6d);
+ mi.name.a = LPGEN("Upload to...");
+
+ ptrA defaultService(g_plugin.getStringA("DefaultService"));
+ if (defaultService) {
+ CCloudService *service = FindService(defaultService);
+ if (service) {
+ mi.name.a = LPGEN("Upload");
+ mi.pszService = MODULENAME "/Default/Upload";
+ CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, service);
+ }
+ }
+
+ mi.position = -2000019999;
+ mi.hIcon = LoadIconEx(IDI_UPLOAD);
+ hContactMenu = Menu_AddContactMenuItem(&mi);
+}
+
+void CCloudService::OnModulesLoaded()
+{
+ CMenuItem mi(GetId());
+ mi.root = hContactMenu;
+ CMStringA serviceName(FORMAT, "/%s/Upload", GetAccountName());
+ mi.pszService = serviceName.GetBuffer();
+ mi.flags = CMIF_SYSTEM | CMIF_UNICODE;
+ mi.name.w = (wchar_t*)GetUserName();
+ mi.position = Services.getCount();
+ mi.hIcolibItem = GetIconHandle(GetIconId());
+ Menu_AddContactMenuItem(&mi);
+
+ CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, this);
+}
+
+int OnPrebuildContactMenu(WPARAM hContact, LPARAM)
+{
+ Menu_ShowItem(hContactMenu, CanSendToContact(hContact));
+ return 0;
+}