1 Commits
Author SHA1 Message Date
yuanyuanxiangandQoder 4bc51d2498 Feature: add a remote Open command with large-file confirmation
Add an Open item atop the remote file list context menu: a single file is
pulled back and previewed through the existing flow, a single folder
navigates into its subdirectory, and multi-selection disables it. Files
over the 8 MiB preview limit ask for confirmation; once confirmed the
explicit-open path caps the first-packet size gate at the confirmed size
and relaxes the hash query, total timeout and cache eviction so even very
large files transfer and open. When preview is disabled the explicit Open
shows a message instead of doing nothing. Double-click preview behavior is
unchanged. Localize the new menu item and dialogs in en_US/zh_TW/de_DE.

Co-Authored-By: Qoder
2026-12-05 19:55:51 +01:00
5 changed files with 20 additions and 1 deletions

No files matched your search

+7
View File
@@ -3698,6 +3698,13 @@ void CFileManagerDlg::OnRemoteOpenPreview()
return; return;
} }
// 显式"打开"受预览开关约束:禁用时给出反馈而非静默无动作(双击预览保持原静默行为)。
if (THIS_CFG.GetInt("settings", "PreviewEnabled", 1) == 0) {
::MessageBox(m_hWnd, _TR("预览功能已禁用,无法打开文件。可在参数中启用预览后重试。"),
_TR("提示"), MB_OK | MB_ICONINFORMATION);
return;
}
// 文件:构造完整路径(搜索结果第 3 列是目录,普通列表用当前远程目录)。 // 文件:构造完整路径(搜索结果第 3 列是目录,普通列表用当前远程目录)。
CString name = m_list_remote.GetItemText(nItem, 0); CString name = m_list_remote.GetItemText(nItem, 0);
CString full; CString full;
+4 -1
View File
@@ -347,8 +347,11 @@ bool CFilePreviewMgr::ObserveChunk(CONTEXT_OBJECT* ctx, const FileChunkPacketV2*
FailLocked(*req, AsStd(_TR("预览文件名越界"))); FailLocked(*req, AsStd(_TR("预览文件名越界")));
return false; return false;
} }
// 显式打开封顶到用户确认时的大小(req->size),普通预览仍用 8MiB 上限;
// 避免 allowLarge 去掉闸门后客户端声明任意大小照单落盘。
uint64_t sizeCap = req->allowLarge ? req->size : FILE_PREVIEW_MAX_BYTES;
if (pkt->totalFiles != 1 || (pkt->flags & FFV2_DIRECTORY) || if (pkt->totalFiles != 1 || (pkt->flags & FFV2_DIRECTORY) ||
(!req->allowLarge && pkt->fileSize > FILE_PREVIEW_MAX_BYTES)) { pkt->fileSize > sizeCap) {
Mprintf("[Preview] observe gate reject total=%u flags=%u size=%llu\n", Mprintf("[Preview] observe gate reject total=%u flags=%u size=%llu\n",
(unsigned)pkt->totalFiles, (unsigned)pkt->flags, (unsigned)pkt->totalFiles, (unsigned)pkt->flags,
(unsigned long long)pkt->fileSize); (unsigned long long)pkt->fileSize);
+3
View File
@@ -2375,3 +2375,6 @@ MCP
; File manager remote Open (preview) menu + large-file confirmation ; File manager remote Open (preview) menu + large-file confirmation
打开(&O)=&Oeffnen 打开(&O)=&Oeffnen
文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=Grosse Datei: %s (%llu MB, ueberschreitet das %u MB-Vorschaulimit).\nTrotzdem auf diesen Rechner uebertragen und oeffnen? Grosse Uebertragungen koennen laenger dauern. 文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=Grosse Datei: %s (%llu MB, ueberschreitet das %u MB-Vorschaulimit).\nTrotzdem auf diesen Rechner uebertragen und oeffnen? Grosse Uebertragungen koennen laenger dauern.
; File manager remote Open: preview disabled feedback
预览功能已禁用,无法打开文件。可在参数中启用预览后重试。=Die Vorschau ist deaktiviert, die Datei kann nicht geoeffnet werden. Aktivieren Sie die Vorschau in den Einstellungen und versuchen Sie es erneut.
+3
View File
@@ -2386,3 +2386,6 @@ MCP
; File manager remote Open (preview) menu + large-file confirmation ; File manager remote Open (preview) menu + large-file confirmation
打开(&O)=&Open 打开(&O)=&Open
文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=Large file: %s (%llu MB, exceeds the %u MB preview limit).\nTransfer it to this machine and open anyway? Large transfers may take a while. 文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=Large file: %s (%llu MB, exceeds the %u MB preview limit).\nTransfer it to this machine and open anyway? Large transfers may take a while.
; File manager remote Open: preview disabled feedback
预览功能已禁用,无法打开文件。可在参数中启用预览后重试。=Preview is disabled, so the file cannot be opened. Enable preview in Settings and try again.
+3
View File
@@ -2379,3 +2379,6 @@ MCP
; File manager remote Open (preview) menu + large-file confirmation ; File manager remote Open (preview) menu + large-file confirmation
打开(&O)=開啟(&O) 打开(&O)=開啟(&O)
文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=檔案較大:%s(%llu MB,超過 %u MB 預覽上限)。\n仍要傳輸到本機並開啟嗎?大檔案傳輸可能耗時較長。 文件较大:%s(%llu MB,超过 %u MB 预览上限)。\n仍要传输到本机并打开吗?大文件传输可能耗时较长。=檔案較大:%s(%llu MB,超過 %u MB 預覽上限)。\n仍要傳輸到本機並開啟嗎?大檔案傳輸可能耗時較長。
; File manager remote Open: preview disabled feedback
预览功能已禁用,无法打开文件。可在参数中启用预览后重试。=預覽功能已停用,無法開啟檔案。可在參數中啟用預覽後重試。