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
This commit was merged in pull request #11.
This commit is contained in:
yuanyuanxiangandQoder committed 2026-12-05 19:55:51 +01:00
1 parent ee20326bbf
commit 4bc51d2498
8 files changed
+113 -18

No files matched your search

+5 -2
View File
@@ -82,7 +82,7 @@ public:
const std::string& remotePath, const std::string& basename,
uint64_t size, uint64_t mtimeMs, const std::string& sha256,
HWND notifyHwnd, std::string& outPath, std::string& error,
std::string* outSha = nullptr);
std::string* outSha = nullptr, bool allowLarge = false);
// UI 线程:对话框关闭时放弃本窗口的所有预览请求。
void CancelForHwnd(HWND hwnd);
@@ -131,6 +131,7 @@ private:
uint64_t transferID = 0;
uint64_t size = 0;
uint64_t mtimeMs = 0;
bool allowLarge = false; // 显式"打开":放宽大小闸门/总超时,并保护本次缓存不被淘汰
std::string clientKey;
std::string clientDir;
std::string remotePath;
@@ -156,6 +157,7 @@ private:
std::string recvName;
uint64_t size = 0;
uint64_t mtimeMs = 0;
bool allowLarge = false;
std::string requestedSha;
std::string packetSha;
HWND notifyHwnd = nullptr;
@@ -192,7 +194,8 @@ private:
const std::vector<Meta>& index,
const std::string& remotePath);
static bool WriteEmptyFile(const std::string& path);
static void EnforceCacheLimits(const std::string& clientDir, std::vector<Meta>& index);
static void EnforceCacheLimits(const std::string& clientDir, std::vector<Meta>& index,
const std::string& protectName = std::string());
static bool MoveOrCopy(const std::string& from, const std::string& to);
static void RemoveTempDir(const std::string& tempDir);