diff options
author | aunsane <aunsane@gmail.com> | 2017-05-07 02:25:29 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-05-07 02:25:29 +0300 |
commit | ff6a107e5f566da2644fbfe36455467beafaeb1e (patch) | |
tree | 3d5b96794ee835c8686a74da6c418c440c91c403 /plugins/CloudFile/src/srmm.cpp | |
parent | 453b3de91c372ee7b2661771aead6675e12fe98f (diff) |
CloudFile:
- reworked options to dupport default service
- added options to select conflict behavior
- multiple fix and refactoring
- version bump
Diffstat (limited to 'plugins/CloudFile/src/srmm.cpp')
-rw-r--r-- | plugins/CloudFile/src/srmm.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp index 8781479c1b..58d8ef9708 100644 --- a/plugins/CloudFile/src/srmm.cpp +++ b/plugins/CloudFile/src/srmm.cpp @@ -4,9 +4,9 @@ int OnSrmmToolbarLoaded(WPARAM, LPARAM) { BBButton bbd = {}; bbd.pszModuleName = MODULE; - bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; + bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_ISARROWBUTTON; - CMStringW tooltip(CMStringDataFormat::FORMAT, TranslateT("Upload files to...")); + CMStringW tooltip(FORMAT, TranslateT("Upload files to...")); bbd.pwszTooltip = tooltip; bbd.hIcon = GetIconHandle(IDI_UPLOAD); bbd.dwButtonID = BBB_ID_FILE_SEND; @@ -20,18 +20,12 @@ int OnSrmmWindowOpened(WPARAM, LPARAM lParam) { MessageWindowEventData *ev = (MessageWindowEventData*)lParam; if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact) { - char *proto = GetContactProto(ev->hContact); - bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE; - WORD status = db_get_w(ev->hContact, proto, "Status", ID_STATUS_OFFLINE); - bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0; - BBButton bbd = {}; bbd.pszModuleName = MODULE; bbd.dwButtonID = BBB_ID_FILE_SEND; - bbd.bbbFlags = BBSF_RELEASED; - if (!isProtoOnline || (status == ID_STATUS_OFFLINE && !canSendOffline)) - bbd.bbbFlags = BBSF_DISABLED; - + bbd.bbbFlags = CanSendToContact(ev->hContact) + ? BBSF_RELEASED + : BBSF_DISABLED; Srmm_SetButtonState(ev->hContact, &bbd); } @@ -48,23 +42,31 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam) if (cbc->dwButtonId != BBB_ID_FILE_SEND) return 0; + if (cbc->flags != BBCF_ARROWCLICKED) { + ptrA defaultService(db_get_sa(NULL, MODULE, "DefaultService")); + if (defaultService) { + CCloudServiceSearch search(defaultService); + CCloudService *service = Services.find(&search); + if (service) + service->OpenUploadDialog(cbc->hContact); + return 0; + } + } + HMENU hMenu = CreatePopupMenu(); size_t count = Services.getCount(); for (size_t i = 0; i < count; i++) { CCloudService *service = Services[i]; - if (!db_get_b(NULL, service->GetModule(), "IsEnable", TRUE)) - continue; - - InsertMenu(hMenu, i, MF_STRING, i + 1, TranslateW(service->GetText())); + InsertMenu(hMenu, i, MF_STRING | MF_BYPOSITION, i + 1,TranslateW(service->GetText())); //HBITMAP hBitmap = (HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(service->GetIconId()), IMAGE_ICON, 16, 16, 0); //SetMenuItemBitmaps(hMenu, i, MF_BITMAP, hBitmap, hBitmap); } - int ind = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, NULL); - if (ind > 0) { - CCloudService *service = Services[ind - 1]; + int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, NULL); + if (pos > 0) { + CCloudService *service = Services[pos - 1]; service->OpenUploadDialog(cbc->hContact); } |