summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-07-26 20:59:06 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-07-26 20:59:06 +0300
commitfbb56ea0b2e5cdab7b82e46752d9451701e3eb5a (patch)
tree7d6195ba1d5d12fb701e39320ba81896b12f3dcf /src
parent7d7d51840d543ea394ea4cebae53c5c6063a7e74 (diff)
fixes #3588 (Добавить кнопку отправки файла на тулбар плагинов сообщений)
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/file.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp
index 5267fad64b..ed1b9adbbf 100644
--- a/src/mir_app/src/file.cpp
+++ b/src/mir_app/src/file.cpp
@@ -151,8 +151,22 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam)
return 0;
}
+static int OnToolbarButtonPressed(WPARAM, LPARAM lParam)
+{
+ CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
+ if (mir_strcmp(cbcd->pszModule, SRFILEMODULE))
+ return 0;
+
+ if (cbcd->dwButtonId == 1) {
+ CallService(MS_FILE_SENDFILE, cbcd->hContact);
+ return 0;
+ }
+ return 1;
+}
+
static int SRFileModulesLoaded(WPARAM, LPARAM)
{
+ // Send File contact menu item
CMenuItem mi(&g_plugin);
SET_UID(mi, 0x7f8dcf77, 0xe448, 0x4505, 0xb0, 0x56, 0xb, 0xb1, 0xab, 0xac, 0x64, 0x9d);
mi.position = -2000020000;
@@ -161,6 +175,18 @@ static int SRFileModulesLoaded(WPARAM, LPARAM)
mi.pszService = MS_FILE_SENDFILE;
hSRFileMenuItem = Menu_AddContactMenuItem(&mi);
+ // SRMM toolbar button
+ BBButton bbd = {};
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ bbd.dwButtonID = 1;
+ bbd.dwDefPos = 50;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_EVENT_FILE);
+ bbd.pszModuleName = SRFILEMODULE;
+ bbd.pwszTooltip = LPGENW("Send file");
+ Srmm_AddButton(&bbd, &g_plugin);
+
+ HookEvent(ME_MSG_BUTTONPRESSED, OnToolbarButtonPressed);
+
RemoveUnreadFileEvents();
return 0;
}