Skip to content

kcm: Rework layout and data flow and UX of configuration window popup

ivan tkachenko requested to merge work/ratijas/configuration-dialog-rework into master

Let's use simple purpose-built composable components, and factor out logic and control flow into self-contained functions.

Improvements include:

  • use less context properties in favor of passing down required ones;
  • use Kirigami.PasswordField for hotspot password;
  • add detailed InlineMessage boxes for invalid hotspot name/password;
  • use SimpleKCM for main layout (which might require scrolling);
  • set fillWidth on all form items (which otherwise might overflow/clip);
  • use standard DialogButtonBox for footer buttons;
  • add shortcuts like Enter/Escape to accept/reject this dialog-like window;
  • add key navigation between controls;
  • content-aware max/default height for window.

Also I tried implementing "is at defaults" binding for the Reset button as follow, but it didn't quite work because configuration's properties are non-NOTIFYable, so there's that.

    const resetButton = standardButton(QQC2.DialogButtonBox.Reset);
    if (resetButton) {
        resetButton.enabled = Qt.binding(() => !root.isDefaults());
    }

    function isDefaults(): bool {
        if (unlockModem.checked !== PlasmaNM.Configuration.unlockModemOnDetection
            || manageVirtualConnections.checked !== PlasmaNM.Configuration.manageVirtualConnections) {
            return false;
        }
        if (handler.hotspotSupported
            && (hotspotName.text !== PlasmaNM.Configuration.hotspotName
                || hotspotPassword.text !== PlasmaNM.Configuration.hotspotPassword)) {
            return false;
        }
        return true;
    }

Merge request reports