diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-08 15:45:00 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-08 15:45:00 +0300 |
commit | 2df702e597311fe08c222743936e02d37a69d4f4 (patch) | |
tree | 4195672fa649625418876ad63f5940a828623535 | |
parent | a5bdc9a1a5cf704a0d865f8f87dcc6f68b25532f (diff) |
fixes #4024 (Менеджер профилей не позволяет создать профиль с точкой в имени, но позволяет вставить точку из буфера обмена)
-rw-r--r-- | src/mir_app/src/profilemanager.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 975fededec..4e9b84490f 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -97,10 +97,12 @@ static BOOL EnumProfilesForList(const wchar_t *tszFullPath, wchar_t *profile, CC return TRUE;
}
+static wchar_t sttBlockedChars[] = L".?/\\#' ";
+
static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_CHAR) {
- if (wcschr(L".?/\\#' ", (wchar_t)wParam) != nullptr)
+ if (wcschr(sttBlockedChars, (wchar_t)wParam) != nullptr)
return 0;
}
@@ -239,7 +241,14 @@ public: void onChange_Profile(CCtrlEdit *)
{
- m_btnOk.Enable(GetWindowTextLength(m_profileName.GetHwnd()) > 0);
+ CMStringW wszProfile(ptrW(m_profileName.GetText()));
+ for (auto c: sttBlockedChars)
+ if (c && wszProfile.Find(c) != -1) {
+ wszProfile.Replace(c, '_');
+ m_profileName.SetText(wszProfile);
+ }
+
+ m_btnOk.Enable(!wszProfile.IsEmpty());
}
};
|