diff options
author | George Hazan <george.hazan@gmail.com> | 2023-07-29 14:23:02 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-07-29 14:23:02 +0300 |
commit | edbfd659e4990494670e535d5be282659cd5bfc8 (patch) | |
tree | 47dabe0dd71e2fa07b8476273e58ead785317f36 /src | |
parent | a63fdd451d23aa5d4b33c1bcf3540bea411f3358 (diff) |
fixes #3602 ("Copy path" в контекстном меню для файлов)
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/srmm_log_rtf.cpp | 19 | ||||
-rw-r--r-- | src/mir_app/src/srmm_util.cpp | 33 |
4 files changed, 34 insertions, 22 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 1d06496629..e9772a9c25 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -246,7 +246,7 @@ Srmm_RedrawToolbarIcons @338 ?Srmm_GetNthButton@@YGPAUCustomButtonData@@H@Z @339 NONAME
?Srmm_GetButtonCount@@YGHXZ @340 NONAME
?Srmm_ClickToolbarIcon@@YGXIHPAUHWND__@@H@Z @341 NONAME
-?Srmm_DownloadOfflineFile@@YGXII_N@Z @342 NONAME
+?Srmm_DownloadOfflineFile@@YGXIIH@Z @342 NONAME
Miranda_OkToExit @344
Miranda_GetVersion @345
Miranda_GetFileVersion @346
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 8c6bc1eadc..81ce7fd596 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -246,7 +246,7 @@ Srmm_RedrawToolbarIcons @338 ?Srmm_GetNthButton@@YAPEAUCustomButtonData@@H@Z @339 NONAME
?Srmm_GetButtonCount@@YAHXZ @340 NONAME
?Srmm_ClickToolbarIcon@@YAXIHPEAUHWND__@@H@Z @341 NONAME
-?Srmm_DownloadOfflineFile@@YAXII_N@Z @342 NONAME
+?Srmm_DownloadOfflineFile@@YAXIIH@Z @342 NONAME
Miranda_OkToExit @344
Miranda_GetVersion @345
Miranda_GetFileVersion @346
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index 5ea77b4707..7ad3fb4659 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -243,24 +243,7 @@ INT_PTR CRtfLogWindow::Notify(WPARAM, LPARAM lParam) break;
case 5:
- wchar_t str[MAX_PATH];
- mir_wstrncpy(str, blob.getName(), _countof(str));
- {
- wchar_t filter[512];
- mir_snwprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
-
- OPENFILENAME ofn = {};
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = str;
- ofn.nMaxFile = _countof(str);
- ofn.nMaxFileTitle = MAX_PATH;
- if (!GetSaveFileNameW(&ofn))
- break;
- }
-
- DownloadOfflineFile(m_pDlg.m_hContact, hDbEvent, nCmd == 2, new OFD_SaveAs(str));
+ Srmm_DownloadOfflineFile(m_pDlg.m_hContact, hDbEvent, OFD_RUN | OFD_SAVEAS);
break;
}
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index a7f95f7752..bd942a0a8a 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -195,9 +195,38 @@ void DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, bool bOpen, OFD_Cal }
}
-MIR_APP_DLL(void) Srmm_DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, bool bOpen)
+MIR_APP_DLL(void) Srmm_DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, int iCommand)
{
- DownloadOfflineFile(hContact, hDbEvent, bOpen, new OFD_Download());
+ bool bOpen = false;
+ if (iCommand & OFD_RUN) {
+ bOpen = true;
+ iCommand &= ~OFD_RUN;
+ }
+
+ if (iCommand == OFD_SAVEAS) {
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
+ return;
+
+ DB::FILE_BLOB blob(dbei);
+
+ wchar_t str[MAX_PATH];
+ mir_wstrncpy(str, blob.getName(), _countof(str));
+
+ wchar_t filter[512];
+ mir_snwprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
+
+ OPENFILENAME ofn = {};
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = str;
+ ofn.nMaxFile = _countof(str);
+ ofn.nMaxFileTitle = MAX_PATH;
+ if (GetSaveFileNameW(&ofn))
+ DownloadOfflineFile(hContact, hDbEvent, bOpen, new OFD_SaveAs(str));
+ }
+ else DownloadOfflineFile(hContact, hDbEvent, bOpen, new OFD_Download());
}
/////////////////////////////////////////////////////////////////////////////////////////
|