* Fix B-spline keyboard focus issue (#23859)
- Restore keyboard focus after command restart in changeConstructionMethode()
- Fixes M key mode switching and R toggle periodic functionality
- Uses direct MDI view focus restoration instead of private ensureFocus() method
Fixes issue where keyboard shortcuts stop working after first mode switch.
* Address Copilot feedback: Add null check for activeDocument()
- Use ternary operator for cleaner null safety
- Prevents potential crash if activeDocument() returns null
- More idiomatic C++ code style
* Improve variable scope per @chennes feedback
- Use if-with-initialization to scope doc and mdi variables
- Variables now only exist where needed instead of leaking into function scope
- More idiomatic C++ code style