Compare commits

..
2 Commits
Author SHA1 Message Date
agrynco ab41b4383c Release KSwitcher v0.7.1
Embed OpenBao synchronization in the settings tree.
2026-11-24 17:54:01 +02:00
agrynco 0e9e5dd2ef Release KSwitcher v0.7.1 with embedded OpenBao settings 2026-11-24 17:53:50 +02:00
12 changed files with 239 additions and 158 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.24)
project(KSwitcher VERSION 0.7.0 LANGUAGES CXX RC)
project(KSwitcher VERSION 0.7.1 LANGUAGES CXX RC)
if(NOT WIN32)
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
endif()
+7 -7
View File
@@ -710,7 +710,7 @@ Conversion is cancelled rather than pasting into a different window or replacing
## OpenBao synchronization (experimental, opt-in)
The **Sync...** button is available in Settings for everyone. Synchronization remains disabled
Open **Settings → Sync → OpenBao**. Synchronization remains disabled
until you configure your own OpenBao and enable it. Connection configuration is saved separately
in `sync.json`. The portable data directory is normally `data/` beside the executable; installations
without a writable application directory use the existing local-app-data fallback.
@@ -722,11 +722,11 @@ authentication mount (default `userpass`). Use the same profile on each of your
administrator-provisioned private access, not public account registration. Non-root namespaces,
reverse-proxy URL prefixes, MFA login flows and other providers are not implemented yet.
Enable synchronization and choose **Save / Sign in / Sync**. The dialog saves connection changes
immediately; the main Settings window's Save/Cancel does not control this separate configuration.
Enable synchronization and choose **Save and sync** on the OpenBao page. This button saves the
connection settings separately from the main Settings draft.
When synchronization is disabled, connection fields and sync actions are inactive. Check **Enable
synchronization** to make them available. To disable an existing connection, uncheck it and click
**Save**; this preserves the saved connection and password without starting a sync request.
**Save connection**. This preserves the saved connection and password without starting a sync request.
**Disconnect / forget password** remains available while synchronization is disabled.
A blank password keeps the existing Windows credential for that server, login mount and username.
The password is saved in Windows Credential Manager, not in settings exports, logs or the remote
@@ -738,7 +738,7 @@ saved credential. A request already sent to the server may still complete; its d
will not be applied after the connection changes. Old credentials for other connection identities
can be removed in Windows Credential Manager under `KSwitcher.Sync/`.
On the first connection, **Save / Sign in / Sync** merges the existing profiles without
On the first connection, **Save and sync** merges the existing profiles without
requiring a whole-profile replacement. Independent entries (such as snippets, exclusions and
replacement pairs) are combined. Different values for the same setting remain on their respective
sides and appear in **Resolve individual conflicts...**; no value is guessed without a common history.
@@ -786,8 +786,8 @@ paths refer to the same locations and may need updating on a fresh installation.
Connection details and credentials stay local so you can sign in again after reinstalling.
Clipboard history, screenshots and dictionary files are never uploaded. Full synchronization identifies
missing keyboard layouts by language (when Windows can identify it) and exact ID.
Install the same layout variant, or select **Keep this PC's layouts and layout shortcuts (sync
other settings)** and click **Save / Sign in / Sync**. This device-local option keeps the entire
Install the same layout variant, or select **Keep this PC's layouts and layout shortcuts**
and click **Save and sync**. This device-local option keeps the entire
local layout cycle and its direct shortcuts unchanged while synchronizing the other shared settings.
The server's layout cycle and direct shortcuts are preserved on automatic sync and explicit Upload;
Download also keeps the local layout configuration. Later syncs cannot erase missing server layouts
+6
View File
@@ -1,5 +1,11 @@
# Latest Windows release
## v0.7.1 — 2026-11-24
OpenBao connection and synchronization actions are now on **Settings → Sync → OpenBao**. Choose **Save and sync** on that page to save the connection and start synchronization. Settings search can find OpenBao fields, and switching sections preserves the connection draft.
**Українською.** Підключення й дії синхронізації OpenBao тепер доступні в **Settings → Sync → OpenBao**. Натисніть **Save and sync** на цій сторінці, щоб зберегти підключення й запустити синхронізацію. Пошук Settings знаходить поля OpenBao, а перехід між розділами зберігає чернетку підключення.
## v0.7.0 — 2026-11-24
- The native Settings window has a resizable navigation tree and a **Search settings** field. Search finds individual settings, highlights matches, and scrolls the selected control into view.
+1 -1
View File
@@ -1 +1 @@
f403c978197e1a8047a9e81e9e1e9b0aa82e3b142f3cd06cae24b87b19c71494 KSwitcher-win-x64.zip
82c4a84d20c67ada45c71cee7c636b23ee23d5e7851218540705f598e49fe0e9 KSwitcher-win-x64.zip
+67 -67
View File
@@ -1,165 +1,165 @@
{
"version": "0.7.0",
"version": "0.7.1",
"files": [
{
"sha256": "ffbd63233afb06980ea59d93c2fb470d5567d4768e64e798aaa75a6ac542050a",
"path": "KSwitcher.exe",
"size": 2431488,
"path": "KSwitcher.exe"
"sha256": "fa3125cc913aa08b09a1bc7fe55646fd560cc2c3e6dadbcb9e9394ff83a7adf0"
},
{
"sha256": "c68d8c70f8af6253a9021da0ecfd3997999a94df609d6e76e83f6c982d5149d6",
"size": 2457600,
"path": "KSwitcher.Config.exe"
"path": "KSwitcher.Config.exe",
"size": 2458112,
"sha256": "e491fafbd8405f2008180af0a16527d82d2ff1ea85788b1f0ba5cd6a03844e52"
},
{
"sha256": "f6b9c27d9d89a8bb971957f32909177b727d184023655938d0c49a4916ca1b92",
"path": "KSwitcher.Screenshot.exe",
"size": 3397632,
"path": "KSwitcher.Screenshot.exe"
"sha256": "d430baceee5527f7276de8178b11511e1de67db54e4dcdc3f5edf9543cd1afae"
},
{
"sha256": "f8cb57d07f1f9e92a1ef66fe72f65443253b37249ea6fa1e3e8220260e51c4a7",
"path": "KSwitcher.Files.exe",
"size": 4403712,
"path": "KSwitcher.Files.exe"
"sha256": "5eadfc1c0209928b0486dc3c7f60d943ab1c7d2b9ab93c59cb83186b81265bc5"
},
{
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
"path": "WebView2Loader.dll",
"size": 194912,
"path": "WebView2Loader.dll"
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
},
{
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
"path": "terminal/addon-fit-LICENSE.txt",
"size": 1103,
"path": "terminal/addon-fit-LICENSE.txt"
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
},
{
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
"path": "terminal/addon-fit.js",
"size": 1521,
"path": "terminal/addon-fit.js"
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
},
{
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
"path": "terminal/index.html",
"size": 527,
"path": "terminal/index.html"
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
},
{
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
"path": "terminal/markdown-it-LICENSE.txt",
"size": 1073,
"path": "terminal/markdown-it-LICENSE.txt"
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
},
{
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
"path": "terminal/markdown-it.js",
"size": 100786,
"path": "terminal/markdown-it.js"
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
},
{
"sha256": "b83ae50c2ada2aa6efcb02016ab54461fc9de5653111f976a51945ee0afd2094",
"path": "terminal/markdown.html",
"size": 3599,
"path": "terminal/markdown.html"
"sha256": "b83ae50c2ada2aa6efcb02016ab54461fc9de5653111f976a51945ee0afd2094"
},
{
"sha256": "9a48dc026dbd3970a88c34775836534d795b90765a381fce3f2a7be9640d44c8",
"path": "terminal/markdown.js",
"size": 17575,
"path": "terminal/markdown.js"
"sha256": "9a48dc026dbd3970a88c34775836534d795b90765a381fce3f2a7be9640d44c8"
},
{
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
"path": "terminal/mermaid-LICENSE.txt",
"size": 1089,
"path": "terminal/mermaid-LICENSE.txt"
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
},
{
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
"path": "terminal/mermaid.js",
"size": 5537838,
"path": "terminal/mermaid.js"
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
},
{
"sha256": "8268049507da54079422db2b4d90b41cd0a1e99b5946b675173ea3543de27f0b",
"path": "terminal/terminal.js",
"size": 5065,
"path": "terminal/terminal.js"
"sha256": "8268049507da54079422db2b4d90b41cd0a1e99b5946b675173ea3543de27f0b"
},
{
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
"path": "terminal/xterm-LICENSE.txt",
"size": 1261,
"path": "terminal/xterm-LICENSE.txt"
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
},
{
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
"path": "terminal/xterm.css",
"size": 7112,
"path": "terminal/xterm.css"
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
},
{
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
"path": "terminal/xterm.js",
"size": 488663,
"path": "terminal/xterm.js"
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
},
{
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
"path": "LICENSE",
"size": 4401,
"path": "LICENSE"
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
},
{
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
"path": "json-LICENSE.txt",
"size": 1096,
"path": "json-LICENSE.txt"
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831"
},
{
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
"path": "files-text-license.txt",
"size": 883,
"path": "files-text-license.txt"
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
},
{
"sha256": "2c1bfd97f7f1b69e702426476d7728e05208d64d962e63c08bad2c320b6dc429",
"size": 101412,
"path": "README.md"
"path": "README.md",
"size": 101324,
"sha256": "74e79e56a1ed04a6a617d626aedbf4c0a20e9dc83cd1c42d787244c1b48c5330"
},
{
"sha256": "a2521642266d88eb5a2e579b8c514eecb63b0586e09dac2bbeea964df92b2474",
"path": "LAN-PREVIEW.md",
"size": 12354,
"path": "LAN-PREVIEW.md"
"sha256": "a2521642266d88eb5a2e579b8c514eecb63b0586e09dac2bbeea964df92b2474"
},
{
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
"path": "dictionaries/en.txt",
"size": 732485,
"path": "dictionaries/en.txt"
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9"
},
{
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
"size": 20566,
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5"
},
{
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
"path": "dictionaries/README.md",
"size": 2265,
"path": "dictionaries/README.md"
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
},
{
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
"path": "dictionaries/ru.txt",
"size": 1109134,
"path": "dictionaries/ru.txt"
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849"
},
{
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
"path": "dictionaries/sources.json",
"size": 1280,
"path": "dictionaries/sources.json"
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
},
{
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
"path": "dictionaries/uk.txt",
"size": 940799,
"path": "dictionaries/uk.txt"
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
},
{
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
"path": "tools/README.txt",
"size": 993,
"path": "tools/README.txt"
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
},
{
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
"path": "tools/StayHere.exe",
"size": 134656,
"path": "tools/StayHere.exe"
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376"
},
{
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
"path": "tools/StayHere-README.md",
"size": 2796,
"path": "tools/StayHere-README.md"
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
}
],
"schema": 1
+3 -3
View File
@@ -10,8 +10,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
1 RT_MANIFEST "app.manifest"
201 RCDATA "update.ps1"
1 VERSIONINFO
FILEVERSION 0,7,0,0
PRODUCTVERSION 0,7,0,0
FILEVERSION 0,7,1,0
PRODUCTVERSION 0,7,1,0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
BEGIN
@@ -21,7 +21,7 @@ BEGIN
BEGIN
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
VALUE "ProductName", "KSwitcher"
VALUE "FileVersion", "0.7.0"
VALUE "FileVersion", "0.7.1"
END
END
BLOCK "VarFileInfo"
+16 -7
View File
@@ -1130,6 +1130,7 @@ constexpr UINT AppWindowPicked = WM_APP + 78;
constexpr int SettingsNavigation = 260, SettingsStatus = 261, SettingsViewport = 264;
constexpr int SettingsBrand = 265, SettingsHeading = 266, SettingsDescription = 267, SettingsGroup = 268;
constexpr int SettingsSearch = 269, GeneralPage = 0, ComputersPage = 7, ManageComputersPage = 10, CorrectionPage = 11;
constexpr int SyncPage = 6, OpenBaoPage = 17, SettingsSyncPanel = 271;
constexpr UINT CollapseSettingsGroupMessage = WM_APP + 188;
constexpr int SettingsSidebarWidth = 214, SettingsHeaderHeight = 82, SettingsFooterHeight = 76;
constexpr int SettingsSplitter = 270, SettingsSplitterWidth = 8;
@@ -1159,6 +1160,7 @@ constexpr struct SettingsSection
{"personal-dictionaries", L"Personal dictionaries", L"Separate words with commas or new lines. Internal hyphens are allowed.", CorrectionPage},
{"word-boundaries", L"Word boundaries", L"Choose which punctuation KSwitcher keeps before and after a corrected word.", CorrectionPage},
{"custom-replacements", L"Custom replacements", L"Define your own corrections, which take priority over dictionary suggestions.", CorrectionPage},
{"openbao", L"OpenBao", L"Connect to OpenBao and synchronize your saved settings.", SyncPage},
};
constexpr wchar_t SettingsWindowFile[] = L"configurator-window.json";
struct SettingsWindowState
@@ -1240,7 +1242,7 @@ struct SettingsView
};
std::array<Page, std::size(settingsSections)> pages;
int selectedPage = -1;
HWND viewport{}, navigation{}, search{}, heading{}, description{}, brand{}, lan{}, splitter{};
HWND viewport{}, navigation{}, search{}, heading{}, description{}, brand{}, lan{}, sync{}, splitter{};
int sidebarWidth = SettingsSidebarWidth;
std::optional<int> splitterDragOffset;
bool splitterHovered{};
@@ -1349,6 +1351,7 @@ void repaintSettingsMatches(const SettingsView &v)
{
InvalidateRect(v.viewport, nullptr, TRUE);
if (v.lan) InvalidateRect(v.lan, nullptr, TRUE);
if (v.sync) InvalidateRect(v.sync, nullptr, TRUE);
}
LRESULT CALLBACK settingsViewportProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
{
@@ -1523,7 +1526,7 @@ void setSettingsFonts(HWND w, SettingsView &v)
assign(v.brand, font(w, 18, FW_SEMIBOLD), v.brandFont);
HFONT group = font(w, 15, FW_SEMIBOLD);
HFONT field = font(w, 14, FW_SEMIBOLD);
for (HWND pane : {v.viewport, v.lan})
for (HWND pane : {v.viewport, v.lan, v.sync})
if (pane)
{
SetPropW(pane, L"Font", GetPropW(w, L"Font"));
@@ -1707,6 +1710,7 @@ int fitSettingsColumns(WindowLayout &layout, size_t first, size_t end, int width
return bottom + 20;
}
int fitLanSettings(HWND panel, int width);
int fitSyncSettings(HWND panel, int width);
void reflowSettingsPage(HWND pane, WindowLayout &layout, int width, int height)
{
const auto &v = *reinterpret_cast<SettingsView *>(GetWindowLongPtrW(GetParent(pane), GWLP_USERDATA));
@@ -1715,10 +1719,11 @@ void reflowSettingsPage(HWND pane, WindowLayout &layout, int width, int height)
auto fit = [&](int pixels)
{
const int available = std::max(1, pixels * 96 / static_cast<int>(dpi));
if (v.selectedPage == ManageComputersPage)
if (v.selectedPage == ManageComputersPage || v.selectedPage == OpenBaoPage)
{
const int panelWidth = std::max(1, available - 16);
const int panelHeight = fitLanSettings(v.lan, panelWidth);
const int panelHeight = v.selectedPage == ManageComputersPage ? fitLanSettings(v.lan, panelWidth) :
fitSyncSettings(v.sync, panelWidth);
layout.controls[page.first].second = {8, 7, 8 + panelWidth, 7 + panelHeight};
layout.height = panelHeight + 15;
return;
@@ -2392,6 +2397,7 @@ void resizeSettingsForDpi(HWND w, int previousDpi, int nextDpi)
layoutSettings(w, v);
arrangeWindow(v.viewport);
if (v.lan) arrangeWindow(v.lan);
if (v.sync) arrangeWindow(v.sync);
if (previousDpi != nextDpi) scaleMouseTableColumns(w, previousDpi, nextDpi);
}
void collectLayout(SettingsView *v)
@@ -3015,7 +3021,6 @@ LRESULT CALLBACK settingsProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
return 0;
}
if (id == 257) { showOcrOptions(w, v); return 0; }
if (id == 258) { showSyncOptions(w, *v->app); return 0; }
if (id == 263) { collectLayout(v); showAppLanguages(w, v); return 0; }
if (handleMouseBindings(w, *v, wp)) return 0;
if (id == 259) { collectLayout(v); showChatLanguages(w, v); return 0; }
@@ -3843,8 +3848,6 @@ void showSettings(App &app, bool visible)
createMousePage(w, *v);
page();
settingsGroupLabel(pane, L"OpenBao", 24, 68);
button(pane, L"S&ync settings...", 258, 24, 110, 210);
page();
label(pane, L"Use the same pairing code on both computers.", 24, 68, 660);
@@ -3915,6 +3918,12 @@ void showSettings(App &app, bool visible)
edit(pane, 416, 24, 132, 660, 248, multiline | ES_WANTRETURN);
page();
v->sync = createSyncSettings(pane, app);
layout->controls.push_back({v->sync, {8, 55, 8 + SyncSettingsWidth, 55 + SyncSettingsHeight}});
for (HWND child = GetWindow(v->sync, GW_CHILD); child; child = GetWindow(child, GW_HWNDNEXT))
indexSettingsControl(*v, OpenBaoPage, child);
page();
v->splitter = control(w, L"STATIC", L"Resize navigation pane", SS_NOTIFY | WS_TABSTOP,
SettingsSplitter, 0, 0, 0, 0);
SetWindowSubclass(v->splitter, settingsSplitterProc, 1, reinterpret_cast<DWORD_PTR>(v));
+93 -44
View File
@@ -1,5 +1,6 @@
#include "ui_sync_conflicts.inl"
struct SyncView { HWND parent; App *app; bool actionError{}; };
constexpr int SyncSave = 614;
struct SyncView { App *app; bool initialized{}, actionError{}; };
void updateSyncControls(HWND w, App &app)
{
bool enabled = checked(w, 601);
@@ -7,14 +8,14 @@ void updateSyncControls(HWND w, App &app)
for (int id : {602, 603, 604, 605, 606, 607, 610, 611, 613})
EnableWindow(GetDlgItem(w, id), enabled);
EnableWindow(GetDlgItem(w, 612), enabled && savedEnabled);
EnableWindow(GetDlgItem(w, IDOK), enabled || savedEnabled);
value(w, IDOK, enabled ? L"&Save / Sign in / Sync" : L"&Save");
EnableWindow(GetDlgItem(w, SyncSave), enabled || savedEnabled);
value(w, SyncSave, enabled ? L"Save and s&ync" : L"S&ave connection");
std::wstring status;
if (!enabled)
status = savedEnabled ? L"Click Save to disable synchronization." :
status = savedEnabled ? L"Click Save connection to disable synchronization." :
L"Synchronization is disabled. Enable it above to configure and sync.";
else if (!savedEnabled)
status = L"Configure the connection, then click Save / Sign in / Sync to enable synchronization.";
status = L"Configure the connection, then click Save and sync to enable synchronization.";
else
status = app.syncCommand();
auto *view = reinterpret_cast<SyncView *>(GetWindowLongPtrW(w, GWLP_USERDATA));
@@ -33,11 +34,30 @@ SyncConfig syncFields(HWND w)
}
LRESULT CALLBACK syncProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
{
if (msg == WM_DPICHANGED) { resizeForDpi(w, wp, lp); return 0; }
if (msg == WM_SIZE) arrangeWindow(w);
auto *v = reinterpret_cast<SyncView *>(GetWindowLongPtrW(w, GWLP_USERDATA));
if (!v) return DefWindowProcW(w, msg, wp, lp);
try
{
if (msg == WM_PAINT) { paintSettingsMatches(w); return 0; }
if (msg == WM_CTLCOLORSTATIC) return SendMessageW(GetParent(w), msg, wp, lp);
if (msg == WM_SHOWWINDOW)
{
if (!wp) KillTimer(w, 1);
else
{
if (!v->initialized)
{
const auto c = loadSyncConfig(v->app->data);
check(w, 601, c.enabled); check(w, 613, c.keepLocalLayouts);
value(w, 602, c.server); value(w, 603, c.username);
value(w, 605, c.mount); value(w, 606, c.path); value(w, 607, c.authMount);
v->initialized = true;
}
updateSyncControls(w, *v->app);
SetTimer(w, 1, 1000, nullptr);
}
}
if (msg == WM_TIMER)
{
updateSyncControls(w, *v->app);
@@ -52,10 +72,9 @@ LRESULT CALLBACK syncProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
updateSyncControls(w, *v->app);
return 0;
}
if ((id == IDOK || id == 610 || id == 611 || id == 612) &&
if ((id == SyncSave || id == 610 || id == 611 || id == 612) &&
!IsWindowEnabled(GetDlgItem(w, id))) return 0;
if (id == 612) { showSyncConflicts(w, *v->app); return 0; }
if (id == IDCANCEL) { DestroyWindow(w); return 0; }
if (id == 609)
{
v->actionError = false;
@@ -70,12 +89,12 @@ LRESULT CALLBACK syncProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
KillTimer(w, 1);
return 0;
}
if (id == IDOK || id == 610 || id == 611)
if (id == SyncSave || id == 610 || id == 611)
{
v->actionError = false;
if (!checked(w, 601))
{
if (id != IDOK) return 0;
if (id != SyncSave) return 0;
auto c = loadSyncConfig(v->app->data);
c.enabled = false;
saveSyncConfig(v->app->data, c);
@@ -83,7 +102,7 @@ LRESULT CALLBACK syncProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
updateSyncControls(w, *v->app);
return 0;
}
if (id != IDOK && MessageBoxW(w, id == 610 ?
if (id != SyncSave && MessageBoxW(GetAncestor(w, GA_ROOT), id == 610 ?
L"Replace this PC's shared settings with the remote profile? A local backup will be saved. The open Settings window will refresh automatically; its unsaved edits will be discarded." :
L"Replace the remote profile with this PC's saved settings? OpenBao retains older versions according to its retention policy. Unsaved edits are not included.",
L"Resolve synchronization", MB_YESNO | MB_ICONWARNING) != IDYES) return 0;
@@ -111,44 +130,74 @@ LRESULT CALLBACK syncProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
value(w, 608, wide(e.what()));
return 0;
}
if (msg == WM_CLOSE) { DestroyWindow(w); return 0; }
if (msg == WM_NCDESTROY)
{
KillTimer(w, 1);
EnableWindow(v->parent, TRUE); SetForegroundWindow(v->parent);
disposeFont(w); delete v; SetWindowLongPtrW(w, GWLP_USERDATA, 0);
delete windowLayoutState(w);
RemovePropW(w, L"WindowLayout");
RemovePropW(w, L"Font");
delete v;
SetWindowLongPtrW(w, GWLP_USERDATA, 0);
}
return DefWindowProcW(w, msg, wp, lp);
}
void showSyncOptions(HWND parent, App &app)
constexpr int SyncSettingsWidth = 660, SyncSettingsHeight = 550;
constexpr int SyncSettingsMargin = 16, SyncSettingsGap = 16, SyncFieldsTop = 78, SyncActionsTop = 294;
constexpr int SyncColumnWidth = (SyncSettingsWidth - 2 * SyncSettingsMargin - SyncSettingsGap) / 2;
constexpr int SyncRightColumn = SyncSettingsMargin + SyncColumnWidth + SyncSettingsGap;
HWND createSyncSettings(HWND pane, App &app)
{
auto c = loadSyncConfig(app.data);
HWND w = makeWindow(app, L"KSwitcher.Sync", L"Settings synchronization - OpenBao", syncProc, 660, 672);
SetWindowLongPtrW(w, GWLP_HWNDPARENT, (LONG_PTR)parent);
SetWindowLongPtrW(w, GWLP_USERDATA, (LONG_PTR)new SyncView{parent, &app});
checkbox(w, L"&Enable synchronization with your OpenBao (KV v2)", 601, 18, 18, 620);
check(w, 601, c.enabled);
label(w, L"Se&rver (HTTPS)", 18, 60, 160); edit(w, 602, 190, 56, 450); value(w, 602, c.server);
label(w, L"User&name", 18, 100, 160); edit(w, 603, 190, 96, 450); value(w, 603, c.username);
label(w, L"&Password", 18, 140, 160); edit(w, 604, 190, 136, 450, 25, ES_AUTOHSCROLL | ES_PASSWORD);
label(w, L"Leave password blank to use the saved Windows credential.", 190, 166, 450);
label(w, L"KV v2 &mount", 18, 210, 160); edit(w, 605, 190, 206, 450); value(w, 605, c.mount);
label(w, L"Profile pa&th", 18, 250, 160); edit(w, 606, 190, 246, 450); value(w, 606, c.path);
label(w, L"&Login mount", 18, 290, 160); edit(w, 607, 190, 286, 450); value(w, 607, c.authMount);
label(w, L"Sync uses saved settings. Download remote refreshes the open Settings window.", 18, 330, 622);
edit(w, 608, 18, 362, 622, 76, ES_MULTILINE | ES_READONLY | WS_VSCROLL | ES_AUTOVSCROLL);
value(w, 608, app.syncCommand());
checkbox(w, L"&Keep this PC's layouts and layout shortcuts (sync other settings)", 613, 18, 446, 622);
check(w, 613, c.keepLocalLayouts);
button(w, L"&Save / Sign in / Sync", IDOK, 18, 484, 200);
button(w, L"&Download remote", 610, 230, 484, 195);
button(w, L"&Upload local", 611, 437, 484, 203);
button(w, L"Resolve &individual conflicts...", 612, 18, 530, 300);
label(w, L"Background check: every 10 minutes", 330, 534, 310);
button(w, L"Disconnect / &forget password", 609, 18, 582, 290);
button(w, L"&Close", IDCANCEL, 540, 582, 100);
updateSyncControls(w, app);
EnableWindow(parent, FALSE);
SetTimer(w, 1, 1000, nullptr);
showRequestedWindow(w); SetForegroundWindow(w);
WNDCLASSW panel{};
panel.hInstance = app.instance;
panel.lpfnWndProc = syncProc;
panel.lpszClassName = L"KSwitcher.Sync";
panel.hCursor = LoadCursorW(nullptr, IDC_ARROW);
panel.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
RegisterClassW(&panel);
HWND w = CreateWindowExW(WS_EX_CONTROLPARENT, panel.lpszClassName, L"", WS_CHILD | WS_CLIPCHILDREN,
0, 0, scale(pane, SyncSettingsWidth), scale(pane, SyncSettingsHeight),
pane, reinterpret_cast<HMENU>(SettingsSyncPanel), app.instance, nullptr);
if (!w) throw std::runtime_error("Cannot create OpenBao settings.");
SetWindowLongPtrW(w, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(new SyncView{&app}));
SetPropW(w, L"Font", GetPropW(pane, L"Font"));
auto *layout = new WindowLayout{SyncSettingsWidth, SyncSettingsHeight, 0, 0, true, true};
SetPropW(w, L"WindowLayout", layout);
constexpr int left = SyncSettingsMargin, width = SyncSettingsWidth - 2 * left;
settingsGroupLabel(w, L"Connection", left, 14, width);
checkbox(w, L"&Enable synchronization with OpenBao", 601, left, 42, width);
auto field = [&](int id, const wchar_t *name, int x, int y, DWORD style = ES_AUTOHSCROLL)
{
label(w, name, x, y, SyncColumnWidth);
edit(w, id, x, y + 24, SyncColumnWidth, 25, style);
};
field(602, L"Se&rver (HTTPS)", left, SyncFieldsTop);
field(603, L"User&name", left, SyncFieldsTop + 59);
field(604, L"&Password", left, SyncFieldsTop + 118, ES_AUTOHSCROLL | ES_PASSWORD);
label(w, L"Leave blank to use the saved Windows credential.", left, 250, SyncColumnWidth);
field(605, L"KV v2 &mount", SyncRightColumn, SyncFieldsTop);
field(606, L"Profile pa&th", SyncRightColumn, SyncFieldsTop + 59);
field(607, L"&Login mount", SyncRightColumn, SyncFieldsTop + 118);
checkbox(w, L"&Keep this PC's layouts and layout shortcuts", 613, left, SyncActionsTop, width);
settingsGroupLabel(w, L"Synchronization", left, SyncActionsTop + 38, width);
label(w, L"Sync uses saved settings. Download remote refreshes the open Settings window.", left, 360, width);
button(w, L"Save and s&ync", SyncSave, left, 387, 196);
button(w, L"&Download remote", 610, 222, 387, 200);
button(w, L"&Upload local", 611, 432, 387, 212);
edit(w, 608, left, 423, width, 66, ES_MULTILINE | ES_READONLY | WS_VSCROLL | ES_AUTOVSCROLL);
button(w, L"Resolve &individual conflicts…", 612, left, 499, SyncColumnWidth);
button(w, L"Disconnect / &forget password", 609, SyncRightColumn, 499, SyncColumnWidth);
for (int id : {602, 603, 604, 605, 606, 607, 610, 611, 612, 613, SyncSave})
EnableWindow(GetDlgItem(w, id), FALSE);
captureSettingsGeometry(*layout, 0, w);
layout->arranging = false;
return w;
}
int fitSyncSettings(HWND panel, int width)
{
auto &layout = *windowLayoutState(panel);
layout.width = 1;
layout.height = fitSettingsColumns(layout, 0, layout.controls.size(), width,
{SyncSettingsMargin, SyncSettingsWidth - SyncSettingsMargin, SyncRightColumn,
SyncSettingsMargin + SyncColumnWidth, SyncActionsTop, 610, 0, SyncFieldsTop});
return layout.height;
}
+5 -3
View File
@@ -51,7 +51,8 @@ LRESULT CALLBACK syncConflictsProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
if (msg == WM_CLOSE) { DestroyWindow(w); return 0; }
if (msg == WM_NCDESTROY)
{
EnableWindow(v->parent, TRUE); SetForegroundWindow(v->parent);
const auto owner = GetAncestor(v->parent, GA_ROOT);
EnableWindow(owner, TRUE); SetForegroundWindow(owner);
disposeFont(w); delete v; SetWindowLongPtrW(w, GWLP_USERDATA, 0);
}
return DefWindowProcW(w, msg, wp, lp);
@@ -60,8 +61,9 @@ void showSyncConflicts(HWND parent, App &app)
{
auto conflicts = decodeSyncConflicts(app.syncConflictData());
if (conflicts.empty()) { value(parent, 608, L"No pending conflicts. Run Sync to check for changes."); return; }
const auto owner = GetAncestor(parent, GA_ROOT);
HWND w = makeWindow(app, L"KSwitcher.SyncConflicts", L"Resolve individual settings", syncConflictsProc, 800, 560);
SetWindowLongPtrW(w, GWLP_HWNDPARENT, (LONG_PTR)parent);
SetWindowLongPtrW(w, GWLP_HWNDPARENT, reinterpret_cast<LONG_PTR>(owner));
auto *v = new SyncConflictView{parent, &app, std::move(conflicts), {}};
SetWindowLongPtrW(w, GWLP_USERDATA, (LONG_PTR)v);
label(w, L"Choose a value for each conflicting setting. Other changes are already synchronized.", 18, 16, 760);
@@ -76,5 +78,5 @@ void showSyncConflicts(HWND parent, App &app)
button(w, L"&Apply choices", IDOK, 526, 488, 140);
button(w, L"&Cancel", IDCANCEL, 678, 488, 100);
SendDlgItemMessageW(w, 620, LB_SETCURSEL, 0, 0); showConflictValues(w, v);
EnableWindow(parent, FALSE); showRequestedWindow(w); SetForegroundWindow(w);
EnableWindow(owner, FALSE); showRequestedWindow(w); SetForegroundWindow(w);
}
+1 -1
View File
@@ -2,7 +2,7 @@
#include "platform.h"
namespace ks
{
inline constexpr wchar_t AppVersion[] = L"0.7.0";
inline constexpr wchar_t AppVersion[] = L"0.7.1";
inline constexpr UINT UpdateMessage = WM_APP + 7;
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
+8 -1
View File
@@ -554,7 +554,7 @@ int main(int argc,char **argv)
SendMessageW(GetDlgItem(correction, 414), BM_CLICK, 0, 0);
require(!saveEnabled(), "reverting an inline correction edit disables Save");
HWND navigation = settingsNavigation(parent);
constexpr int sections = 17;
constexpr int sections = 18;
require(navigation && TreeView_GetCount(navigation) == sections &&
TreeView_GetParent(navigation, settingsSection(navigation, 10)) == settingsSection(navigation, 7) &&
TreeView_GetParent(navigation, settingsSection(navigation, 11)) == settingsSection(navigation, 0),
@@ -777,6 +777,13 @@ int main(int argc,char **argv)
require(TreeView_GetCount(navigation) == sections &&
TreeView_GetSelection(navigation) == settingsSection(navigation, 10),
"clearing search restores the tree and its active page");
SetWindowTextW(search, L"OpenBao server");
const auto serverResult = TreeView_GetChild(navigation, TreeView_GetRoot(navigation));
require(serverResult && TreeView_SelectItem(navigation, serverResult), "search finds the OpenBao server field");
const auto sync = GetDlgItem(pane, 271);
require(IsWindowVisible(GetDlgItem(sync, 602)) && IsWindowEnabled(parent),
"search reveals the embedded OpenBao page");
SetWindowTextW(search, L"");
selectSettingsPage(parent, 1);
require(!saveEnabled(),"changing sections leaves Settings clean");
SendMessageW(parent, WM_COMMAND, 259, 0);
+31 -23
View File
@@ -868,13 +868,13 @@ int main(int argc, char **argv) {
auto events = GetDlgItem(pane, 733);
auto visible = [&](int id) { return (GetWindowLongPtrW(GetDlgItem(pane, id), GWL_STYLE) & WS_VISIBLE) != 0; };
auto selectPage = [&](int index) { selectSettingsPage(settings, index); };
require(TreeView_GetCount(navigation) == 17, "all Settings sections are listed");
require(TreeView_GetCount(navigation) == 18, "all Settings sections are listed");
selectPage(3);
require(visible(257) && !visible(301), "OCR options are in Clipboard");
selectPage(6);
require(visible(258) && !visible(262), "Sync has its own tab");
require(visible(271) && !visible(262), "Sync opens the embedded OpenBao page");
selectPage(7);
require(!visible(262) && !visible(258), "Computers parent hides the management controls");
require(!visible(262) && !visible(271), "Computers parent hides embedded controls");
selectPage(10);
require(visible(262), "Manage computers shows the embedded panel");
selectPage(8);
@@ -1146,7 +1146,7 @@ int main(int argc, char **argv) {
settingsCloseChoice = IDCANCEL;
ks::showSettings(app,false);
}
require(GetDlgItem(settingsViewport(app.settingsWindow), 258)!=nullptr,"sync available without local opt-in");
require(GetDlgItem(settingsViewport(app.settingsWindow), 271)!=nullptr,"OpenBao available without local opt-in");
// Mnemonics only target visible controls; show without taking foreground focus.
ShowWindow(app.settingsWindow,SW_SHOWNOACTIVATE);
auto previousActive=SetActiveWindow(app.settingsWindow);
@@ -1168,25 +1168,33 @@ int main(int argc, char **argv) {
DestroyWindow(app.settingsWindow);
ks::saveSyncConfig(app.data,ks::SyncConfig{});
ks::showSettings(app,false);
require(GetDlgItem(settingsViewport(app.settingsWindow), 258)!=nullptr,"sync button available after local opt-in");
SendMessageW(app.settingsWindow,WM_COMMAND,258,0);
auto syncWindow=FindWindowW(L"KSwitcher.Sync",nullptr);
require(syncWindow!=nullptr,"private sync dialog opens");
ShowWindow(syncWindow,SW_HIDE);
selectSettingsPage(app.settingsWindow, 6);
const auto tree = settingsNavigation(app.settingsWindow);
require(TreeView_GetSelection(tree) == settingsSection(tree, 17), "Sync opens its OpenBao child");
auto syncWindow = GetDlgItem(settingsViewport(app.settingsWindow), 271);
require(syncWindow && (GetWindowLongPtrW(syncWindow,GWL_STYLE)&WS_VISIBLE) &&
!FindWindowW(L"KSwitcher.Sync",nullptr), "OpenBao is embedded in the Settings window");
require((GetWindowLongPtrW(GetDlgItem(syncWindow,604),GWL_STYLE)&ES_PASSWORD)!=0,
"sync password is masked");
require(!IsWindowEnabled(app.settingsWindow),"sync dialog owns settings interaction");
for(int id:{602,603,604,605,606,607,610,611,612,613,IDOK})
require(IsWindowEnabled(app.settingsWindow),"OpenBao allows switching to other settings pages");
for(int id:{602,603,604,605,606,607,610,611,612,613,614})
require(!IsWindowEnabled(GetDlgItem(syncWindow,id)),"disabled synchronization disables dependent controls");
require(IsWindowEnabled(GetDlgItem(syncWindow,601)) && IsWindowEnabled(GetDlgItem(syncWindow,609)) &&
IsWindowEnabled(GetDlgItem(syncWindow,IDCANCEL)),"enable, forget password and close remain available");
require(IsWindowEnabled(GetDlgItem(syncWindow,601)) && IsWindowEnabled(GetDlgItem(syncWindow,609)),
"enable and forget password remain available");
SendMessageW(syncWindow,WM_COMMAND,612,0);
require(!FindWindowW(L"KSwitcher.SyncConflicts",nullptr),"disabled conflict action is ignored");
SendDlgItemMessageW(syncWindow,601,BM_SETCHECK,BST_CHECKED,0);
SendMessageW(syncWindow,WM_COMMAND,MAKEWPARAM(601,BN_CLICKED),0);
for(int id:{602,603,604,605,606,607,610,611,613,IDOK})
for(int id:{602,603,604,605,606,607,610,611,613,614})
require(IsWindowEnabled(GetDlgItem(syncWindow,id)),"enabling synchronization immediately enables connection controls");
require(!ks::loadSyncConfig(app.data).enabled,"checking enable alone does not connect or persist");
SetDlgItemTextW(syncWindow, 602, L"https://draft.example.test");
selectSettingsPage(app.settingsWindow, 0);
selectSettingsPage(app.settingsWindow, 17);
wchar_t draftServer[64]{};
GetDlgItemTextW(syncWindow, 602, draftServer, std::size(draftServer));
require(std::wstring_view(draftServer) == L"https://draft.example.test",
"switching sections preserves the OpenBao draft");
auto enabledSync=ks::loadSyncConfig(app.data);
enabledSync.enabled=true;
enabledSync.server=L"https://sync.example.test";
@@ -1212,10 +1220,10 @@ int main(int argc, char **argv) {
"conflict controls fit dialog");
}
SendMessageW(conflictsWindow,WM_COMMAND,623,0);
require(!IsWindowEnabled(syncWindow),"conflict dialog owns sync interaction");
require(!IsWindowEnabled(app.settingsWindow),"conflict dialog owns settings interaction");
SendMessageW(conflictsWindow,WM_COMMAND,IDCANCEL,0);
require(IsWindowEnabled(syncWindow),"closing conflict dialog restores sync window");
for(int id:{601,602,603,604,605,606,607,608,609,610,611,612,613,IDOK,IDCANCEL}) {
require(IsWindowEnabled(app.settingsWindow),"closing conflict dialog restores Settings");
for(int id:{601,602,603,604,605,606,607,608,609,610,611,612,613,614}) {
RECT control{},client{};
GetWindowRect(GetDlgItem(syncWindow,id),&control);
MapWindowPoints(nullptr,syncWindow,reinterpret_cast<POINT*>(&control),2);
@@ -1225,12 +1233,11 @@ int main(int argc, char **argv) {
}
SendDlgItemMessageW(syncWindow,601,BM_SETCHECK,BST_UNCHECKED,0);
SendMessageW(syncWindow,WM_COMMAND,MAKEWPARAM(601,BN_CLICKED),0);
require(IsWindowEnabled(GetDlgItem(syncWindow,IDOK)),"Save remains available to persist disabling sync");
SendMessageW(syncWindow,WM_COMMAND,IDOK,0);
require(IsWindowEnabled(GetDlgItem(syncWindow,614)),"Save remains available to persist disabling sync");
SendMessageW(syncWindow,WM_COMMAND,614,0);
require(!ks::loadSyncConfig(app.data).enabled,"saving disabled sync does not enable network access");
require(!IsWindowEnabled(GetDlgItem(syncWindow,IDOK)),"Save disables after disabled state is persisted");
SendMessageW(syncWindow,WM_COMMAND,IDCANCEL,0);
require(IsWindowEnabled(app.settingsWindow),"closing sync restores parent");
require(!IsWindowEnabled(GetDlgItem(syncWindow,614)),"Save disables after disabled state is persisted");
selectSettingsPage(app.settingsWindow, 0);
require(ks::InputRegressionAccess::staleSync(app,false),"in-flight sync cannot overwrite newer local edits");
require(ks::InputRegressionAccess::staleSync(app,true),"disconnect discards in-flight downloaded profile");
require(ks::InputRegressionAccess::idleUndo(app),"idle cleanup retains available/busy Undo and frees expired Undo");
@@ -1478,11 +1485,12 @@ int main(int argc, char **argv) {
if (widenSidebar)
for (int step = 0; step < 24; ++step)
SendMessageW(GetDlgItem(settings, 270), WM_KEYDOWN, VK_RIGHT, 0);
for (int page = 0; page < 17; ++page)
for (int page = 0; page < 18; ++page)
{
selectSettingsPage(settings, page);
controlsFit(pane);
if (page == 10) controlsFit(GetDlgItem(pane, 262));
if (page == 17) controlsFit(GetDlgItem(pane, 271));
}
}
selectSettingsPage(settings, 0);