diff options
Diffstat (limited to 'src/mir_app')
-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());
}
};
|