Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba61c2ee9b | ||
|
|
1d60b3a0b6 | ||
|
|
ce36d73b66 | ||
|
|
aa90645c98 | ||
|
|
07646d3642 | ||
|
|
9a5479b8f9 | ||
|
|
9edb27c765 | ||
|
|
5194e2b621 | ||
|
|
da914168e8 | ||
|
|
15bf006a19 |
No files matched your search
+8
-2
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.8.0 LANGUAGES C CXX RC)
|
||||
project(KSwitcher VERSION 0.8.1 LANGUAGES C CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
@@ -81,7 +81,8 @@ set_property(SOURCE resources/help.rc APPEND PROPERTY OBJECT_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resources/help-guide.md"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/README.md"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/FILES-UI.md"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LAN-PREVIEW.md")
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LAN-PREVIEW.md"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Release/README.md")
|
||||
add_executable(KSwitcher WIN32 src/main.cpp src/app.cpp src/screenshot_notifications.cpp src/screenshot_launcher.cpp src/screenshot_activation.cpp src/configuration.cpp src/ui.cpp resources/app.rc resources/help.rc)
|
||||
target_compile_definitions(KSwitcher PRIVATE KS_RESIDENT_APP)
|
||||
target_link_libraries(KSwitcher PRIVATE kscore)
|
||||
@@ -239,6 +240,11 @@ add_test(NAME files-smb-password
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_smb_password.ps1"
|
||||
-Executable "$<TARGET_FILE:KSwitcherFiles>")
|
||||
set_tests_properties(files-smb-password PROPERTIES RUN_SERIAL TRUE TIMEOUT 30)
|
||||
add_test(NAME files-recent-folders-panel
|
||||
COMMAND "${KSWITCHER_POWERSHELL}" -NoProfile -ExecutionPolicy Bypass
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_recent_folders_panel.ps1"
|
||||
-Executable "$<TARGET_FILE:KSwitcherFiles>")
|
||||
set_tests_properties(files-recent-folders-panel PROPERTIES RUN_SERIAL TRUE TIMEOUT 35)
|
||||
add_test(NAME files-space-analyzer-layout
|
||||
COMMAND "${KSWITCHER_POWERSHELL}" -NoProfile -ExecutionPolicy Bypass
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_space_analyzer_layout.ps1"
|
||||
|
||||
+7
-6
@@ -709,12 +709,13 @@ Warning і початковий фокус на No.
|
||||
показують перший кадр. Пошкоджені та надто великі файли показують повідомлення.
|
||||
|
||||
- **Change drive → Recent folders** у меню Alt+F1 або Alt+F2 показує
|
||||
останні відвідані локальні, FTP, SFTP та LAN-папки. Повторний візит підіймає
|
||||
один запис угору, порядок зберігається після перезапуску. Enter або клік
|
||||
відкриває шлях у панелі, з якої викликали меню. Віддалені записи містять
|
||||
шлях і ідентифікатор збереженого FTP- чи SFTP-профілю або спареного ПК. Паролі
|
||||
зберігаються в захищених налаштуваннях профілів. Delete прибирає вибраний
|
||||
запис із недавніх.
|
||||
останні відвідані локальні, FTP, SFTP та LAN-папки у вибраній панелі.
|
||||
**Enter** або подвійний клік відкриває папку в тій самій панелі.
|
||||
**Delete** прибирає запис із недавніх. **Esc** повертає попередню папку.
|
||||
Повторний візит підіймає один запис угору, порядок зберігається після
|
||||
перезапуску. Віддалені записи містять шлях і ідентифікатор збереженого
|
||||
FTP- чи SFTP-профілю або спареного ПК. Паролі зберігаються в захищених
|
||||
налаштуваннях профілів.
|
||||
|
||||
- Кнопки ← та → переходять назад і вперед в історії відповідної панелі,
|
||||
зокрема між локальними, FTP, SFTP та LAN-папками. Стрілка ↑, Alt+↑ та рядок `..`
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.8.1 — 2026-11-26
|
||||
|
||||
- **SMB.** Saved connections and a server’s shares open in the selected Files panel. Press **Enter** to open a connection or share. **Esc** returns to the previous list or folder. Profile editing and sign-in use their existing dialogs.
|
||||
- **Recent folders.** The selected panel shows recent local and remote folders. **Enter** opens the entry in that panel, **Delete** removes the history entry, and **Esc** restores the previous folder and cursor.
|
||||
|
||||
**Українською.**
|
||||
|
||||
- **SMB.** Збережені підключення та спільні ресурси сервера відкриваються у вибраній панелі Files. **Enter** відкриває підключення чи ресурс. **Esc** повертає до попереднього списку або папки. Для редагування профілю та входу використовуються окремі діалоги.
|
||||
- **Recent folders.** Вибрана панель показує нещодавні локальні й віддалені папки. **Enter** відкриває запис у цій панелі, **Delete** прибирає його з історії, а **Esc** відновлює попередню папку й курсор.
|
||||
|
||||
## v0.8.0 — 2026-11-26
|
||||
|
||||
- **Files panels and search.** Find files recursively on local, FTP, SFTP and paired LAN panes. Work with results directly, navigate with breadcrumbs and history, recall recent folders, and configure sorting, filters, columns and panel layout. File clipboard and drag and drop integrate with Windows.
|
||||
|
||||
@@ -1 +1 @@
|
||||
3d1d0d0a1c9ad671c949e0744987c94642125ccb2f479d3126509250c1fca541 KSwitcher-win-x64.zip
|
||||
4f73fa962a4a84ebb7b564fdb5e8cac6baeeff460d3e7147f09d6ded62553021 KSwitcher-win-x64.zip
|
||||
+84
-84
@@ -1,181 +1,181 @@
|
||||
{
|
||||
"files": [
|
||||
{
|
||||
"sha256": "48fb46c472b1a3e689ff7a594f2ba728abee1b0ae2163333901179b624c23fe1",
|
||||
"size": 3192832,
|
||||
"path": "KSwitcher.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "cf6f71169c79bb915c633765a4d56e6048e9a2c84ff877226158e9a27c8183ee",
|
||||
"size": 2892800,
|
||||
"path": "KSwitcher.Config.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "79ec0555f9a2668fd284dd73663e2a2aecbc5833dba39e2b02a45b88ad1cae3d",
|
||||
"size": 3193344,
|
||||
"path": "KSwitcher.Screenshot.exe"
|
||||
"path": "KSwitcher.exe",
|
||||
"sha256": "ceaeff987356f31cc4e1773b41825fe8bc621d51abd9884964339457b724198f"
|
||||
},
|
||||
{
|
||||
"sha256": "ebe481402fadc09f60afef4dc7ece293d2709c0f3931154d474fbc9a12c7d6a6",
|
||||
"size": 5967872,
|
||||
"path": "KSwitcher.Files.exe"
|
||||
"size": 2892800,
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"sha256": "d2d8fabbe9758d6744b04014cddc96cd7c87710249e025594861ed7bec508b9b"
|
||||
},
|
||||
{
|
||||
"size": 3193344,
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"sha256": "b2503e613fa203773a6ead05efaf4430fb297d642569ac64927a77acd78f53a8"
|
||||
},
|
||||
{
|
||||
"size": 5977600,
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"sha256": "047d8ba01a3a316ca53c609283dee2638474731390dee74427ea881cc71d3617"
|
||||
},
|
||||
{
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"size": 194912,
|
||||
"path": "WebView2Loader.dll"
|
||||
"path": "WebView2Loader.dll",
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
|
||||
},
|
||||
{
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"size": 1103,
|
||||
"path": "terminal/addon-fit-LICENSE.txt"
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
|
||||
},
|
||||
{
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"size": 1521,
|
||||
"path": "terminal/addon-fit.js"
|
||||
"path": "terminal/addon-fit.js",
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
|
||||
},
|
||||
{
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"size": 527,
|
||||
"path": "terminal/index.html"
|
||||
"path": "terminal/index.html",
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
|
||||
},
|
||||
{
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"size": 1073,
|
||||
"path": "terminal/markdown-it-LICENSE.txt"
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
|
||||
},
|
||||
{
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"size": 100786,
|
||||
"path": "terminal/markdown-it.js"
|
||||
"path": "terminal/markdown-it.js",
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
|
||||
},
|
||||
{
|
||||
"sha256": "2576d0c897ffa7e78eb73fc065cd438af164b5dd332cc59083a53ac692fd575f",
|
||||
"size": 3740,
|
||||
"path": "terminal/markdown.html"
|
||||
"size": 3800,
|
||||
"path": "terminal/markdown.html",
|
||||
"sha256": "98984c8f76bd231dab00ef54034bfc2f29b365ee0b31c05edb16ad5216bd5bc2"
|
||||
},
|
||||
{
|
||||
"sha256": "1eaf9a8a63ec5a62eb4e710cd413bf6893dbc9eaf7dbf4898927fb44afa08bbc",
|
||||
"size": 18318,
|
||||
"path": "terminal/markdown.js"
|
||||
"size": 18721,
|
||||
"path": "terminal/markdown.js",
|
||||
"sha256": "8b5429a035ce8ce11f77a222b5ee946844fd1e2999e1bb5c8f7c030ddbb1ff96"
|
||||
},
|
||||
{
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"size": 1089,
|
||||
"path": "terminal/mermaid-LICENSE.txt"
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
|
||||
},
|
||||
{
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"size": 5537838,
|
||||
"path": "terminal/mermaid.js"
|
||||
"path": "terminal/mermaid.js",
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
|
||||
},
|
||||
{
|
||||
"sha256": "838707e2813f7d007f7f60670a78ae4a4a6c97ca9a235d623cb85e16dc50e0c7",
|
||||
"size": 6627,
|
||||
"path": "terminal/terminal.js"
|
||||
"path": "terminal/terminal.js",
|
||||
"sha256": "838707e2813f7d007f7f60670a78ae4a4a6c97ca9a235d623cb85e16dc50e0c7"
|
||||
},
|
||||
{
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"size": 1261,
|
||||
"path": "terminal/xterm-LICENSE.txt"
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
|
||||
},
|
||||
{
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"size": 7112,
|
||||
"path": "terminal/xterm.css"
|
||||
"path": "terminal/xterm.css",
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
|
||||
},
|
||||
{
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"size": 488663,
|
||||
"path": "terminal/xterm.js"
|
||||
"path": "terminal/xterm.js",
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
|
||||
},
|
||||
{
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"size": 4401,
|
||||
"path": "LICENSE"
|
||||
"path": "LICENSE",
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
|
||||
},
|
||||
{
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"size": 1096,
|
||||
"path": "json-LICENSE.txt"
|
||||
"path": "json-LICENSE.txt",
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831"
|
||||
},
|
||||
{
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"size": 883,
|
||||
"path": "files-text-license.txt"
|
||||
"path": "files-text-license.txt",
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
|
||||
},
|
||||
{
|
||||
"sha256": "0b1d38528f1da5acccfb02634a91e3aa753547e137ccd1eebd0873fef2a9dd74",
|
||||
"size": 4880,
|
||||
"path": "files-archive-license.txt"
|
||||
"size": 4990,
|
||||
"path": "files-archive-license.txt",
|
||||
"sha256": "57d6d9b1f85ac93b3bc73f6f7bdf4346e896c4644d6fa461c380ae29070c029d"
|
||||
},
|
||||
{
|
||||
"sha256": "c94d49ba533db63c368a49a7e630ac7e947634cb6dc87cfaab7627272cc3e3e7",
|
||||
"size": 2994,
|
||||
"path": "files-image-license.txt"
|
||||
"size": 3044,
|
||||
"path": "files-image-license.txt",
|
||||
"sha256": "7997c62a2f766674ceb99976485a6cf5c772309e79101a400c421d526b82f6e4"
|
||||
},
|
||||
{
|
||||
"sha256": "05894358228417bb0c524b5c800119b1d47ac0de3477e7cd1abe7a6b41580809",
|
||||
"size": 2024,
|
||||
"path": "files-sftp-license.txt"
|
||||
"size": 2064,
|
||||
"path": "files-sftp-license.txt",
|
||||
"sha256": "19c254c71ee49aefbd8854ac55b05d719c5f1e4f8ef9a982324b898501b39594"
|
||||
},
|
||||
{
|
||||
"sha256": "be1b3fca2a291284ab550e9e77042fb27ecf927861d2d8fb8ec4907258477f01",
|
||||
"size": 105515,
|
||||
"path": "README.md"
|
||||
"path": "README.md",
|
||||
"sha256": "be1b3fca2a291284ab550e9e77042fb27ecf927861d2d8fb8ec4907258477f01"
|
||||
},
|
||||
{
|
||||
"sha256": "435ace9c718e14e4c391462ffea3a893c9b6622e9a8b861a7dab0492faf61469",
|
||||
"size": 16474,
|
||||
"path": "LAN-PREVIEW.md"
|
||||
"size": 16722,
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"sha256": "917c2f41b3943647fdfafa911d93f72b8c6fb0d08592016ce1a698d256e038bb"
|
||||
},
|
||||
{
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"size": 732485,
|
||||
"path": "dictionaries/en.txt"
|
||||
"path": "dictionaries/en.txt",
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9"
|
||||
},
|
||||
{
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"size": 20566,
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5"
|
||||
},
|
||||
{
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"size": 2265,
|
||||
"path": "dictionaries/README.md"
|
||||
"path": "dictionaries/README.md",
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
|
||||
},
|
||||
{
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"size": 1109134,
|
||||
"path": "dictionaries/ru.txt"
|
||||
"path": "dictionaries/ru.txt",
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849"
|
||||
},
|
||||
{
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"size": 1280,
|
||||
"path": "dictionaries/sources.json"
|
||||
"path": "dictionaries/sources.json",
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
|
||||
},
|
||||
{
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"size": 940799,
|
||||
"path": "dictionaries/uk.txt"
|
||||
"path": "dictionaries/uk.txt",
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
|
||||
},
|
||||
{
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"size": 993,
|
||||
"path": "tools/README.txt"
|
||||
"path": "tools/README.txt",
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
|
||||
},
|
||||
{
|
||||
"sha256": "d4de0a3606267a1c2585412e1288d3be782786720ff1f2ccd9b2217e053bc11b",
|
||||
"size": 133120,
|
||||
"path": "tools/StayHere.exe"
|
||||
"path": "tools/StayHere.exe",
|
||||
"sha256": "98f657cdd3d5dec5db8b45760edc656e23c362edc9002b6828d2fe4c8b86073b"
|
||||
},
|
||||
{
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"size": 2796,
|
||||
"path": "tools/StayHere-README.md"
|
||||
"path": "tools/StayHere-README.md",
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
|
||||
}
|
||||
],
|
||||
"schema": 1,
|
||||
"version": "0.8.0"
|
||||
"version": "0.8.1"
|
||||
}
|
||||
+3
-3
@@ -14,8 +14,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
|
||||
1 RT_MANIFEST "app.manifest"
|
||||
201 RCDATA "update.ps1"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,8,0,0
|
||||
PRODUCTVERSION 0,8,0,0
|
||||
FILEVERSION 0,8,1,0
|
||||
PRODUCTVERSION 0,8,1,0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
BEGIN
|
||||
@@ -25,7 +25,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
|
||||
VALUE "ProductName", "KSwitcher"
|
||||
VALUE "FileVersion", "0.8.0"
|
||||
VALUE "FileVersion", "0.8.1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -58,6 +58,8 @@ Choose Files from the tray. Use the two file panels to browse, move and copy fil
|
||||
|
||||
Use the tray menu to pause or resume input processing, keep the display awake, pause clipboard history, open the data folder, check for updates or exit. Tools lists supported portable utilities placed in the tools folder.
|
||||
|
||||
After a successful update, What's new shows the installed release notes once. Open Help → What's new from the tray to read current and earlier releases offline or open the full release page in Gitea.
|
||||
|
||||
If a shortcut stops working, check whether input processing is paused and whether another application owns the binding. If a paired PC is missing, check discovery and access on both computers. Settings → Diagnostics and View log in the tray provide logs. Settings → MCP displays management integration settings.
|
||||
|
||||
Donate via Monobank opens the project's donation jar in the browser. Choose Help → About KSwitcher to see the running version.
|
||||
@@ -4,3 +4,4 @@ IDR_HELP_GUIDE RCDATA "help-guide.md"
|
||||
IDR_HELP_MANUAL RCDATA "../README.md"
|
||||
IDR_HELP_FILES RCDATA "../FILES-UI.md"
|
||||
IDR_HELP_COMPUTERS RCDATA "../LAN-PREVIEW.md"
|
||||
IDR_HELP_RELEASES RCDATA "../Release/README.md"
|
||||
@@ -14,3 +14,4 @@
|
||||
#define IDR_HELP_MANUAL 601
|
||||
#define IDR_HELP_FILES 602
|
||||
#define IDR_HELP_COMPUTERS 603
|
||||
#define IDR_HELP_RELEASES 604
|
||||
+33
-14
@@ -144,7 +144,7 @@ ULONG_PTR snippetReplayMarker()
|
||||
return reinterpret_cast<ULONG_PTR>(&marker);
|
||||
}
|
||||
constexpr int OpenFiles = 25, FilesHotkeyFirst = 0x4B10, FilesHotkeySecond = 0x4B11;
|
||||
constexpr int ToggleInputProcessing = 26, DonateViaMonobank = 27, OpenHelp = 28, OpenAbout = 16;
|
||||
constexpr int ToggleInputProcessing = 26, DonateViaMonobank = 27, OpenHelp = 28, OpenWhatsNew = 29, OpenAbout = 16;
|
||||
constexpr wchar_t MonobankDonationUrl[] = L"https://send.monobank.ua/jar/88h2TddKfS";
|
||||
constexpr int ShortcutProbeId = FilesHotkeySecond + 1;
|
||||
constexpr UINT_PTR PauseDrainTimer = 23;
|
||||
@@ -660,21 +660,18 @@ class Transaction
|
||||
}
|
||||
auto text = select(count) ? copy() : std::wstring{};
|
||||
diagnosticEvent(L"Selection initial match=" + std::to_wstring(matches(text)) + L" copied=" + diagnosticText(text));
|
||||
// Chromium editors can apply only part of a burst of Shift+Left events.
|
||||
// Extend only a verified suffix; never replace a partial or unrelated range.
|
||||
// The editor may finish applying queued Shift+Left events after copying
|
||||
// the suffix. Collapse to its right edge before trying the full range again.
|
||||
if (valid() && !matches(text) && !text.empty() &&
|
||||
(suffixMatches ? suffixMatches(text) : newlines(wordCandidate).ends_with(newlines(text))) &&
|
||||
caretSteps(text) < count)
|
||||
{
|
||||
const auto missing = count - caretSteps(text);
|
||||
diagnosticEvent(L"Selection: extending verified suffix by " + std::to_wstring(missing));
|
||||
for (size_t i = 0; i < missing; ++i)
|
||||
{
|
||||
if (!valid() || !chord(VK_LEFT, MOD_SHIFT))
|
||||
return {};
|
||||
diagnosticEvent(L"Selection recovery Shift+Left sent=" + std::to_wstring(i + 1) + L" total=" + std::to_wstring(missing));
|
||||
Sleep(25);
|
||||
}
|
||||
diagnosticEvent(L"Selection: reselecting full range after verified suffix");
|
||||
if (!finishSelection(false))
|
||||
return {};
|
||||
Sleep(25);
|
||||
if (!selectPrevious(count, [&] { return valid(); }, true))
|
||||
return {};
|
||||
text = copy();
|
||||
diagnosticEvent(L"Selection: suffix recovery match=" + std::to_wstring(matches(text)) + L" copied=" + diagnosticText(text));
|
||||
}
|
||||
@@ -3269,6 +3266,7 @@ void App::trayMenu()
|
||||
AppendMenuW(menu, MF_SEPARATOR, 0, nullptr);
|
||||
HMENU help = CreatePopupMenu();
|
||||
AppendMenuW(help, MF_STRING, OpenHelp, L"&User guide");
|
||||
AppendMenuW(help, MF_STRING, OpenWhatsNew, whatsNewTitle(GetThreadUILanguage()));
|
||||
AppendMenuW(help, MF_STRING, OpenAbout, L"&About KSwitcher");
|
||||
AppendMenuW(menu, MF_POPUP, reinterpret_cast<UINT_PTR>(help), L"H&elp");
|
||||
AppendMenuW(menu, MF_STRING, 17, L"E&xit");
|
||||
@@ -3333,6 +3331,9 @@ void App::trayMenu()
|
||||
case OpenHelp:
|
||||
showHelp(*this);
|
||||
break;
|
||||
case OpenWhatsNew:
|
||||
showWhatsNew(*this, GetThreadUILanguage());
|
||||
break;
|
||||
case DonateViaMonobank:
|
||||
if (reinterpret_cast<INT_PTR>(ShellExecuteW(window, L"open", MonobankDonationUrl, nullptr, nullptr, SW_SHOWNORMAL)) <= 32)
|
||||
throw std::runtime_error("Could not open the Monobank donation page.");
|
||||
@@ -3372,6 +3373,25 @@ void App::trayMenu()
|
||||
report(wide(e.what()));
|
||||
}
|
||||
}
|
||||
void App::showWhatsNewAfterUpdate()
|
||||
{
|
||||
if (!confirmUpdatedStartup(updateStartupEvent)) return;
|
||||
log(std::wstring(L"Update completed; running version ") + AppVersion);
|
||||
try
|
||||
{
|
||||
const auto seen = data / L"whats-new-seen.txt";
|
||||
const auto version = utf8(AppVersion);
|
||||
if (std::filesystem::exists(seen) && readFile(seen, 64) == Bytes(version.begin(), version.end()))
|
||||
return;
|
||||
showWhatsNew(*this, GetThreadUILanguage());
|
||||
atomicWrite(seen, Bytes(version.begin(), version.end()));
|
||||
}
|
||||
catch (const std::exception &error)
|
||||
{
|
||||
log(L"Could not show release notes: " + wide(error.what()));
|
||||
}
|
||||
}
|
||||
|
||||
void App::checkUpdate(bool interactive, bool install, const std::wstring &version)
|
||||
{
|
||||
if (updateRunning) return;
|
||||
@@ -3876,8 +3896,6 @@ int App::execute()
|
||||
SetTimer(window, 2, 10000, nullptr);
|
||||
else
|
||||
SetTimer(window, 5, 5000, nullptr);
|
||||
if (keyboardHook && mouseHook && confirmUpdatedStartup(updateStartupEvent))
|
||||
log(std::wstring(L"Update completed; running version ") + AppVersion);
|
||||
if (startCommand)
|
||||
PostMessageW(window, WM_HOTKEY, startCommand, 0);
|
||||
if (!smoke && !isLocalBuild() && settings.autostart)
|
||||
@@ -3885,6 +3903,7 @@ int App::execute()
|
||||
try { notificationRegistration = startScreenshotNotificationRegistration(); }
|
||||
catch(const std::exception &e) { log(L"Screenshot notification registration: "+wide(e.what())); }
|
||||
auto screenshotActivation=startScreenshotActivationListener();
|
||||
if (keyboardHook && mouseHook) showWhatsNewAfterUpdate();
|
||||
MSG msg;
|
||||
while (GetMessageW(&msg, nullptr, 0, 0) > 0)
|
||||
{
|
||||
|
||||
@@ -78,6 +78,7 @@ class App
|
||||
void enqueue(std::function<void()>);
|
||||
void enqueueHistorySearch(std::function<void()>);
|
||||
void report(const std::wstring &);
|
||||
void showWhatsNewAfterUpdate();
|
||||
void trayMenu();
|
||||
void addTray();
|
||||
bool registerHotkeys(const Settings &, bool rollback = false);
|
||||
@@ -234,5 +235,7 @@ void showLogs(App &);
|
||||
void showSnippets(App &);
|
||||
void showShortcuts(App &);
|
||||
void showHelp(App &);
|
||||
const wchar_t *whatsNewTitle(LANGID language);
|
||||
void showWhatsNew(App &, LANGID language);
|
||||
void showEntry(App &, const std::wstring &);
|
||||
} // namespace ks
|
||||
@@ -1230,7 +1230,7 @@ bool selectedComparisonFiles(CompareFile (&files)[2])
|
||||
const auto pick=[](const Panel &panel,const fs::path &path,CompareFile &file)
|
||||
{
|
||||
const auto row=std::find(panel.rows.begin(),panel.rows.end(),path);
|
||||
if(panel.archive || connectionList(panel) || row==panel.rows.end() || panel.sizes[row-panel.rows.begin()]==L"Folder")
|
||||
if(panel.archive || panelListsLocations(panel) || row==panel.rows.end() || panel.sizes[row-panel.rows.begin()]==L"Folder")
|
||||
return false;
|
||||
const auto directory=path.parent_path();
|
||||
const auto tail=(directory.filename()/path.filename()).native();
|
||||
|
||||
@@ -94,9 +94,18 @@ void showFilesPanelContext(Panel &panel,LRESULT row,POINT screen)
|
||||
if(!popup.handle) return;
|
||||
constexpr UINT openItem=1,findItems=2,newProfile=3,properties=4;
|
||||
const auto add=[&](UINT id,const wchar_t *label){AppendMenuW(popup.handle,MF_STRING,id,label);};
|
||||
if(panel.smb)
|
||||
if(recentFolderList(panel))
|
||||
{
|
||||
if(panel.smb->server.empty())
|
||||
if(row!=LB_ERR)
|
||||
{
|
||||
add(openItem,L"Open folder");
|
||||
add(117,L"Remove from recent");
|
||||
}
|
||||
add(110,L"Refresh panel");
|
||||
}
|
||||
else if(panel.listing)
|
||||
{
|
||||
if(panel.listing->smb->server.empty())
|
||||
{
|
||||
if(row!=LB_ERR)
|
||||
{
|
||||
@@ -147,7 +156,7 @@ void showFilesPanelContext(Panel &panel,LRESULT row,POINT screen)
|
||||
else if(command==findItems) findPanelFiles(owner,panel);
|
||||
else if(command==newProfile)
|
||||
{
|
||||
if(panel.smb) editSmbProfile(panel,true);
|
||||
if(panel.listing) editSmbProfile(panel,true);
|
||||
else editTransferProfile(panel,true);
|
||||
}
|
||||
else if(command==properties) showPanelItemProperties(owner,panel);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ constexpr struct
|
||||
L"Press F9 to show the menu bar. Use the arrow keys to move between categories and entries. Press Enter to run the highlighted command.\r\n\r\n"
|
||||
L"Press F1 on a menu item for its topic. Commands → Keyboard shortcuts lists the active scheme and lets you assign extra bindings."},
|
||||
{L"Locations and navigation",L"folder path history breadcrumbs drives recent bookmark directory unc",
|
||||
L"Use the breadcrumb in a local or remote pane to jump to an ancestor. The folder history keeps earlier locations for that pane. Recent folders are available from the drive picker.\r\n\r\n"
|
||||
L"Use the breadcrumb in a local or remote pane to jump to an ancestor. The folder history keeps earlier locations for that pane. Choose Recent folders in Change drive to see recent locations in that panel. Enter opens the selected folder, Delete removes it from recent folders, and Esc restores the previous folder.\r\n\r\n"
|
||||
L"Folder shortcuts open frequently used locations. In the default scheme Ctrl+0–9 recalls a digit and Ctrl+Shift+0–9 adds the current folder."},
|
||||
{L"Find files",L"search filter mask results alt f7 paths subfolders",
|
||||
L"Find files searches from the active folder, including subfolders. Supply a filename mask such as *.md. The results show their locations and can be opened or used in file operations.\r\n\r\n"
|
||||
|
||||
+127
-79
@@ -586,10 +586,16 @@ struct RemotePanelLocation
|
||||
|
||||
namespace smb { struct PendingConnection; }
|
||||
|
||||
struct SmbPanelListing
|
||||
struct SmbListing
|
||||
{
|
||||
std::string serverId;
|
||||
std::wstring server;
|
||||
};
|
||||
|
||||
struct PanelListing
|
||||
{
|
||||
std::optional<SmbListing> smb;
|
||||
std::vector<FolderLocation> recent;
|
||||
std::vector<std::pair<fs::path,std::wstring>> rows;
|
||||
fs::path returnSelection;
|
||||
};
|
||||
@@ -601,7 +607,7 @@ struct Panel
|
||||
FolderNavigation navigation;
|
||||
std::optional<FilesPeer> peer;
|
||||
std::optional<TransferProfile> ftp;
|
||||
std::optional<SmbPanelListing> smb;
|
||||
std::optional<PanelListing> listing;
|
||||
std::shared_ptr<smb::PendingConnection> smbPending;
|
||||
std::optional<ArchiveLocation> archive;
|
||||
struct DirectoryWatch
|
||||
@@ -657,7 +663,7 @@ struct Panel
|
||||
std::optional<ArchiveLocation> archive;
|
||||
unsigned reconnectAttempt{};
|
||||
fs::path fallbackSelection;
|
||||
std::optional<SmbPanelListing> smb;
|
||||
std::optional<PanelListing> listing;
|
||||
};
|
||||
struct RemoteRetry
|
||||
{
|
||||
@@ -724,11 +730,26 @@ bool transferProfileList(const Panel &panel)
|
||||
return panel.ftp && panel.ftp->name.empty();
|
||||
}
|
||||
|
||||
bool connectionList(const Panel &panel)
|
||||
bool recentFolderList(const Panel &panel)
|
||||
{
|
||||
return panel.smb || transferProfileList(panel);
|
||||
return panel.listing && !panel.listing->smb;
|
||||
}
|
||||
|
||||
bool panelListsLocations(const Panel &panel)
|
||||
{
|
||||
return panel.listing || transferProfileList(panel);
|
||||
}
|
||||
|
||||
bool samePanelListing(const PanelListing &first,const PanelListing &second)
|
||||
{
|
||||
if(first.smb.has_value()!=second.smb.has_value()) return false;
|
||||
return !first.smb || first.smb->serverId==second.smb->serverId;
|
||||
}
|
||||
|
||||
void showRecentFolders(Panel &panel);
|
||||
void openRecentFolder(Panel &panel);
|
||||
void removeRecentFolder(Panel &panel);
|
||||
|
||||
void showSmbProfiles(Panel &panel);
|
||||
void refreshSmbPanel(Panel &panel);
|
||||
void enterSmbPanel(Panel &panel);
|
||||
@@ -748,7 +769,12 @@ FolderLocation folderLocation(const Panel &panel,const fs::path &directory)
|
||||
|
||||
std::wstring panelLocation(const Panel &panel)
|
||||
{
|
||||
if(panel.smb) return panel.smb->server.empty()?L"SMB":L"SMB · "+panel.smb->server;
|
||||
if(recentFolderList(panel)) return L"Recent folders";
|
||||
if(panel.listing)
|
||||
{
|
||||
const auto &server=panel.listing->smb->server;
|
||||
return server.empty()?L"SMB":L"SMB · "+server;
|
||||
}
|
||||
if(panel.ftp)
|
||||
return transferProfileList(panel)?transferProtocolName(panel.ftp->protocol):panel.ftp->name+L" · "+ftpPath(panel.directory);
|
||||
return (panel.peer?panel.peer->name+L" · ":std::wstring{})+panel.directory.native();
|
||||
@@ -765,7 +791,7 @@ DWORD effectivePanelColumns(const Panel &panel)
|
||||
|
||||
bool hasPanelColumns(const Panel &panel)
|
||||
{
|
||||
return detailedPanel(panel) && !panel.findOrigin && !connectionList(panel);
|
||||
return detailedPanel(panel) && !panel.findOrigin && !panelListsLocations(panel);
|
||||
}
|
||||
|
||||
std::wstring panelCaption(const Panel &panel)
|
||||
@@ -860,7 +886,6 @@ struct FolderPicker
|
||||
{
|
||||
const wchar_t *caption;
|
||||
std::vector<FolderLocation> locations;
|
||||
bool recent{};
|
||||
};
|
||||
std::optional<FolderPicker> folderPicker;
|
||||
constexpr int defaultSizeWidth=6, defaultFontPoints=110;
|
||||
@@ -2265,7 +2290,7 @@ LRESULT currentPanelRow(const Panel &panel)
|
||||
std::vector<fs::path> selectedPanelPaths(const Panel &panel)
|
||||
{
|
||||
std::vector<fs::path> paths;
|
||||
if(panel.smb) return paths;
|
||||
if(panel.listing) return paths;
|
||||
std::set<fs::path> directories;
|
||||
visitPanelMarks(panel,[&](const fs::path &path,const FolderEntryMetadata &entry) {
|
||||
paths.push_back(path);
|
||||
@@ -2338,7 +2363,7 @@ void copyPanelNames(HWND owner)
|
||||
|
||||
void copyPanelFiles(HWND owner,const Panel &panel)
|
||||
{
|
||||
if(panel.peer || panel.ftp || panel.archive || panel.smb)
|
||||
if(panel.peer || panel.ftp || panel.archive || panel.listing)
|
||||
{
|
||||
setStatus(L"File clipboard copy requires local files.");
|
||||
return;
|
||||
@@ -2356,7 +2381,7 @@ void copyPanelFiles(HWND owner,const Panel &panel)
|
||||
void copyFullPanelPath(HWND owner,const Panel &panel)
|
||||
{
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR || panel.sizes[row]==L"Up" || transferProfileList(panel)) return;
|
||||
if(row==LB_ERR || panel.sizes[row]==L"Up" || panelListsLocations(panel)) return;
|
||||
const auto &path=panel.rows[row];
|
||||
auto value=path.native();
|
||||
if(panel.ftp)
|
||||
@@ -2387,7 +2412,12 @@ bool retryRemotePanel(Panel &panel,bool automatic=false,const fs::path &fallback
|
||||
|
||||
void refreshPanel(Panel &panel)
|
||||
{
|
||||
if(panel.smb) {refreshSmbPanel(panel);return;}
|
||||
if(recentFolderList(panel))
|
||||
{
|
||||
if(!retryRemotePanel(panel)) showRecentFolders(panel);
|
||||
return;
|
||||
}
|
||||
if(panel.listing) {refreshSmbPanel(panel);return;}
|
||||
cancelFolderSizes(panel);
|
||||
if(!panel.view.automaticSizes) panel.folderSizes.clear();
|
||||
updateSelectionSummary(panel);
|
||||
@@ -2413,7 +2443,7 @@ std::wstring powerShellPath(const fs::path &path)
|
||||
void insertCurrentPanelPath(bool nameOnly = false)
|
||||
{
|
||||
const auto &panel=panels[active];
|
||||
if(panel.ftp || panel.smb || panel.archive) return;
|
||||
if(panel.ftp || panel.listing || panel.archive) return;
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR) return;
|
||||
const bool up=panel.sizes[row]==L"Up";
|
||||
@@ -2601,7 +2631,7 @@ bool showCommandOutput(HWND owner,const Panel &panel)
|
||||
if(panel.ftp && panel.ftp->protocol==TransferProtocol::sftp && !panel.ftp->id.empty())
|
||||
return startSshTerminal(owner,panel);
|
||||
closeSshPrompt(owner);
|
||||
if(panel.smb) return ensureTerminalView(owner);
|
||||
if(panel.listing) return ensureTerminalView(owner);
|
||||
if(panel.archive) return startTerminal(owner,panel.archive->file.parent_path());
|
||||
return panel.peer || panel.ftp?ensureTerminalView(owner):startTerminal(owner,panel.directory);
|
||||
}
|
||||
@@ -2641,7 +2671,7 @@ bool submitTerminalCommand(const Panel &panel,const std::wstring &value)
|
||||
setStatus(L"Shell commands require a local or LAN folder.");
|
||||
return false;
|
||||
}
|
||||
if(panel.smb)
|
||||
if(panel.listing)
|
||||
{
|
||||
setStatus(L"Open a folder before running a shell command.");
|
||||
return false;
|
||||
@@ -2930,10 +2960,15 @@ void showFileDetails(const Panel &panel)
|
||||
L" · Enter: Go · Esc: Back");
|
||||
return;
|
||||
}
|
||||
if(panel.smb)
|
||||
if(recentFolderList(panel))
|
||||
{
|
||||
setStatus(panel.rows.empty()?L"No recent folders Esc Back":L"Enter Open folder Delete Remove from recent Esc Back");
|
||||
return;
|
||||
}
|
||||
if(panel.listing)
|
||||
{
|
||||
if(panel.smbPending) setStatus(L"Connecting to SMB… Esc Cancel");
|
||||
else if(!panel.smb->server.empty())
|
||||
else if(!panel.listing->smb->server.empty())
|
||||
setStatus(panel.rows.size()<=1?L"No visible shares Esc Back":L"Enter Open share Esc Back");
|
||||
else if(panel.rows.empty()) setStatus(L"Shift+F4 New connection Esc Back");
|
||||
else setStatus(L"Enter Connect Shift+F4 New Right-click for Edit, Remove or Sign in");
|
||||
@@ -3169,8 +3204,8 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
auto &peer=request.peer;
|
||||
const auto previousDirectory=samePanelSource(panel,peer,request.ftp)?panel.directory:fs::path{};
|
||||
const auto provider=peer?FolderProvider::lan:request.ftp?transferFolderProvider(request.ftp->protocol):FolderProvider::local;
|
||||
const bool sameDirectory=request.smb || panel.smb?
|
||||
request.smb && panel.smb && request.smb->serverId==panel.smb->serverId:
|
||||
const bool sameDirectory=request.listing || panel.listing?
|
||||
request.listing && panel.listing && samePanelListing(*panel.listing,*request.listing):
|
||||
sameFolderPath(previousDirectory,directory,provider);
|
||||
auto &[nextWatch,folders,files,metadata,error,opened,failure,ftpInitialDirectory,ordered,columnMetadata,archiveEntries]=scan;
|
||||
const bool partial=error==ERROR_CANCELLED;
|
||||
@@ -3242,7 +3277,7 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
if(panel.marked[i]) markedPaths.insert(panel.rows[i]);
|
||||
}
|
||||
const bool finding=request.find.has_value();
|
||||
const bool viewChanged=finding!=panel.findOrigin.has_value() || request.smb.has_value()!=panel.smb.has_value();
|
||||
const bool viewChanged=finding!=panel.findOrigin.has_value() || request.listing.has_value()!=panel.listing.has_value();
|
||||
if(finding)
|
||||
{
|
||||
if(!panel.findOrigin)
|
||||
@@ -3272,32 +3307,34 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
if(mark.parent_path()==folderPathWithoutSeparator(directory)) markedPaths.insert(mark);
|
||||
panel.listReturnMarks.clear();
|
||||
}
|
||||
const bool rememberFolder=!sameDirectory && !partial && (!panel.directory.empty() || panel.smb || peer || request.ftp);
|
||||
const bool returningFromListing=panel.listing && request.navigationPosition==panel.navigation.current;
|
||||
const bool rememberFolder=!sameDirectory && !partial && !returningFromListing &&
|
||||
(!panel.directory.empty() || panel.listing || peer || request.ftp);
|
||||
panel.directory = directory;
|
||||
panel.peer=std::move(peer);
|
||||
panel.ftp=std::move(request.ftp);
|
||||
panel.archive=std::move(request.archive);
|
||||
panel.smb=std::move(request.smb);
|
||||
panel.listing=std::move(request.listing);
|
||||
if(panel.archive) panel.archive->entries=std::move(archiveEntries);
|
||||
if(!sameDirectory)
|
||||
{
|
||||
cancelFolderSizes(panel);
|
||||
panel.folderSizes.clear();
|
||||
}
|
||||
if(partial || finding || panel.archive || panel.smb) panel.watch.reset();
|
||||
if(partial || finding || panel.archive || panel.listing) panel.watch.reset();
|
||||
else if(!sameDirectory || panel.watch.handle==INVALID_HANDLE_VALUE)
|
||||
{
|
||||
panel.watch.reset();
|
||||
std::swap(panel.watch.handle,nextWatch.handle);
|
||||
}
|
||||
const bool profiles=connectionList(panel);
|
||||
if(!finding && !panel.archive && !profiles)
|
||||
const bool locationList=panelListsLocations(panel);
|
||||
if(!finding && !panel.archive && !locationList)
|
||||
{
|
||||
auto location=folderLocation(panel,directory);
|
||||
if(rememberFolder) updateRecentFolders(location,true);
|
||||
panel.navigation.opened(std::move(location),request.navigationPosition);
|
||||
}
|
||||
const bool renderTree=panel.view.tree && !finding && !profiles && !panel.archive;
|
||||
const bool renderTree=panel.view.tree && !finding && !locationList && !panel.archive;
|
||||
panel.filteredMarks.clear();
|
||||
if(renderTree) replaceTreeRoot(panel,scan,sameDirectory,markedPaths);
|
||||
else
|
||||
@@ -3314,7 +3351,7 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
const auto parent=finding?fs::path{}:panel.archive?directory.parent_path():
|
||||
panelParentPath(directory,!panel.peer && !panel.ftp);
|
||||
const bool hasParent=!parent.empty();
|
||||
const auto rowCount=panel.smb?panel.smb->rows.size():profiles?transferProfiles(panel.ftp->protocol).rows.size():finding?files.size():
|
||||
const auto rowCount=panel.listing?panel.listing->rows.size():locationList?transferProfiles(panel.ftp->protocol).rows.size():finding?files.size():
|
||||
renderTree?panel.tree.branches.at(panel.tree.root).ordered.size()+hasParent:ordered.size()+hasParent;
|
||||
PanelRowsUpdate rows(panel,rowCount);
|
||||
const auto add=[&](const fs::path &path,const std::wstring &label,bool folder)
|
||||
@@ -3322,11 +3359,11 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
const bool marked=markedPaths.contains(path);
|
||||
if(rows.add(path,label,folder,marked) && marked) panel.filteredMarks.erase(path);
|
||||
};
|
||||
if(panel.smb)
|
||||
if(panel.listing)
|
||||
{
|
||||
for(const auto &[path,label]:panel.smb->rows) rows.add(path,label,false,false,path==L"..");
|
||||
for(const auto &[path,label]:panel.listing->rows) rows.add(path,label,false,false,path==L"..");
|
||||
}
|
||||
else if(profiles)
|
||||
else if(locationList)
|
||||
{
|
||||
const auto &connections=transferProfiles(panel.ftp->protocol).rows;
|
||||
for(size_t i=0;i<connections.size();++i)
|
||||
@@ -3391,7 +3428,7 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
else if(!partial && error!=ERROR_SUCCESS && error!=ERROR_NO_MORE_FILES && error!=ERROR_FILE_NOT_FOUND)
|
||||
setStatus(L"Some entries could not be read.");
|
||||
else if(updateDetails && &panel==&panels[active]) showFileDetails(panel);
|
||||
if(!finding && !profiles && !panel.archive) queueAutomaticPanelSizes(panel,true);
|
||||
if(!finding && !locationList && !panel.archive) queueAutomaticPanelSizes(panel,true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3403,7 +3440,7 @@ std::future<std::unique_ptr<Panel::ScanResult>> scanDirectoryInBackground(HWND o
|
||||
std::packaged_task<std::unique_ptr<Panel::ScanResult>()> task(
|
||||
[request=std::move(request),view=std::move(view),columns,entries=std::move(entries),stop]
|
||||
{
|
||||
if(request.smb)
|
||||
if(request.listing)
|
||||
{
|
||||
auto result=std::make_unique<Panel::ScanResult>();
|
||||
result->opened=true;
|
||||
@@ -3439,9 +3476,9 @@ void startDirectoryScan(Panel &panel)
|
||||
void openOn(Panel &panel,const fs::path &directory,bool offerElevation,std::optional<FilesPeer> peer,
|
||||
fs::path selection={},fs::path fallback={},std::optional<TransferProfile> ftp={},
|
||||
std::optional<size_t> navigationPosition={},std::optional<ArchiveLocation> archive={},
|
||||
unsigned reconnectAttempt=0,fs::path fallbackSelection={},std::optional<SmbPanelListing> smb={})
|
||||
unsigned reconnectAttempt=0,fs::path fallbackSelection={},std::optional<PanelListing> listing={})
|
||||
{
|
||||
if(directory.empty() && !ftp && !smb) return;
|
||||
if(directory.empty() && !ftp && !listing) return;
|
||||
cancelSmbConnection(panel);
|
||||
panel.remoteRetry.reset();
|
||||
if(!panel.view.revealedFile.empty() &&
|
||||
@@ -3451,7 +3488,7 @@ void openOn(Panel &panel,const fs::path &directory,bool offerElevation,std::opti
|
||||
cancelFolderSizes(panel);
|
||||
panel.scanRequest=Panel::ScanRequest{directory,std::move(selection),std::move(fallback),
|
||||
std::move(peer),offerElevation,statusRevision,{},std::move(ftp),{},navigationPosition,
|
||||
std::move(archive),reconnectAttempt,std::move(fallbackSelection),std::move(smb)};
|
||||
std::move(archive),reconnectAttempt,std::move(fallbackSelection),std::move(listing)};
|
||||
if(panel.scan.valid())
|
||||
{
|
||||
panel.scanSuperseded=true;
|
||||
@@ -3463,6 +3500,20 @@ void openOn(Panel &panel,const fs::path &directory,bool offerElevation,std::opti
|
||||
|
||||
#include "files_panel_recovery.inl"
|
||||
|
||||
void openPanelListing(Panel &panel,PanelListing listing,fs::path selection={})
|
||||
{
|
||||
if(panel.listing) listing.returnSelection=panel.listing->returnSelection;
|
||||
else if(const auto row=currentPanelRow(panel);row!=LB_ERR) listing.returnSelection=panel.rows[row];
|
||||
openOn(panel,{},false,{},std::move(selection),{},{},{},{},0,{},std::move(listing));
|
||||
}
|
||||
|
||||
void closePanelListing(Panel &panel)
|
||||
{
|
||||
if(panel.navigation.history.empty()) return;
|
||||
const auto position=panel.navigation.current;
|
||||
openFolderLocation(panel,panel.navigation.history[position],position,panel.listing->returnSelection);
|
||||
}
|
||||
|
||||
void collectDirectoryScans()
|
||||
{
|
||||
for(auto &panel:panels)
|
||||
@@ -3984,7 +4035,6 @@ LRESULT sftpDriveRow() {return lanDrivePicker?-1:ftpDriveRow()+1;}
|
||||
LRESULT smbDriveRow() {return lanDrivePicker?-1:sftpDriveRow()+1;}
|
||||
LRESULT recentDriveRow() {return lanDrivePicker?-1:smbDriveRow()+1;}
|
||||
LRESULT lanHeaderRow() {return recentDriveRow()+1;}
|
||||
void showRecentFolders(int side);
|
||||
|
||||
bool driveSourceRow(LRESULT row)
|
||||
{
|
||||
@@ -4089,7 +4139,11 @@ void selectDrive()
|
||||
activatePanel(pickerPanel);
|
||||
showSmbProfiles(panels[pickerPanel]);
|
||||
}
|
||||
else if(row==recentDriveRow()) showRecentFolders(pickerPanel);
|
||||
else if(row==recentDriveRow())
|
||||
{
|
||||
activatePanel(pickerPanel);
|
||||
showRecentFolders(panels[pickerPanel]);
|
||||
}
|
||||
else if(remote!=remoteDriveRows.end())
|
||||
{
|
||||
const auto &choice=remote->second;
|
||||
@@ -4100,26 +4154,6 @@ void selectDrive()
|
||||
|
||||
LRESULT CALLBACK pickerKeys(HWND window, UINT msg, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR)
|
||||
{
|
||||
if(folderPicker && folderPicker->recent && msg==WM_KEYDOWN && wp==VK_DELETE)
|
||||
{
|
||||
const auto row=SendMessageW(window,LB_GETCURSEL,0,0);
|
||||
if(!selectablePickerRow(row)) return 0;
|
||||
auto &paths=folderPicker->locations;
|
||||
if(!updateRecentFolders(paths[row],false))
|
||||
{
|
||||
setStatus(L"Could not remove the recent folder.");
|
||||
return 0;
|
||||
}
|
||||
paths.erase(paths.begin()+row);
|
||||
SendMessageW(window,LB_DELETESTRING,row,0);
|
||||
if(paths.empty())
|
||||
{
|
||||
hidePicker();
|
||||
setStatus(L"No recent folders.");
|
||||
}
|
||||
else SendMessageW(window,LB_SETCURSEL,std::min(row,static_cast<LRESULT>(paths.size()-1)),0);
|
||||
return 0;
|
||||
}
|
||||
if(folderPicker && msg==WM_LBUTTONUP)
|
||||
{
|
||||
const auto hit=SendMessageW(window,LB_ITEMFROMPOINT,0,lp);
|
||||
@@ -4614,7 +4648,7 @@ void openPanelFile(const Panel &panel, const fs::path &file, const wchar_t *verb
|
||||
|
||||
void openSelectedWithSystem(const Panel &panel)
|
||||
{
|
||||
if(panel.ftp || panel.smb || panel.archive) return;
|
||||
if(panel.ftp || panel.listing || panel.archive) return;
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR) return;
|
||||
if(panel.peer)
|
||||
@@ -4650,7 +4684,7 @@ void refreshQuickView(const Panel &panel)
|
||||
{
|
||||
if(!quickViewWindow || &panel!=&panels[quickViewSource]) return;
|
||||
const auto row=currentPanelRow(panel);
|
||||
const bool file=!panel.peer && !panel.ftp && !panel.smb && !panel.archive && row!=LB_ERR &&
|
||||
const bool file=!panel.peer && !panel.ftp && !panel.listing && !panel.archive && row!=LB_ERR &&
|
||||
panel.sizes[row]!=L"Folder" && panel.sizes[row]!=L"Up";
|
||||
const auto path=file?panel.rows[row]:fs::path{};
|
||||
if(file && ks::files::isImagePath(path) && !quickImageWindow)
|
||||
@@ -4736,7 +4770,7 @@ void openArchiveText(const Panel &panel,const fs::path &path,bool hex=false)
|
||||
|
||||
void openSelectedText(const Panel &panel, bool edit, bool external,bool hex)
|
||||
{
|
||||
if(connectionList(panel)) return;
|
||||
if(panelListsLocations(panel)) return;
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR || panel.sizes[row]==L"Folder" || panel.sizes[row]==L"Up") return;
|
||||
if(panel.archive)
|
||||
@@ -4773,7 +4807,8 @@ void openSelectedText(const Panel &panel, bool edit, bool external,bool hex)
|
||||
|
||||
void enter(Panel &panel)
|
||||
{
|
||||
if(panel.smb) {enterSmbPanel(panel);return;}
|
||||
if(recentFolderList(panel)) {openRecentFolder(panel);return;}
|
||||
if(panel.listing) {enterSmbPanel(panel);return;}
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row!=LB_ERR)
|
||||
{
|
||||
@@ -6839,7 +6874,7 @@ void copySelection(HWND owner,Panel &source,Panel &destination,bool move,std::ve
|
||||
{
|
||||
const auto sourceFtp=source.ftp;
|
||||
const bool ftpRename=move && sourceFtp && !transferProfileList(source);
|
||||
if(source.smb || (destination.smb && !ftpRename && !renameHere))
|
||||
if(source.listing || (destination.listing && !ftpRename && !renameHere))
|
||||
{
|
||||
setStatus(L"Open a folder before copying or moving files.");
|
||||
return;
|
||||
@@ -7355,7 +7390,7 @@ void deleteSelection(HWND owner,Panel &panel,bool permanent)
|
||||
setStatus(L"Wait for the search to finish.");
|
||||
return;
|
||||
}
|
||||
if(transferProfileList(panel)) return;
|
||||
if(panelListsLocations(panel)) return;
|
||||
if(copyInProgress) return;
|
||||
const auto ftp=panel.ftp;
|
||||
permanent=permanent || ftp.has_value();
|
||||
@@ -7592,7 +7627,7 @@ void deleteSelection(HWND owner,Panel &panel,bool permanent)
|
||||
bool pastePanelFiles(HWND owner,Panel &panel)
|
||||
{
|
||||
if(!IsClipboardFormatAvailable(CF_HDROP)) return false;
|
||||
if(panel.peer || panel.ftp || panel.smb || panel.findOrigin)
|
||||
if(panel.peer || panel.ftp || panel.listing || panel.findOrigin)
|
||||
{
|
||||
setStatus(L"Open a local folder before pasting files.");
|
||||
return true;
|
||||
@@ -8044,7 +8079,8 @@ void runFilesKeyCommand(HWND owner,int side,FilesKey command)
|
||||
case FilesKey::Edit:
|
||||
{
|
||||
const bool edit=command==FilesKey::Edit;
|
||||
if(panel.smb)
|
||||
if(recentFolderList(panel)) break;
|
||||
if(panel.listing)
|
||||
{
|
||||
if(edit) editSmbProfile(panel,false);
|
||||
break;
|
||||
@@ -8062,7 +8098,8 @@ void runFilesKeyCommand(HWND owner,int side,FilesKey command)
|
||||
case FilesKey::Move: copySelection(owner,panel,panels[1-side],command==FilesKey::Move); break;
|
||||
case FilesKey::Mkdir: makeFolder(owner,panel); break;
|
||||
case FilesKey::Delete:
|
||||
if(panel.smb) removeSmbProfile(panel);
|
||||
if(recentFolderList(panel)) removeRecentFolder(panel);
|
||||
else if(panel.listing) removeSmbProfile(panel);
|
||||
else deleteSelection(owner,panel,false);
|
||||
break;
|
||||
case FilesKey::Exit: SendMessageW(owner,WM_CLOSE,0,0); break;
|
||||
@@ -8125,7 +8162,7 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
{
|
||||
auto &panel=panels[index];
|
||||
const auto row=panelRowAt(window,screen,SendMessageW(window,LB_GETTOPINDEX,0,0),panel.rows.size());
|
||||
if(row!=LB_ERR && panel.sizes[row]!=L"Up" && !connectionList(panel))
|
||||
if(row!=LB_ERR && panel.sizes[row]!=L"Up" && !panelListsLocations(panel))
|
||||
{
|
||||
closePanelSearch();
|
||||
SetFocus(window);
|
||||
@@ -8586,7 +8623,7 @@ void searchPanelByPrefix(HWND window,wchar_t character)
|
||||
{
|
||||
if(panel.sizes[row]==L"Up") continue;
|
||||
const auto *profiles=transferProfileList(panel)?&transferProfiles(panel.ftp->protocol).rows:nullptr;
|
||||
const auto name=panel.smb && row<panel.smb->rows.size()?panel.smb->rows[row].second:
|
||||
const auto name=panel.listing && row<panel.listing->rows.size()?panel.listing->rows[row].second:
|
||||
profiles && row<profiles->size()?(*profiles)[row].name:panel.rows[row].filename().native();
|
||||
if(name.size()<panelSearchPrefix.size() ||
|
||||
CompareStringOrdinal(name.data(),length,panelSearchPrefix.data(),length,TRUE)!=CSTR_EQUAL)
|
||||
@@ -9084,7 +9121,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
if(item.CtlID==140 || item.CtlID==141)
|
||||
{
|
||||
const auto &panel=panels[item.CtlID-140];
|
||||
if(panel.findOrigin || connectionList(panel))
|
||||
if(panel.findOrigin || panelListsLocations(panel))
|
||||
{
|
||||
paintText(item.hDC,item.rcItem,panel.findOrigin?L"Relative path":L"Name",RGB(255,255,0),colors[PanelBlue]);
|
||||
return TRUE;
|
||||
@@ -9129,8 +9166,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
paintDialogFrameCaptions(item.hDC,item.rcItem,box,L"Change drive",teal,colors[Text],mono);
|
||||
}
|
||||
if(item.hwndItem==pickerFrame && folderPicker)
|
||||
paintDialogFrameCaptions(item.hDC,item.rcItem,box,folderPicker->caption,teal,colors[Text],mono,
|
||||
folderPicker->recent?L"Del Remove":nullptr);
|
||||
paintDialogFrameCaptions(item.hDC,item.rcItem,box,folderPicker->caption,teal,colors[Text],mono);
|
||||
const auto list=item.hwndItem==pickerFrame?picker:completionList;
|
||||
paintScrollPosition(item.hwndItem,item.hDC,list,colors[Dialog]);
|
||||
DeleteObject(border);
|
||||
@@ -9234,9 +9270,9 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
}
|
||||
}
|
||||
auto shortcut=text.find(L'\t');
|
||||
if(item.hwndItem==picker && folderPicker)
|
||||
paintDialogListRow(item.hDC,item.rcItem,text.c_str(),mono,foreground,rowBackground,
|
||||
dialogRowTextInset(cellWidth),DT_PATH_ELLIPSIS|DT_END_ELLIPSIS);
|
||||
if((item.hwndItem==picker && folderPicker) || (panelRow && recentFolderList(panels[item.CtlID-102])))
|
||||
paintDialogListRow(item.hDC,item.rcItem,text,rowFont?rowFont:mono,foreground,rowBackground,
|
||||
panelRow?5:dialogRowTextInset(cellWidth),DT_PATH_ELLIPSIS|DT_END_ELLIPSIS);
|
||||
else if(item.hwndItem==picker && commandPicker && item.itemID<commandAccessPositions.size())
|
||||
{
|
||||
auto labelRect=item.rcItem, keyRect=item.rcItem;
|
||||
@@ -9518,13 +9554,13 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
const auto row=currentPanelRow(panel);
|
||||
auto cursor=panel.archive?panel.archive->file.native():
|
||||
row==LB_ERR?std::wstring{}:panel.rows[row].native();
|
||||
if(panel.smb)
|
||||
if(panel.listing)
|
||||
{
|
||||
if(panel.navigation.history.empty()) continue;
|
||||
const auto &previous=panel.navigation.history[panel.navigation.current];
|
||||
if(previous.provider!=FolderProvider::local) continue;
|
||||
path=previous.directory.native();
|
||||
cursor=panel.smb->returnSelection.native();
|
||||
cursor=panel.listing->returnSelection.native();
|
||||
}
|
||||
if(!path.empty())
|
||||
RegSetKeyValueW(HKEY_CURRENT_USER,schemeKey,panelPathKeys[i],REG_SZ,path.c_str(),
|
||||
@@ -9688,6 +9724,16 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
continue;
|
||||
}
|
||||
if(!copyInProgress && handlePanelSearchKey(window,message)) continue;
|
||||
if(message.message==WM_KEYDOWN && message.wParam==VK_DELETE && !terminalVisible &&
|
||||
!(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_SHIFT)&0x8000) &&
|
||||
!(GetKeyState(VK_MENU)&0x8000) && commandLineAvailable(window) &&
|
||||
(message.hwnd==panels[active].list ||
|
||||
(message.hwnd==terminalInput && !GetWindowTextLengthW(terminalInput))) &&
|
||||
recentFolderList(panels[active]))
|
||||
{
|
||||
if(!(message.lParam&(1LL<<30))) removeRecentFolder(panels[active]);
|
||||
continue;
|
||||
}
|
||||
if(message.message==WM_KEYDOWN && message.wParam==VK_ESCAPE && !terminalVisible &&
|
||||
commandLineAvailable(window) &&
|
||||
(message.hwnd==terminalInput || message.hwnd==panels[0].list || message.hwnd==panels[1].list))
|
||||
@@ -9698,9 +9744,10 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(!panel.scanSuperseded) stopDirectoryScan();
|
||||
continue;
|
||||
}
|
||||
if(panel.smb && !panel.scanRequest && !GetWindowTextLengthW(terminalInput))
|
||||
if(panel.listing && !panel.scanRequest && !GetWindowTextLengthW(terminalInput))
|
||||
{
|
||||
backSmbPanel(panel);
|
||||
if(recentFolderList(panel)) closePanelListing(panel);
|
||||
else backSmbPanel(panel);
|
||||
continue;
|
||||
}
|
||||
if(panel.archive && !panel.scanRequest)
|
||||
@@ -9816,7 +9863,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(!(message.lParam & (1LL<<30)) && commandLineAvailable(window))
|
||||
{
|
||||
auto &panel=panels[active];
|
||||
if(panel.smb) editSmbProfile(panel,true);
|
||||
if(recentFolderList(panel)) continue;
|
||||
if(panel.listing) editSmbProfile(panel,true);
|
||||
else if(transferProfileList(panel)) editTransferProfile(panel,true);
|
||||
else openOrCreateText(window,panel);
|
||||
}
|
||||
|
||||
@@ -58,20 +58,20 @@ bool retryRemotePanel(Panel &panel,bool automatic,const fs::path &fallback)
|
||||
return true;
|
||||
}
|
||||
|
||||
void openFolderLocation(Panel &panel,const FolderLocation &location,std::optional<size_t> position={})
|
||||
void openFolderLocation(Panel &panel,const FolderLocation &location,std::optional<size_t> position={},fs::path selection={})
|
||||
{
|
||||
if(location.directory.empty()) return;
|
||||
if(location.provider==FolderProvider::local)
|
||||
{
|
||||
openOn(panel,location.directory,true,{},{},{},{},position);
|
||||
openOn(panel,location.directory,true,{},std::move(selection),{},{},position);
|
||||
return;
|
||||
}
|
||||
if(location.sameSource(folderLocation(panel,panel.directory)))
|
||||
{
|
||||
openOn(panel,location.directory,false,panel.peer,{},{},panel.ftp,position);
|
||||
openOn(panel,location.directory,false,panel.peer,std::move(selection),{},panel.ftp,position);
|
||||
return;
|
||||
}
|
||||
RemotePanelLocation remote{location.directory,{},{},{},position};
|
||||
RemotePanelLocation remote{location.directory,std::move(selection),{},{},position};
|
||||
if(isTransferFolder(location.provider))
|
||||
{
|
||||
remote.ftpProfile=location.id;
|
||||
@@ -124,11 +124,11 @@ void saveFtpPanelLocation(const Panel &panel,int index)
|
||||
location=panel.remoteRetry->location;
|
||||
else if(panel.scanRequest && panel.scanRequest->ftp && panel.scanRequest->ftp->protocol==TransferProtocol::ftp)
|
||||
location={panel.scanRequest->directory,panel.scanRequest->selection,panel.scanRequest->ftp->id};
|
||||
else if(panel.smb && !panel.navigation.history.empty())
|
||||
else if(panel.listing && !panel.navigation.history.empty())
|
||||
{
|
||||
const auto &previous=panel.navigation.history[panel.navigation.current];
|
||||
if(previous.provider==FolderProvider::ftp)
|
||||
location={previous.directory,panel.smb->returnSelection,previous.id};
|
||||
location={previous.directory,panel.listing->returnSelection,previous.id};
|
||||
}
|
||||
|
||||
const auto key=ftpPanelLocationKeys[index];
|
||||
|
||||
@@ -2,7 +2,7 @@ class PanelRowsUpdate
|
||||
{
|
||||
public:
|
||||
PanelRowsUpdate(Panel &panel,size_t count) : panel(panel),visible(IsWindowVisible(panel.list)),
|
||||
profiles(connectionList(panel))
|
||||
locationList(panelListsLocations(panel))
|
||||
{
|
||||
if(visible) SendMessageW(panel.list,WM_SETREDRAW,FALSE,0);
|
||||
panel.rows.clear();
|
||||
@@ -33,10 +33,10 @@ public:
|
||||
}
|
||||
panel.marked.push_back(!up && marked);
|
||||
const auto found=panel.metadata.find(path);
|
||||
const auto entry=up || profiles || found==panel.metadata.end()?FolderEntryMetadata{}:found->second;
|
||||
const auto entry=up || locationList || found==panel.metadata.end()?FolderEntryMetadata{}:found->second;
|
||||
panel.dimmed.push_back((entry.attributes&(FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN))!=0);
|
||||
panel.sizes.push_back(up?L"Up":profiles?L"":folder?L"Folder":std::to_wstring(entry.size));
|
||||
if(!up && !profiles)
|
||||
panel.sizes.push_back(up?L"Up":locationList?L"":folder?L"Folder":std::to_wstring(entry.size));
|
||||
if(!up && !locationList)
|
||||
{
|
||||
auto &longest=panel.longestColumn;
|
||||
longest[sizeColumn]=std::max(longest[sizeColumn],panel.sizes.back().size());
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
private:
|
||||
Panel &panel;
|
||||
bool visible,profiles;
|
||||
bool visible,locationList;
|
||||
};
|
||||
|
||||
bool treePanelActive(const Panel &panel)
|
||||
@@ -120,7 +120,7 @@ void visitPanelMarks(const Panel &panel,const Visitor &visit)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(connectionList(panel)) return;
|
||||
if(panelListsLocations(panel)) return;
|
||||
for(size_t i=0;i<panel.rows.size();++i)
|
||||
{
|
||||
if(!panel.marked[i] || panel.sizes[i]==L"Up") continue;
|
||||
|
||||
@@ -318,24 +318,18 @@ void editPanelPath(Panel &panel)
|
||||
}
|
||||
|
||||
void showFolderPicker(HWND owner,int side,const wchar_t *caption,std::vector<FolderLocation> locations,
|
||||
RECT anchor,bool recent=false)
|
||||
RECT anchor)
|
||||
{
|
||||
hidePicker();
|
||||
showMenu(false);
|
||||
commandPicker=false;
|
||||
pickerPanel=side;
|
||||
folderPicker=FolderPicker{caption,std::move(locations),recent};
|
||||
folderPicker=FolderPicker{caption,std::move(locations)};
|
||||
SendMessageW(picker,LB_RESETCONTENT,0,0);
|
||||
size_t longest=wcslen(caption);
|
||||
for(const auto &location:folderPicker->locations)
|
||||
{
|
||||
auto label=isTransferFolder(location.provider)?ftpPath(location.directory):location.directory.native();
|
||||
if(recent && location.provider!=FolderProvider::local)
|
||||
{
|
||||
const auto &source=location.label;
|
||||
const auto kind=isTransferFolder(location.provider)?transferProtocolName(folderTransferProtocol(location.provider)):L"LAN";
|
||||
label=std::wstring(kind)+L" · "+(source.empty()?std::wstring{}:source+L" · ")+label;
|
||||
}
|
||||
longest=std::max(longest,label.size());
|
||||
SendMessageW(picker,LB_ADDSTRING,0,reinterpret_cast<LPARAM>(label.c_str()));
|
||||
}
|
||||
@@ -356,26 +350,52 @@ void showFolderPicker(HWND owner,int side,const wchar_t *caption,std::vector<Fol
|
||||
SetFocus(picker);
|
||||
}
|
||||
|
||||
void showRecentFolders(int side)
|
||||
void showRecentFolders(Panel &panel)
|
||||
{
|
||||
auto locations=readRecentFolders();
|
||||
if(locations.empty())
|
||||
PanelListing listing;
|
||||
listing.recent=readRecentFolders();
|
||||
listing.rows.reserve(listing.recent.size());
|
||||
for(size_t i=0;i<listing.recent.size();++i)
|
||||
{
|
||||
setStatus(L"No recent folders.");
|
||||
auto &location=listing.recent[i];
|
||||
auto label=location.directory.native();
|
||||
if(location.provider!=FolderProvider::local)
|
||||
{
|
||||
const wchar_t *kind=L"LAN";
|
||||
if(isTransferFolder(location.provider))
|
||||
{
|
||||
const auto protocol=folderTransferProtocol(location.provider);
|
||||
kind=transferProtocolName(protocol);
|
||||
if(loadTransferProfiles(protocol))
|
||||
if(const auto *profile=findTransferProfile(location.id,protocol)) location.label=profile->name;
|
||||
label=ftpPath(location.directory);
|
||||
}
|
||||
if(!location.label.empty()) label=location.label+L" · "+label;
|
||||
label=std::wstring(kind)+L" · "+label;
|
||||
}
|
||||
listing.rows.emplace_back(std::to_wstring(i),std::move(label));
|
||||
}
|
||||
openPanelListing(panel,std::move(listing));
|
||||
}
|
||||
|
||||
void openRecentFolder(Panel &panel)
|
||||
{
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row!=LB_ERR && !panel.scan.valid())
|
||||
openFolderLocation(panel,panel.listing->recent[row]);
|
||||
}
|
||||
|
||||
void removeRecentFolder(Panel &panel)
|
||||
{
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR || panel.scan.valid()) return;
|
||||
if(!updateRecentFolders(panel.listing->recent[row],false))
|
||||
{
|
||||
setStatus(L"Could not remove the recent folder.");
|
||||
return;
|
||||
}
|
||||
const auto owner=GetParent(picker);
|
||||
RECT anchor{};
|
||||
GetWindowRect(panels[side].path,&anchor);
|
||||
MapWindowPoints(nullptr,owner,reinterpret_cast<POINT *>(&anchor),2);
|
||||
for(auto &location:locations)
|
||||
{
|
||||
if(!isTransferFolder(location.provider)) continue;
|
||||
const auto protocol=folderTransferProtocol(location.provider);
|
||||
if(loadTransferProfiles(protocol))
|
||||
if(const auto *profile=findTransferProfile(location.id,protocol)) location.label=profile->name;
|
||||
}
|
||||
showFolderPicker(owner,side,L"Recent folders",std::move(locations),anchor,true);
|
||||
for(auto &other:panels)
|
||||
if(recentFolderList(other) && !other.scan.valid()) showRecentFolders(other);
|
||||
}
|
||||
|
||||
void showHiddenPathParts(HWND window,int side,const PathPart &part)
|
||||
|
||||
@@ -129,7 +129,7 @@ void showReadOnlyProperties(HWND owner,const ItemProperties &properties,const st
|
||||
bool panelItemPropertiesAvailable(const Panel &panel)
|
||||
{
|
||||
const auto row=currentPanelRow(panel);
|
||||
return row!=LB_ERR && panel.sizes[row]!=L"Up" && !connectionList(panel);
|
||||
return row!=LB_ERR && panel.sizes[row]!=L"Up" && !panelListsLocations(panel);
|
||||
}
|
||||
|
||||
void showSourceItemProperties(HWND owner,const Panel &panel,const fs::path &path,ItemProperties properties)
|
||||
|
||||
+15
-27
@@ -418,31 +418,24 @@ std::optional<Profile> findProfile(const fs::path &id)
|
||||
|
||||
std::optional<Profile> selectedProfile(const Panel &panel)
|
||||
{
|
||||
if(!panel.smb || !panel.smb->server.empty() || panel.scan.valid() || panel.smbPending) return {};
|
||||
if(!panel.listing || !panel.listing->smb || !panel.listing->smb->server.empty() || panel.scan.valid() || panel.smbPending) return {};
|
||||
const auto row=currentPanelRow(panel);
|
||||
return row==LB_ERR?std::nullopt:findProfile(panel.rows[row]);
|
||||
}
|
||||
|
||||
void openListing(Panel &panel,SmbPanelListing listing,fs::path selection={})
|
||||
{
|
||||
if(panel.smb) listing.returnSelection=panel.smb->returnSelection;
|
||||
else if(const auto row=currentPanelRow(panel);row!=LB_ERR) listing.returnSelection=panel.rows[row];
|
||||
openOn(panel,{},false,{},std::move(selection),{},{},{},{},0,{},std::move(listing));
|
||||
}
|
||||
|
||||
void showProfiles(Panel &panel,const std::vector<Profile> &profiles,fs::path selection={})
|
||||
{
|
||||
SmbPanelListing listing;
|
||||
PanelListing listing{SmbListing{}};
|
||||
listing.rows.reserve(profiles.size());
|
||||
for(const auto &profile:profiles)
|
||||
listing.rows.emplace_back(ks::wide(profile.id),profile.name+L" · "+profileAddress(profile));
|
||||
openListing(panel,std::move(listing),std::move(selection));
|
||||
openPanelListing(panel,std::move(listing),std::move(selection));
|
||||
}
|
||||
|
||||
void refreshProfiles(Panel &panel,const std::vector<Profile> &profiles,fs::path selection={})
|
||||
{
|
||||
for(auto &other:panels)
|
||||
if(other.smb && other.smb->server.empty() && !other.smbPending && !other.scan.valid())
|
||||
if(other.listing && other.listing->smb && other.listing->smb->server.empty() && !other.smbPending && !other.scan.valid())
|
||||
showProfiles(other,profiles,&other==&panel?selection:fs::path{});
|
||||
}
|
||||
|
||||
@@ -493,8 +486,8 @@ void showSmbProfiles(Panel &panel)
|
||||
void refreshSmbPanel(Panel &panel)
|
||||
{
|
||||
if(panel.scan.valid() || panel.smbPending) return;
|
||||
if(panel.smb->server.empty()) showSmbProfiles(panel);
|
||||
else if(auto profile=smb::findProfile(ks::wide(panel.smb->serverId));profile && profile->target.folder.empty())
|
||||
if(panel.listing->smb->server.empty()) showSmbProfiles(panel);
|
||||
else if(auto profile=smb::findProfile(ks::wide(panel.listing->smb->serverId));profile && profile->target.folder.empty())
|
||||
smb::openProfile(panel,std::move(*profile),false);
|
||||
else showSmbProfiles(panel);
|
||||
}
|
||||
@@ -506,20 +499,15 @@ void backSmbPanel(Panel &panel)
|
||||
cancelSmbConnection(panel);
|
||||
setStatus(L"SMB connection canceled.");
|
||||
}
|
||||
else if(!panel.smb->server.empty()) smb::showProfiles(panel,smb::readProfiles(),ks::wide(panel.smb->serverId));
|
||||
else if(!panel.navigation.history.empty())
|
||||
{
|
||||
const auto &location=panel.navigation.history[panel.navigation.current];
|
||||
if(location.provider==FolderProvider::local)
|
||||
openOn(panel,location.directory,false,{},panel.smb->returnSelection);
|
||||
else openFolderLocation(panel,location,panel.navigation.current);
|
||||
}
|
||||
else if(!panel.listing->smb->server.empty())
|
||||
smb::showProfiles(panel,smb::readProfiles(),ks::wide(panel.listing->smb->serverId));
|
||||
else closePanelListing(panel);
|
||||
}
|
||||
|
||||
void enterSmbPanel(Panel &panel)
|
||||
{
|
||||
if(panel.scan.valid() || panel.smbPending) return;
|
||||
if(panel.smb->server.empty())
|
||||
if(panel.listing->smb->server.empty())
|
||||
{
|
||||
if(auto profile=smb::selectedProfile(panel)) smb::openProfile(panel,std::move(*profile),false);
|
||||
return;
|
||||
@@ -528,12 +516,12 @@ void enterSmbPanel(Panel &panel)
|
||||
if(row==LB_ERR) return;
|
||||
const auto &name=panel.rows[row];
|
||||
if(name==L"..") backSmbPanel(panel);
|
||||
else openOn(panel,fs::path(panel.smb->server+L"\\"+name.native()),false,{});
|
||||
else openOn(panel,fs::path(panel.listing->smb->server+L"\\"+name.native()),false,{});
|
||||
}
|
||||
|
||||
void editSmbProfile(Panel &panel,bool create)
|
||||
{
|
||||
if(!panel.smb || !panel.smb->server.empty() || panel.smbPending || panel.scan.valid()) return;
|
||||
if(!panel.listing || !panel.listing->smb || !panel.listing->smb->server.empty() || panel.smbPending || panel.scan.valid()) return;
|
||||
const auto profile=create?std::optional{smb::Profile{}}:smb::selectedProfile(panel);
|
||||
if(!profile) return;
|
||||
smb::EditProfile edit{*profile};
|
||||
@@ -598,11 +586,11 @@ void collectSmbConnections(HWND owner)
|
||||
if(!result.folder.empty()) openOn(panel,result.folder,false,{});
|
||||
else
|
||||
{
|
||||
SmbPanelListing listing{profile.id,profile.target.server};
|
||||
PanelListing listing{SmbListing{profile.id,profile.target.server}};
|
||||
listing.rows.emplace_back(L"..",L"..");
|
||||
for(const auto &share:result.shares) listing.rows.emplace_back(share,L"["+share+L"]");
|
||||
const auto selectFirst=profile.id!=panel.smb->serverId && !result.shares.empty();
|
||||
smb::openListing(panel,std::move(listing),selectFirst?fs::path(result.shares.front()):fs::path{});
|
||||
const auto selectFirst=profile.id!=panel.listing->smb->serverId && !result.shares.empty();
|
||||
openPanelListing(panel,std::move(listing),selectFirst?fs::path(result.shares.front()):fs::path{});
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
-11
@@ -10,6 +10,42 @@ class PasteProbe
|
||||
IUIAutomation2 *automation{};
|
||||
IUIAutomationElement *element{};
|
||||
IUIAutomationTextPattern *pattern{};
|
||||
HWND targetWindow{};
|
||||
|
||||
bool focusBelongsToTarget() const
|
||||
{
|
||||
DWORD process{};
|
||||
GetWindowThreadProcessId(targetWindow, &process);
|
||||
int focusedProcess{};
|
||||
if (process && SUCCEEDED(element->get_CurrentProcessId(&focusedProcess)) &&
|
||||
process == static_cast<DWORD>(focusedProcess))
|
||||
return true;
|
||||
|
||||
// WebView2 can report a renderer process for the focused element.
|
||||
// Require a native window in its UIA ancestry rooted in the target.
|
||||
auto release = [](auto *value) { if (value) value->Release(); };
|
||||
IUIAutomationTreeWalker *rawWalker{};
|
||||
const auto walkerResult = automation->get_RawViewWalker(&rawWalker);
|
||||
std::unique_ptr<IUIAutomationTreeWalker, decltype(release)> walker(rawWalker, release);
|
||||
if (FAILED(walkerResult) || !walker) return false;
|
||||
|
||||
element->AddRef();
|
||||
std::unique_ptr<IUIAutomationElement, decltype(release)> current(element, release);
|
||||
for (int depth = 0; depth < 32 && current; ++depth)
|
||||
{
|
||||
UIA_HWND native{};
|
||||
if (SUCCEEDED(current->get_CurrentNativeWindowHandle(&native)) && native)
|
||||
{
|
||||
const auto window = reinterpret_cast<HWND>(native);
|
||||
return window == targetWindow || IsChild(targetWindow, window);
|
||||
}
|
||||
IUIAutomationElement *parent{};
|
||||
const auto parentResult = walker->GetParentElement(current.get(), &parent);
|
||||
current.reset(parent);
|
||||
if (FAILED(parentResult)) break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static std::optional<std::wstring> rangeText(IUIAutomationTextRange *range)
|
||||
{
|
||||
@@ -24,7 +60,7 @@ class PasteProbe
|
||||
public:
|
||||
std::wstring status = L"not-requested";
|
||||
std::optional<std::wstring> precedingCharacter;
|
||||
PasteProbe(bool enabled, HWND target)
|
||||
PasteProbe(bool enabled, HWND target) : targetWindow(target)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
@@ -36,17 +72,15 @@ class PasteProbe
|
||||
automation->put_TransactionTimeout(200);
|
||||
if (FAILED(automation->GetFocusedElement(&element)) || !element)
|
||||
return;
|
||||
if (target)
|
||||
if (target && GetForegroundWindow() != target)
|
||||
{
|
||||
DWORD process{};
|
||||
GetWindowThreadProcessId(target, &process);
|
||||
int focusedProcess{};
|
||||
if (!process || FAILED(element->get_CurrentProcessId(&focusedProcess)) ||
|
||||
process != static_cast<DWORD>(focusedProcess) || GetForegroundWindow() != target)
|
||||
{
|
||||
status = L"focused-control-changed";
|
||||
return;
|
||||
}
|
||||
status = L"focused-window-changed";
|
||||
return;
|
||||
}
|
||||
if (target && !focusBelongsToTarget())
|
||||
{
|
||||
status = L"focused-control-outside-target";
|
||||
return;
|
||||
}
|
||||
BOOL password = TRUE;
|
||||
if (FAILED(element->get_CurrentIsPassword(&password)) || password)
|
||||
@@ -95,6 +129,11 @@ class PasteProbe
|
||||
{
|
||||
if (!pattern)
|
||||
return {};
|
||||
if (targetWindow && GetForegroundWindow() != targetWindow)
|
||||
{
|
||||
status = L"focused-window-changed";
|
||||
return {};
|
||||
}
|
||||
if (characters <= 0 || characters > 4096)
|
||||
{
|
||||
status = L"readback-size-limit";
|
||||
|
||||
+6
-4
@@ -676,9 +676,10 @@ bool needsSelectionDelay(HWND target)
|
||||
{
|
||||
const auto name = lower(processName(target));
|
||||
return name == L"ms-teams" || name == L"msedgewebview2" ||
|
||||
name == L"chrome" || name == L"msedge" || name == L"chatgpt" || name == L"codex";
|
||||
name == L"chrome" || name == L"msedge" || name == L"chatgpt" ||
|
||||
name == L"codex" || name == L"claude";
|
||||
}
|
||||
bool selectPrevious(size_t count, const std::function<bool()> &valid)
|
||||
bool selectPrevious(size_t count, const std::function<bool()> &valid, bool forcePacing)
|
||||
{
|
||||
if (count > 100000)
|
||||
return false;
|
||||
@@ -686,9 +687,10 @@ bool selectPrevious(size_t count, const std::function<bool()> &valid)
|
||||
// Shift+Left events can all use the same caret position and select only one
|
||||
// character. Give each change time to settle before sending the next one.
|
||||
const auto target = GetForegroundWindow();
|
||||
const bool paced = forcePacing || needsSelectionDelay(target);
|
||||
diagnosticEvent(L"SelectPrevious requested=" + std::to_wstring(count) +
|
||||
L" mode=" + (needsSelectionDelay(target) ? std::wstring(L"paced-25ms") : std::wstring(L"batch")));
|
||||
if (needsSelectionDelay(target))
|
||||
(paced ? L" mode=paced-25ms" : L" mode=batch"));
|
||||
if (paced)
|
||||
{
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ ULONG_PTR inputMarker();
|
||||
bool ownKeyboardInput(const KBDLLHOOKSTRUCT &);
|
||||
INPUT keyboardInput(WORD key, DWORD flags = 0);
|
||||
bool needsSelectionDelay(HWND);
|
||||
bool selectPrevious(size_t count, const std::function<bool()> &valid);
|
||||
bool selectPrevious(size_t count, const std::function<bool()> &valid, bool forcePacing = false);
|
||||
bool modifiersReleased();
|
||||
void releaseModifiers();
|
||||
std::filesystem::path dataDirectory();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "ui_geometry.h"
|
||||
#include "diagnostics.h"
|
||||
#include "google_drive.h"
|
||||
#include "update.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
|
||||
+141
-25
@@ -1,13 +1,16 @@
|
||||
namespace
|
||||
{
|
||||
constexpr int HelpSearch = 810, HelpTopics = 811, HelpTitle = 812, HelpBody = 813;
|
||||
constexpr int HelpSearch = 810, HelpTopics = 811, HelpTitle = 812, HelpBody = 813, HelpReleaseLink = 814;
|
||||
constexpr int HelpRail = 268, HelpFooter = 56, HelpHeader = 66;
|
||||
constexpr int ShortcutTopic = 0, GuideRoot = 1, GettingStarted = 2;
|
||||
|
||||
enum class HelpPage { shortcuts, guide, releases };
|
||||
|
||||
struct HelpTopic
|
||||
{
|
||||
std::wstring title, text;
|
||||
int parent = -1;
|
||||
std::wstring releaseVersion;
|
||||
};
|
||||
|
||||
struct HelpView
|
||||
@@ -19,6 +22,8 @@ struct HelpView
|
||||
UINT dpi{};
|
||||
int selected{};
|
||||
bool rebuilding{};
|
||||
bool releases{};
|
||||
bool ukrainian{};
|
||||
};
|
||||
|
||||
std::wstring helpShortcuts(const App &app)
|
||||
@@ -65,16 +70,19 @@ std::wstring helpText(std::wstring line)
|
||||
return line;
|
||||
}
|
||||
|
||||
std::wstring helpResourceText(HINSTANCE instance, int resource)
|
||||
{
|
||||
HRSRC found = FindResourceW(instance, MAKEINTRESOURCEW(resource), RT_RCDATA);
|
||||
HGLOBAL loaded = found ? LoadResource(instance, found) : nullptr;
|
||||
const auto *bytes = loaded ? static_cast<const char *>(LockResource(loaded)) : nullptr;
|
||||
return bytes ? wide(std::string(bytes, SizeofResource(instance, found))) : std::wstring{};
|
||||
}
|
||||
|
||||
void addHelpDocument(HelpView &view, int resource, std::wstring title, std::wstring introduction)
|
||||
{
|
||||
const int root = static_cast<int>(view.topics.size());
|
||||
view.topics.push_back({std::move(title), std::move(introduction)});
|
||||
const auto instance = view.app->instance;
|
||||
HRSRC found = FindResourceW(instance, MAKEINTRESOURCEW(resource), RT_RCDATA);
|
||||
HGLOBAL loaded = found ? LoadResource(instance, found) : nullptr;
|
||||
const auto *bytes = loaded ? static_cast<const char *>(LockResource(loaded)) : nullptr;
|
||||
if (!bytes) return;
|
||||
std::wistringstream input(wide(std::string(bytes, SizeofResource(instance, found))));
|
||||
std::wistringstream input(helpResourceText(view.app->instance, resource));
|
||||
std::array<int, 7> ancestors;
|
||||
ancestors.fill(root);
|
||||
int topic = root;
|
||||
@@ -106,12 +114,74 @@ void addHelpDocument(HelpView &view, int resource, std::wstring title, std::wstr
|
||||
}
|
||||
}
|
||||
|
||||
int addReleaseTopics(HelpView &view, LANGID language)
|
||||
{
|
||||
view.topics.push_back({whatsNewTitle(language), view.ukrainian
|
||||
? L"Виберіть версію, щоб переглянути зміни."
|
||||
: L"Select a version to read its release notes."});
|
||||
std::wistringstream input(helpResourceText(view.app->instance, IDR_HELP_RELEASES));
|
||||
constexpr std::wstring_view ukrainianMarker = L"**Українською.**";
|
||||
std::wstring version, english, ukrainian;
|
||||
bool translated = false, withdrawn = false;
|
||||
int installed = 0;
|
||||
const auto add = [&]
|
||||
{
|
||||
if (version.empty()) return;
|
||||
auto &text = view.ukrainian && !ukrainian.empty() ? ukrainian : english;
|
||||
const auto end = text.find_last_not_of(L" \r\n\t");
|
||||
if (end == std::wstring::npos) return;
|
||||
text.resize(end + 1);
|
||||
if (version == AppVersion) installed = static_cast<int>(view.topics.size());
|
||||
auto title = L"v" + version;
|
||||
if (withdrawn) title += view.ukrainian ? L" (відкликано)" : L" (withdrawn)";
|
||||
view.topics.push_back({std::move(title), std::move(text), 0, withdrawn ? std::wstring{} : version});
|
||||
};
|
||||
for (std::wstring line; std::getline(input, line);)
|
||||
{
|
||||
if (line.ends_with(L'\r')) line.pop_back();
|
||||
if (line.starts_with(L"## v"))
|
||||
{
|
||||
add();
|
||||
const auto end = line.find(L' ', 4);
|
||||
version = line.substr(4, end == line.npos ? line.npos : end - 4);
|
||||
if (version.empty() || version.find_first_not_of(L"0123456789.") != version.npos)
|
||||
version.clear();
|
||||
english.clear();
|
||||
ukrainian.clear();
|
||||
translated = false;
|
||||
withdrawn = line.find(L"(withdrawn") != line.npos;
|
||||
continue;
|
||||
}
|
||||
if (version.empty()) continue;
|
||||
if (line.starts_with(ukrainianMarker))
|
||||
{
|
||||
translated = true;
|
||||
const auto start = line.find_first_not_of(L" \t", ukrainianMarker.size());
|
||||
line = start == line.npos ? std::wstring{} : line.substr(start);
|
||||
}
|
||||
auto &text = translated ? ukrainian : english;
|
||||
if (text.empty() && line.empty()) continue;
|
||||
if (line.starts_with(L"- ")) line.replace(0, 1, L"•");
|
||||
text += helpText(std::move(line)) + L"\r\n";
|
||||
}
|
||||
add();
|
||||
if (!installed)
|
||||
{
|
||||
installed = static_cast<int>(view.topics.size());
|
||||
view.topics.push_back({std::wstring(L"v") + AppVersion, view.ukrainian
|
||||
? L"Нотатки для цієї збірки ще недоступні. Попередні випуски можна переглянути у списку."
|
||||
: L"Notes for this build are unavailable. Earlier releases are in the list.", 0});
|
||||
}
|
||||
return installed;
|
||||
}
|
||||
|
||||
void showHelpTopic(HWND w, HelpView &view, int index)
|
||||
{
|
||||
view.selected = index;
|
||||
const auto &topic = view.topics[index];
|
||||
value(w, HelpTitle, topic.title);
|
||||
value(w, HelpBody, index == ShortcutTopic ? helpShortcuts(*view.app) : topic.text);
|
||||
value(w, HelpBody, !view.releases && index == ShortcutTopic ? helpShortcuts(*view.app) : topic.text);
|
||||
ShowWindow(GetDlgItem(w, HelpReleaseLink), topic.releaseVersion.empty() ? SW_HIDE : SW_SHOWNA);
|
||||
SendDlgItemMessageW(w, HelpBody, EM_SETSEL, 0, 0);
|
||||
SendDlgItemMessageW(w, HelpBody, EM_SCROLLCARET, 0, 0);
|
||||
}
|
||||
@@ -122,6 +192,7 @@ void fillHelpTopics(HWND w, HelpView &view)
|
||||
const auto query = lower(value(w, HelpSearch));
|
||||
std::vector<HTREEITEM> nodes(view.topics.size());
|
||||
HTREEITEM selected{};
|
||||
int selectedIndex{};
|
||||
view.rebuilding = true;
|
||||
SendMessageW(tree, WM_SETREDRAW, FALSE, 0);
|
||||
TreeView_DeleteAllItems(tree);
|
||||
@@ -137,17 +208,27 @@ void fillHelpTopics(HWND w, HelpView &view)
|
||||
node.item.pszText = const_cast<wchar_t *>(topic.title.c_str());
|
||||
node.item.lParam = static_cast<LPARAM>(i);
|
||||
nodes[i] = TreeView_InsertItem(tree, &node);
|
||||
if (!selected || static_cast<int>(i) == view.selected) selected = nodes[i];
|
||||
if (nodes[i] && (!selected || static_cast<int>(i) == view.selected))
|
||||
{
|
||||
selected = nodes[i];
|
||||
selectedIndex = static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
if (query.empty()) TreeView_Expand(tree, nodes[GuideRoot], TVE_EXPAND);
|
||||
if (query.empty()) TreeView_Expand(tree, nodes[view.releases ? 0 : GuideRoot], TVE_EXPAND);
|
||||
SendMessageW(tree, WM_SETREDRAW, TRUE, 0);
|
||||
view.rebuilding = false;
|
||||
if (selected) TreeView_SelectItem(tree, selected);
|
||||
if (selected)
|
||||
{
|
||||
TreeView_SelectItem(tree, selected);
|
||||
showHelpTopic(w, view, selectedIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
value(w, HelpTitle, L"No matching topics");
|
||||
value(w, HelpBody, L"Try another word or clear the search to see all topics.");
|
||||
value(w, HelpTitle, view.ukrainian ? L"Нічого не знайдено" : L"No matching topics");
|
||||
value(w, HelpBody, view.ukrainian ? L"Спробуйте інше слово або очистьте пошук." :
|
||||
L"Try another word or clear the search to see all topics.");
|
||||
ShowWindow(GetDlgItem(w, HelpReleaseLink), SW_HIDE);
|
||||
}
|
||||
view.rebuilding = false;
|
||||
InvalidateRect(tree, nullptr, TRUE);
|
||||
}
|
||||
|
||||
@@ -169,6 +250,7 @@ void layoutHelp(HWND w, HelpView &view)
|
||||
place(HelpTitle, content, scale(w, 13), r.right - pad, scale(w, 55));
|
||||
place(HelpBody, content, header + pad, r.right - pad, footer - scale(w, 10));
|
||||
place(IDCANCEL, r.right - pad - scale(w, 100), footer + scale(w, 14), r.right - pad, r.bottom - scale(w, 14));
|
||||
place(HelpReleaseLink, content, footer + scale(w, 14), content + scale(w, 170), r.bottom - scale(w, 14));
|
||||
const auto dpi = GetDpiForWindow(w);
|
||||
if (view.dpi != dpi || !view.heading)
|
||||
{
|
||||
@@ -252,6 +334,18 @@ LRESULT CALLBACK helpProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
}
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wp) == HelpSearch && HIWORD(wp) == EN_CHANGE) fillHelpTopics(w, *view);
|
||||
if (LOWORD(wp) == HelpReleaseLink && IsWindowVisible(GetDlgItem(w, HelpReleaseLink)))
|
||||
{
|
||||
const auto &version = view->topics[view->selected].releaseVersion;
|
||||
constexpr auto repository = L"https://gitea.hrynco.com/hrynco/hrynco-kswitcher";
|
||||
// Older release pages can be superseded while the tagged notes remain available.
|
||||
const auto path = version == AppVersion ? L"/releases/tag/release-v" + version
|
||||
: L"/src/tag/release-v" + version + L"/Release/README.md";
|
||||
const auto address = repository + path;
|
||||
if (reinterpret_cast<INT_PTR>(ShellExecuteW(w, L"open", address.c_str(), nullptr, nullptr, SW_SHOWNORMAL)) <= 32)
|
||||
MessageBoxW(w, view->ukrainian ? L"Не вдалося відкрити сторінку випуску." :
|
||||
L"Could not open the release page.", view->ukrainian ? L"Що нового" : L"What's new", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
if (LOWORD(wp) == IDCANCEL) DestroyWindow(w);
|
||||
return 0;
|
||||
case WM_NCDESTROY:
|
||||
@@ -265,7 +359,7 @@ LRESULT CALLBACK helpProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
return DefWindowProcW(w, msg, wp, lp);
|
||||
}
|
||||
|
||||
void openHelp(App &app, int topic)
|
||||
void openHelp(App &app, HelpPage page, LANGID language = LANG_ENGLISH)
|
||||
{
|
||||
if (!app.helpWindow)
|
||||
{
|
||||
@@ -273,15 +367,8 @@ void openHelp(App &app, int topic)
|
||||
app.helpWindow = w;
|
||||
setWindowTaskbarIdentity(w, IDI_KSWITCHER_HELP, L"HrynCo.KSwitcher.Help");
|
||||
auto &view = *reinterpret_cast<HelpView *>(GetWindowLongPtrW(w, GWLP_USERDATA));
|
||||
view.topics = {{L"Keyboard shortcuts", L"Current shortcut bindings and keyboard controls"}};
|
||||
addHelpDocument(view, IDR_HELP_GUIDE, L"Using KSwitcher", L"Choose an area to learn how to use it.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_MANUAL, L"KSwitcher manual", L"Detailed documentation for the main application.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_FILES, L"Files manual (Українська)", L"Докладний посібник з KSwitcher Files.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_COMPUTERS, L"Paired computers manual", L"Detailed documentation for discovery, pairing and LAN features.\r\n");
|
||||
|
||||
auto search = edit(w, HelpSearch, 0, 0, 0);
|
||||
SendMessageW(search, EM_SETLIMITTEXT, 120, 0);
|
||||
SendMessageW(search, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"Search help"));
|
||||
INITCOMMONCONTROLSEX classes{sizeof(classes), ICC_TREEVIEW_CLASSES};
|
||||
InitCommonControlsEx(&classes);
|
||||
control(w, WC_TREEVIEWW, L"Help topics", WS_TABSTOP | TVS_HASBUTTONS | TVS_LINESATROOT |
|
||||
@@ -289,13 +376,37 @@ void openHelp(App &app, int topic)
|
||||
control(w, L"STATIC", L"", SS_CENTERIMAGE | SS_ENDELLIPSIS, HelpTitle, 0, 0, 0, 0);
|
||||
auto body = edit(w, HelpBody, 0, 0, 0, 0, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL);
|
||||
SendMessageW(body, EM_SETLIMITTEXT, 1024 * 1024, 0);
|
||||
button(w, L"Open in Gitea", HelpReleaseLink, 0, 0);
|
||||
button(w, L"&Close", IDCANCEL, 0, 0);
|
||||
SendMessageW(w, WM_SYSCOLORCHANGE, 0, 0);
|
||||
layoutHelp(w, view);
|
||||
}
|
||||
const auto w = app.helpWindow;
|
||||
auto &view = *reinterpret_cast<HelpView *>(GetWindowLongPtrW(w, GWLP_USERDATA));
|
||||
view.selected = topic < static_cast<int>(view.topics.size()) ? topic : GuideRoot;
|
||||
const bool releases = page == HelpPage::releases;
|
||||
const bool ukrainian = releases && PRIMARYLANGID(language) == LANG_UKRAINIAN;
|
||||
int topic = page == HelpPage::shortcuts ? ShortcutTopic : GettingStarted;
|
||||
if (releases || view.topics.empty() || view.releases)
|
||||
{
|
||||
view.topics.clear();
|
||||
view.releases = releases;
|
||||
view.ukrainian = ukrainian;
|
||||
if (releases) topic = addReleaseTopics(view, language);
|
||||
else
|
||||
{
|
||||
view.topics = {{L"Keyboard shortcuts", L"Current shortcut bindings and keyboard controls"}};
|
||||
addHelpDocument(view, IDR_HELP_GUIDE, L"Using KSwitcher", L"Choose an area to learn how to use it.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_MANUAL, L"KSwitcher manual", L"Detailed documentation for the main application.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_FILES, L"Files manual (Українська)", L"Докладний посібник з KSwitcher Files.\r\n");
|
||||
addHelpDocument(view, IDR_HELP_COMPUTERS, L"Paired computers manual", L"Detailed documentation for discovery, pairing and LAN features.\r\n");
|
||||
}
|
||||
}
|
||||
SetWindowTextW(w, releases ? whatsNewTitle(language) : L"KSwitcher Help");
|
||||
value(w, IDCANCEL, ukrainian ? L"&Закрити" : L"&Close");
|
||||
value(w, HelpReleaseLink, ukrainian ? L"Відкрити в Gitea" : L"Open in Gitea");
|
||||
const auto *searchHint = ukrainian ? L"Пошук випусків" : releases ? L"Search releases" : L"Search help";
|
||||
SendDlgItemMessageW(w, HelpSearch, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(searchHint));
|
||||
view.selected = topic;
|
||||
if (value(w, HelpSearch).empty()) fillHelpTopics(w, view);
|
||||
else value(w, HelpSearch, L"");
|
||||
if (IsIconic(w)) ShowWindow(w, SW_RESTORE);
|
||||
@@ -305,5 +416,10 @@ void openHelp(App &app, int topic)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void showHelp(App &app) { openHelp(app, GettingStarted); }
|
||||
void showShortcuts(App &app) { openHelp(app, ShortcutTopic); }
|
||||
void showHelp(App &app) { openHelp(app, HelpPage::guide); }
|
||||
void showShortcuts(App &app) { openHelp(app, HelpPage::shortcuts); }
|
||||
const wchar_t *whatsNewTitle(LANGID language)
|
||||
{
|
||||
return PRIMARYLANGID(language) == LANG_UKRAINIAN ? L"Що нового" : L"What's new";
|
||||
}
|
||||
void showWhatsNew(App &app, LANGID language) { openHelp(app, HelpPage::releases, language); }
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.8.0";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.8.1";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
@@ -48,6 +48,39 @@ function Wait-For([string]$Name, [scriptblock]$Condition) {
|
||||
throw "Timed out waiting for $Name."
|
||||
}
|
||||
|
||||
function Read-FilesList([IntPtr]$List) {
|
||||
$count = [FilesCommandsUi]::Send($List, 395, [IntPtr]::Zero, [IntPtr]::Zero).ToInt32()
|
||||
for ($row = 0; $row -lt $count; ++$row) {
|
||||
$label = [Text.StringBuilder]::new(32768)
|
||||
if ([FilesCommandsUi]::Read($List, 393, [IntPtr]$row, $label).ToInt64() -lt 0) { break }
|
||||
$label.ToString()
|
||||
}
|
||||
}
|
||||
|
||||
function Select-FilesListRow([IntPtr]$List, [string]$Label) {
|
||||
$selection = [array]::IndexOf(@(Read-FilesList $List), $Label)
|
||||
if ($selection -lt 0) { throw "Missing row '$Label'." }
|
||||
[void][FilesCommandsUi]::Send($List, 390, [IntPtr]$selection, [IntPtr]::Zero)
|
||||
}
|
||||
|
||||
function Open-FilesSource([IntPtr]$Window, [int]$Side, [string]$Source) {
|
||||
$menu = if ($Side -eq 0) { 130 } else { 134 }
|
||||
$picker = [FilesCommandsUi]::GetDlgItem($Window, 121)
|
||||
[void][FilesCommandsUi]::Post($Window, 0x111, [IntPtr]$menu, [IntPtr]::Zero)
|
||||
$entry = Wait-For "Change drive in panel ${Side}'s menu" {
|
||||
if ([FilesCommandsUi]::IsWindowVisible($picker)) {
|
||||
Read-FilesList $picker | Where-Object { $_ -like '*Change drive*' } | Select-Object -First 1
|
||||
}
|
||||
}
|
||||
Select-FilesListRow $picker $entry
|
||||
[void][FilesCommandsUi]::Post($Window, 0x111, [IntPtr](0x20000 + 121), $picker)
|
||||
[void](Wait-For "$Source in panel ${Side}'s source picker" {
|
||||
[FilesCommandsUi]::IsWindowVisible($picker) -and (Read-FilesList $picker) -contains $Source
|
||||
})
|
||||
Select-FilesListRow $picker $Source
|
||||
[void][FilesCommandsUi]::Post($Window, 0x111, [IntPtr](0x20000 + 121), $picker)
|
||||
}
|
||||
|
||||
function Invoke-FilesCommand([IntPtr]$Window, [string]$LabelPattern) {
|
||||
[void][FilesCommandsUi]::Post($Window, 273, [IntPtr]132, [IntPtr]::Zero)
|
||||
$picker = [FilesCommandsUi]::GetDlgItem($Window, 121)
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Executable,
|
||||
[string]$PreferenceKey = 'Software\KSwitcher\Files',
|
||||
[string]$Screenshot,
|
||||
[int]$FtpPort
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. "$PSScriptRoot/files_commands_ui.ps1"
|
||||
|
||||
function Read-Caption([IntPtr]$Control) {
|
||||
$label = [Text.StringBuilder]::new(1024)
|
||||
[void][FilesCommandsUi]::Read($Control, 13, [IntPtr]$label.Capacity, $label)
|
||||
$label.ToString()
|
||||
}
|
||||
|
||||
function Test-Rows([IntPtr]$List, [string[]]$Expected) {
|
||||
(@(Read-FilesList $List) -join [char]10) -ceq ($Expected -join [char]10)
|
||||
}
|
||||
|
||||
function Send-PanelKey([IntPtr]$List, [int]$Key) {
|
||||
[void][FilesCommandsUi]::Post($List, 0x100, [IntPtr]$Key, [IntPtr]::Zero)
|
||||
}
|
||||
|
||||
function Save-FilesWindow([IntPtr]$Window, [string]$Destination) {
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$bounds = [FilesCommandsUi+Rect]::new()
|
||||
if (![FilesCommandsUi]::GetClientRect($Window, [ref]$bounds)) { throw 'Could not locate the Files window.' }
|
||||
$bitmap = [Drawing.Bitmap]::new($bounds.Right, $bounds.Bottom)
|
||||
try {
|
||||
$graphics = [Drawing.Graphics]::FromImage($bitmap)
|
||||
try {
|
||||
$dc = $graphics.GetHdc()
|
||||
try {
|
||||
if (![FilesCommandsUi]::PrintWindow($Window, $dc, 3)) { throw 'Could not render the Files window.' }
|
||||
} finally { $graphics.ReleaseHdc($dc) }
|
||||
} finally { $graphics.Dispose() }
|
||||
$bitmap.Save($Destination, [Drawing.Imaging.ImageFormat]::Png)
|
||||
} finally { $bitmap.Dispose() }
|
||||
}
|
||||
|
||||
$exe = (Resolve-Path -LiteralPath $Executable).Path
|
||||
$root = [IO.Directory]::CreateTempSubdirectory('ks-recent-folders-').FullName
|
||||
$preferences = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey($PreferenceKey)
|
||||
$names = 'RecentFolders', 'FtpProfiles', 'LeftPath', 'RightPath', 'LeftCursor', 'RightCursor',
|
||||
'LeftFtpLocation', 'RightFtpLocation', 'WindowPlacement', 'LeftViewOrder', 'RightViewOrder'
|
||||
$saved = @{}
|
||||
foreach ($name in $names) {
|
||||
if ($name -in $preferences.GetValueNames()) {
|
||||
$saved[$name] = @($preferences.GetValue($name), $preferences.GetValueKind($name))
|
||||
}
|
||||
}
|
||||
|
||||
$process = $null
|
||||
try {
|
||||
foreach ($folder in 'left', 'right', 'destination', 'remove') {
|
||||
[void][IO.Directory]::CreateDirectory((Join-Path $root $folder))
|
||||
}
|
||||
$leftFolder = Join-Path $root 'left'
|
||||
$rightFolder = Join-Path $root 'right'
|
||||
$destinationFolder = Join-Path $root 'destination'
|
||||
$removeFolder = Join-Path $root 'remove'
|
||||
[IO.File]::WriteAllText((Join-Path $leftFolder 'left-marker.txt'), 'left file')
|
||||
[IO.File]::WriteAllText((Join-Path $rightFolder 'right-marker.txt'), 'right file')
|
||||
[IO.File]::WriteAllText((Join-Path $destinationFolder 'opened-marker.txt'), 'existing folder')
|
||||
|
||||
$ftpId = [guid]::NewGuid().ToString('N')
|
||||
if ($FtpPort) {
|
||||
$ftpProfile = @(@{id=$ftpId; name='Local FTP'; host='127.0.0.1'; port=$FtpPort; user=''; secret=@()})
|
||||
$preferences.SetValue('FtpProfiles', [Text.Encoding]::UTF8.GetBytes((ConvertTo-Json -InputObject $ftpProfile -Compress)), 'Binary')
|
||||
}
|
||||
$entries = @($destinationFolder, @{source='ftp'; id=$ftpId; label='Local FTP'; path='\documents'}, $removeFolder)
|
||||
$ftpLabel = 'FTP · Local FTP · /documents'
|
||||
$preferences.SetValue('RecentFolders', [Text.Encoding]::UTF8.GetBytes((ConvertTo-Json -InputObject $entries -Compress)), 'Binary')
|
||||
foreach ($name in 'LeftViewOrder', 'RightViewOrder') { $preferences.SetValue($name, 0, 'DWord') }
|
||||
$preferences.SetValue('LeftPath', $leftFolder, 'String')
|
||||
$preferences.SetValue('RightPath', $rightFolder, 'String')
|
||||
$preferences.SetValue('LeftCursor', (Join-Path $leftFolder 'left-marker.txt'), 'String')
|
||||
foreach ($name in 'RightCursor', 'LeftFtpLocation', 'RightFtpLocation', 'WindowPlacement') {
|
||||
$preferences.DeleteValue($name, $false)
|
||||
}
|
||||
|
||||
$process = Start-Process -FilePath $exe -WindowStyle Hidden -PassThru
|
||||
$window = Wait-For 'the Files window' {
|
||||
$candidate = [IntPtr]::Zero
|
||||
while (($candidate = [FilesCommandsUi]::FindWindowEx([IntPtr]::Zero, $candidate, 'KSwitcher.Files', [NullString]::Value)) -ne [IntPtr]::Zero) {
|
||||
[uint32]$owner = 0
|
||||
[void][FilesCommandsUi]::GetWindowThreadProcessId($candidate, [ref]$owner)
|
||||
if ($owner -eq $process.Id) { return $candidate }
|
||||
}
|
||||
}
|
||||
if ($Screenshot) { [void][FilesCommandsUi]::SetWindowPos($window, 0, 80, 60, 1380, 720, 20) }
|
||||
[void][FilesCommandsUi]::ShowWindow($window, 4)
|
||||
$picker = [FilesCommandsUi]::GetDlgItem($window, 121)
|
||||
$left = [FilesCommandsUi]::GetDlgItem($window, 102)
|
||||
$right = [FilesCommandsUi]::GetDlgItem($window, 103)
|
||||
$leftPath = [FilesCommandsUi]::GetDlgItem($window, 142)
|
||||
$rightPath = [FilesCommandsUi]::GetDlgItem($window, 143)
|
||||
[void](Wait-For 'both initial folders' {
|
||||
(Read-Caption $leftPath) -eq $leftFolder -and (Read-Caption $rightPath) -eq $rightFolder -and
|
||||
(Read-FilesList $left) -contains 'left-marker.txt' -and (Read-FilesList $right) -contains 'right-marker.txt'
|
||||
})
|
||||
$leftBefore = @(Read-FilesList $left)
|
||||
Select-FilesListRow $left 'left-marker.txt'
|
||||
$rightBefore = @(Read-FilesList $right)
|
||||
|
||||
Open-FilesSource $window 0 'Recent folders'
|
||||
[void](Wait-For 'recent folders in the left panel' {
|
||||
(Read-Caption $leftPath) -ceq 'Recent folders' -and
|
||||
(Test-Rows $left @($destinationFolder, $ftpLabel, $removeFolder))
|
||||
})
|
||||
if ([FilesCommandsUi]::IsWindowVisible($picker) -or !(Test-Rows $right $rightBefore)) {
|
||||
throw 'Recent folders opened a popup or modified the right panel.'
|
||||
}
|
||||
if ($Screenshot) { Save-FilesWindow $window $Screenshot }
|
||||
|
||||
Select-FilesListRow $left $removeFolder
|
||||
Send-PanelKey $left 46
|
||||
[void](Wait-For 'the recent entry to be removed' { Test-Rows $left @($destinationFolder, $ftpLabel) })
|
||||
if (!(Test-Path -LiteralPath $removeFolder -PathType Container)) { throw 'Delete removed the underlying folder.' }
|
||||
Send-PanelKey $left 27
|
||||
[void](Wait-For 'Escape to restore the left panel' {
|
||||
$row = [FilesCommandsUi]::Send($left, 392, 0, 0).ToInt32()
|
||||
(Read-Caption $leftPath) -eq $leftFolder -and (Test-Rows $left $leftBefore) -and
|
||||
$row -ge 0 -and $leftBefore[$row] -eq 'left-marker.txt'
|
||||
})
|
||||
|
||||
Open-FilesSource $window 1 'Recent folders'
|
||||
[void](Wait-For 'updated recent folders in the right panel' {
|
||||
(Read-Caption $rightPath) -ceq 'Recent folders' -and (Test-Rows $right @($destinationFolder, $ftpLabel))
|
||||
})
|
||||
if ([FilesCommandsUi]::IsWindowVisible($picker) -or !(Test-Rows $left $leftBefore)) {
|
||||
throw 'Recent folders opened a popup or modified the left panel.'
|
||||
}
|
||||
Select-FilesListRow $right $destinationFolder
|
||||
Send-PanelKey $right 13
|
||||
[void](Wait-For 'the local folder to open on the right' {
|
||||
(Read-Caption $rightPath) -eq $destinationFolder -and (Read-FilesList $right) -contains 'opened-marker.txt'
|
||||
})
|
||||
|
||||
if ($FtpPort) {
|
||||
Open-FilesSource $window 0 'Recent folders'
|
||||
[void](Wait-For 'the FTP recent entry' { (Read-FilesList $left) -contains $ftpLabel })
|
||||
Select-FilesListRow $left $ftpLabel
|
||||
Send-PanelKey $left 13
|
||||
[void](Wait-For 'the FTP directory to open on the left' {
|
||||
(Read-Caption $leftPath) -ceq 'Local FTP · /documents' -and
|
||||
(Read-FilesList $left) -contains 'ftp-marker.txt'
|
||||
})
|
||||
if ((Read-Caption $rightPath) -ne $destinationFolder) { throw 'Opening FTP modified the right panel.' }
|
||||
}
|
||||
|
||||
[void][FilesCommandsUi]::Post($window, 16, 0, 0)
|
||||
if (!$process.WaitForExit(5000)) { throw 'Files did not close.' }
|
||||
$recorded = [Text.Encoding]::UTF8.GetString($preferences.GetValue('RecentFolders')) | ConvertFrom-Json
|
||||
if ($recorded -contains $removeFolder) { throw 'The remove action was not persisted.' }
|
||||
'Verified in-panel Recent folders, deletion, cursor restoration and folder navigation.'
|
||||
} finally {
|
||||
if ($process -and !$process.HasExited) { Stop-Process -Id $process.Id; $process.WaitForExit() }
|
||||
foreach ($name in $names) {
|
||||
if ($saved.ContainsKey($name)) { $preferences.SetValue($name, $saved[$name][0], $saved[$name][1]) }
|
||||
else { $preferences.DeleteValue($name, $false) }
|
||||
}
|
||||
$preferences.Dispose()
|
||||
$temp = (Resolve-Path -LiteralPath ([IO.Path]::GetTempPath())).Path.TrimEnd('\')
|
||||
$resolved = (Resolve-Path -LiteralPath $root).Path
|
||||
if ((Split-Path -Parent $resolved) -eq $temp -and (Split-Path -Leaf $resolved) -like 'ks-recent-folders-*') {
|
||||
Remove-Item -LiteralPath $resolved -Recurse -Force
|
||||
}
|
||||
}
|
||||
@@ -61,53 +61,26 @@ try {
|
||||
}
|
||||
}
|
||||
[void][FilesCommandsUi]::ShowWindow($main, 4)
|
||||
$picker = [FilesCommandsUi]::GetDlgItem($main, 121)
|
||||
function Read-List([IntPtr]$List) {
|
||||
$count = [FilesCommandsUi]::Send($List, 395, [IntPtr]::Zero, [IntPtr]::Zero).ToInt32()
|
||||
for ($row = 0; $row -lt $count; ++$row) {
|
||||
$label = [Text.StringBuilder]::new(256)
|
||||
[void][FilesCommandsUi]::Read($List, 393, [IntPtr]$row, $label)
|
||||
$label.ToString()
|
||||
}
|
||||
}
|
||||
function Same-Rows($First, $Second) {
|
||||
($First -join [char]10) -ceq ($Second -join [char]10)
|
||||
}
|
||||
function Open-Smb([int]$Side) {
|
||||
$menu = if ($Side -eq 0) { 130 } else { 134 }
|
||||
[void][FilesCommandsUi]::Post($main, 0x111, [IntPtr]$menu, [IntPtr]::Zero)
|
||||
[void](Wait-For "Change drive in panel ${Side}'s menu" {
|
||||
[FilesCommandsUi]::IsWindowVisible($picker) -and [bool]((Read-List $picker) -like '*Change drive*')
|
||||
})
|
||||
$options = @(Read-List $picker)
|
||||
$selection = [array]::IndexOf($options, ($options -like '*Change drive*' | Select-Object -First 1))
|
||||
[void][FilesCommandsUi]::Send($picker, 390, [IntPtr]$selection, [IntPtr]::Zero)
|
||||
[void][FilesCommandsUi]::Post($main, 0x111, [IntPtr](0x20000 + 121), $picker)
|
||||
[void](Wait-For "SMB in panel ${Side}'s source picker" {
|
||||
[FilesCommandsUi]::IsWindowVisible($picker) -and (Read-List $picker) -contains 'SMB'
|
||||
})
|
||||
$selection = [array]::IndexOf(@(Read-List $picker), 'SMB')
|
||||
if ($selection -lt 0) { throw 'SMB was missing from Change drive.' }
|
||||
[void][FilesCommandsUi]::Send($picker, 390, [IntPtr]$selection, [IntPtr]::Zero)
|
||||
[void][FilesCommandsUi]::Post($main, 0x111, [IntPtr](0x20000 + 121), $picker)
|
||||
}
|
||||
$left = [FilesCommandsUi]::GetDlgItem($main, 102)
|
||||
$right = [FilesCommandsUi]::GetDlgItem($main, 103)
|
||||
[void](Wait-For 'both local panels' { @(Read-List $left).Count -gt 0 -and @(Read-List $right).Count -gt 0 })
|
||||
$leftBefore = @(Read-List $left)
|
||||
$rightBefore = @(Read-List $right)
|
||||
Open-Smb 0
|
||||
[void](Wait-For 'both local panels' { @(Read-FilesList $left).Count -gt 0 -and @(Read-FilesList $right).Count -gt 0 })
|
||||
$leftBefore = @(Read-FilesList $left)
|
||||
$rightBefore = @(Read-FilesList $right)
|
||||
Open-FilesSource $main 0 'SMB'
|
||||
[void](Wait-For 'the SMB profile in the left file panel' {
|
||||
(Read-List $left) -like 'Render fixture*'
|
||||
(Read-FilesList $left) -like 'Render fixture*'
|
||||
})
|
||||
if (!(Same-Rows $rightBefore @(Read-List $right))) { throw 'Opening SMB on the left changed the right panel.' }
|
||||
if (!(Same-Rows $rightBefore @(Read-FilesList $right))) { throw 'Opening SMB on the left changed the right panel.' }
|
||||
[void][FilesCommandsUi]::Post($left, 0x100, [IntPtr]27, [IntPtr]::Zero)
|
||||
[void](Wait-For 'Escape to return to the left folder' { Same-Rows $leftBefore @(Read-List $left) })
|
||||
Open-Smb 1
|
||||
[void](Wait-For 'Escape to return to the left folder' { Same-Rows $leftBefore @(Read-FilesList $left) })
|
||||
Open-FilesSource $main 1 'SMB'
|
||||
[void](Wait-For 'the SMB profile in the right file panel' {
|
||||
(Read-List $right) -like 'Render fixture*'
|
||||
(Read-FilesList $right) -like 'Render fixture*'
|
||||
})
|
||||
if (!(Same-Rows $leftBefore @(Read-List $left))) { throw 'Opening SMB on the right changed the left panel.' }
|
||||
if (!(Same-Rows $leftBefore @(Read-FilesList $left))) { throw 'Opening SMB on the right changed the left panel.' }
|
||||
|
||||
function Find-DialogControl([int]$Id) {
|
||||
$dialog = [IntPtr]::Zero
|
||||
|
||||
@@ -426,6 +426,74 @@ int main(int argc, char **argv) {
|
||||
ks::encodePng(ks::decodeImage(preview)));
|
||||
SendMessageW(window, WM_COMMAND, IDCANCEL, 0);
|
||||
require(!app.helpWindow && !IsWindow(window), "Close releases the help window");
|
||||
|
||||
const auto seen = temp / L"whats-new-seen.txt";
|
||||
app.showWhatsNewAfterUpdate();
|
||||
require(!app.helpWindow && !std::filesystem::exists(seen), "ordinary startup does not open release notes");
|
||||
app.updateStartupEvent = L"Local\\KSwitcher.Update.Started." + ks::newSnippetId();
|
||||
app.showWhatsNewAfterUpdate();
|
||||
require(!app.helpWindow && !std::filesystem::exists(seen), "an unconfirmed update does not open release notes");
|
||||
const auto ready = CreateEventW(nullptr, TRUE, FALSE, app.updateStartupEvent.c_str());
|
||||
require(ready != nullptr, "update test creates a startup handshake");
|
||||
app.showWhatsNewAfterUpdate();
|
||||
const auto signaled = WaitForSingleObject(ready, 0);
|
||||
CloseHandle(ready);
|
||||
require(signaled == WAIT_OBJECT_0 && IsWindowVisible(app.helpWindow) && std::filesystem::exists(seen),
|
||||
"successful update signals startup and opens the installed notes once");
|
||||
DestroyWindow(app.helpWindow);
|
||||
const auto secondReady = CreateEventW(nullptr, TRUE, FALSE, app.updateStartupEvent.c_str());
|
||||
require(secondReady != nullptr, "repeat startup can complete its updater handshake");
|
||||
app.showWhatsNewAfterUpdate();
|
||||
const auto secondSignal = WaitForSingleObject(secondReady, 0);
|
||||
CloseHandle(secondReady);
|
||||
require(secondSignal == WAIT_OBJECT_0 && !app.helpWindow,
|
||||
"the same version acknowledges the updater without reopening the notes");
|
||||
|
||||
const auto language = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
|
||||
ks::showWhatsNew(app, language);
|
||||
const auto releases = app.helpWindow;
|
||||
const auto releaseText = [&](int id) {
|
||||
wchar_t buffer[32768]{};
|
||||
GetDlgItemTextW(releases, id, buffer, std::size(buffer));
|
||||
return std::wstring(buffer);
|
||||
};
|
||||
require(std::wstring(ks::whatsNewTitle(language)) == L"What's new" &&
|
||||
releaseText(812) == std::wstring(L"v") + ks::AppVersion &&
|
||||
!releaseText(813).empty() && IsWindowVisible(GetDlgItem(releases, 814)),
|
||||
"manual Help command opens embedded notes for the installed release with a Gitea link");
|
||||
const auto versions = GetDlgItem(releases, 811);
|
||||
require(TreeView_GetCount(versions) > 2, "prior releases are available offline");
|
||||
SetDlgItemTextW(releases, 810, L"v0.6.126");
|
||||
require(releaseText(812) == L"v0.6.126 (withdrawn)" && !IsWindowVisible(GetDlgItem(releases, 814)),
|
||||
"withdrawn releases show their archived notes without a dead Gitea release link");
|
||||
SetDlgItemTextW(releases, 810, L"v0.8.0");
|
||||
require(releaseText(812) == L"v0.8.0" && releaseText(813).find(L"Find files recursively") != std::wstring::npos,
|
||||
"release history searches and shows English notes");
|
||||
const auto ukrainian = MAKELANGID(LANG_UKRAINIAN, SUBLANG_DEFAULT);
|
||||
ks::showWhatsNew(app, ukrainian);
|
||||
require(releases == app.helpWindow && std::wstring(ks::whatsNewTitle(ukrainian)) == L"Що нового" &&
|
||||
releaseText(814) == L"Відкрити в Gitea",
|
||||
"the same window can display Ukrainian release history");
|
||||
SetDlgItemTextW(releases, 810, L"v0.8.0");
|
||||
require(releaseText(812) == L"v0.8.0" && releaseText(813).find(L"Рекурсивний пошук") != std::wstring::npos &&
|
||||
releaseText(813).find(L"Find files recursively") == std::wstring::npos,
|
||||
"Ukrainian notes render without the adjacent English section");
|
||||
|
||||
SetDlgItemTextW(releases, 810, L"");
|
||||
require(TreeView_GetCount(versions) > 2 && releaseText(812) == L"v0.8.0",
|
||||
"clearing the search retains the selected release in the full history");
|
||||
RECT releaseClient{};
|
||||
GetClientRect(releases, &releaseClient);
|
||||
RedrawWindow(releases, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
|
||||
const auto releaseDc = GetDC(releases);
|
||||
const auto releasePreview = ks::screenshotClip(releaseDc, releaseClient.right, releaseClient.bottom, {});
|
||||
ReleaseDC(releases, releaseDc);
|
||||
ks::atomicWrite(std::filesystem::path(ks::executable()).parent_path() / L"whats-new.png",
|
||||
ks::encodePng(ks::decodeImage(releasePreview)));
|
||||
ks::showHelp(app);
|
||||
require(releases == app.helpWindow && releaseText(812) == L"Getting started" &&
|
||||
!IsWindowVisible(GetDlgItem(releases, 814)),
|
||||
"returning to the guide restores its topics and actions");
|
||||
}
|
||||
std::filesystem::remove_all(temp);
|
||||
std::cout << "Passed " << checks << " offline help checks\n";
|
||||
|
||||
@@ -79,6 +79,7 @@ bool typeDuringMacros = false;
|
||||
ULONGLONG macroStart{}, macroEnd{};
|
||||
int copyFailuresRemaining = 0, copyRequests = 0;
|
||||
int droppedSelectionKeys = 0;
|
||||
int delayedSelectionKeys = 0;
|
||||
bool trimCopiedSpaces = false;
|
||||
int trimmedCopies = 0;
|
||||
bool temporaryClipboardExcluded = true;
|
||||
@@ -152,6 +153,16 @@ LRESULT CALLBACK observeEnter(HWND w, UINT message, WPARAM wp, LPARAM lp, UINT_P
|
||||
--copyFailuresRemaining;
|
||||
return 0;
|
||||
}
|
||||
if (delayedSelectionKeys)
|
||||
{
|
||||
DWORD start{}, end{};
|
||||
SendMessageW(w, EM_GETSEL, reinterpret_cast<WPARAM>(&start), reinterpret_cast<LPARAM>(&end));
|
||||
auto result = DefSubclassProc(w, message, wp, lp);
|
||||
// Apply the remaining Shift+Left moves after publishing the partial selection.
|
||||
SendMessageW(w, EM_SETSEL, end, start - std::min<DWORD>(start, delayedSelectionKeys));
|
||||
delayedSelectionKeys = 0;
|
||||
return result;
|
||||
}
|
||||
if (trimCopiedSpaces)
|
||||
{
|
||||
auto result = DefSubclassProc(w, message, wp, lp);
|
||||
@@ -338,6 +349,8 @@ LRESULT CALLBACK procedure(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
switch (stage++)
|
||||
{
|
||||
case 0:
|
||||
app->settings.writeLog = true;
|
||||
ks::setLoggingEnabled(true);
|
||||
saved = ks::readClipboard(app->window, 64 * 1024 * 1024);
|
||||
captured = true;
|
||||
app->ownSequence = ks::writeClipboard(app->window, ks::textClip(sentinel));
|
||||
@@ -685,6 +698,26 @@ LRESULT CALLBACK procedure(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case 59:
|
||||
require(text() == L"OLDghbdtn NEXT", "hotkey without selection reconverts only the previous middle range");
|
||||
require(ks::readClipboard(app->window).text() == sentinel, "selected and repeated conversions restore clipboard");
|
||||
[[fallthrough]];
|
||||
case 95:
|
||||
if (!captured)
|
||||
{
|
||||
saved = ks::readClipboard(app->window, 64 * 1024 * 1024);
|
||||
captured = true;
|
||||
app->ownSequence = ks::writeClipboard(app->window, ks::textClip(sentinel));
|
||||
}
|
||||
prepare(L" nen NEXT", false);
|
||||
SendMessageW(field, EM_SETSEL, 6, 6);
|
||||
record(L"nen ");
|
||||
droppedSelectionKeys = delayedSelectionKeys = 2;
|
||||
app->transform(ks::Direct + ru);
|
||||
stage = 96;
|
||||
break;
|
||||
case 96:
|
||||
require(text() == L" " + ks::convertTo(L"nen ", app->layouts, ru, en) + L"NEXT",
|
||||
"delayed selection preserves the older prefix and text after the caret");
|
||||
require(!droppedSelectionKeys && !delayedSelectionKeys, "fixture applied the delayed selection moves");
|
||||
require(ks::readClipboard(app->window).text() == sentinel, "delayed selection restores clipboard");
|
||||
finish();
|
||||
break;
|
||||
case 66:
|
||||
@@ -1392,6 +1425,8 @@ int main(int argc, char **argv)
|
||||
stage = 93;
|
||||
if (argc > 1 && std::string(argv[1]) == "--snippet-word-boundaries")
|
||||
stage = 84;
|
||||
if (argc > 1 && std::string(argv[1]) == "--delayed-selection-only")
|
||||
stage = 95;
|
||||
SetTimer(host, 1, 100, nullptr);
|
||||
auto forwarding = SetWindowsHookExW(WH_KEYBOARD_LL,forwardingHook,GetModuleHandleW(nullptr),0);
|
||||
require(forwarding!=nullptr,"downstream forwarding fixture installed before application hook");
|
||||
|
||||
Reference in new issue
Block a user