Skip to content
Verified Commit 5d18b0c0 authored by ivan tkachenko's avatar ivan tkachenko 🗯
Browse files

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

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;
    }
parent f3835b3a
Pipeline #498509 passed with stage
in 1 minute and 24 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment