Add undo dialog after factory defaults reset from NVDA menu #19575
Closes #6648
Summary of the issue:
When users accidentally press the F key in the NVDA menu, configuration is reset to factory defaults with no way to recover. Users may not be able to reconfigure NVDA themselves, and restoring settings can be time-consuming.
Description of user facing changes:
When resetting configuration to factory defaults from the NVDA menu, a dialog is now shown after the reset with "OK" and "Undo" buttons:
OK (focused by default): Keeps the factory defaults
Undo: Restores the previous configuration
Escape: Triggers Undo (restores previous configuration)
This prevents accidental loss of settings. The triple-press keyboard shortcut (NVDA+ctrl+r) is not affected and does not show the dialog, as it is intended for recovery scenarios.
Description of developer facing changes:
Added source/gui/configManagement.py with FactoryResetUndoDialog (subclass of MessageDialog) and confirmRevertToDefaultConfiguration
Added _confirmRevertToDefaultConfiguration on MainFrame for the menu path, delegating to configManagement
onRevertToDefaultConfigurationCommand remains the keyboard shortcut path (no dialog)
Both menu and keyboard handlers are decorated with @blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
Description of development approach:
The factory reset (core.resetConfiguration(factoryDefaults=True)) only modifies configuration in memory — the on-disk config file is not changed. This means:
Undo simply calls core.resetConfiguration() to reload the saved config from disk
Keep defaults requires no immediate action; the in-memory defaults are saved to disk on normal NVDA shutdown
No file-based backup is needed. This approach was chosen based on community feedback in the issue discussion.