kcm: Show "Never" when Autolock is false

Summary

Show "Never" for automatic screen locking when Autolock=false, regardless of the Timeout value.

Problem

Autolock and Timeout are configured independently. It is therefore possible to have a configuration where Autolock=false while Timeout is unset or has a non-zero value, such as 5.

The KCM currently selects the displayed option based only on Timeout. As a result, with Autolock=false and Timeout=5, the user sees "5 minutes" even though automatic screen locking is disabled.

This creates two visible inconsistencies:

  1. kscreenlocker starts the timer only when both autolock() is enabled and timeout() > 0: ksldapp.cpp. Therefore, the screen does not lock after the five minutes displayed by the KCM.
  2. On the same KCM page, the availability of the password delay field depends on kcm.settings.autolock: extraEnabledConditions: kcm.settings.autolock. As a result, the KCM displays "5 minutes" while also disabling a field that should be available when automatic screen locking is enabled.

Regression

The KCM previously handled Autolock=false explicitly and returned the index of the "Never" option in that case: timeoutOptionsCurrentIndexForSavedValue() before the change.

This check disappeared on April 28, 2024 in commit ae72db155bdee50fa6a9a04ee925d1b5cb9c41bc, merged through MR !217, "kcm: Factor out ComboBoxWithCustomValue for later reuse". After the refactoring, configuredValue was based only on Timeout, and the previous branch for disabled Autolock was not carried over.

Merge request reports

Loading
Loading