From 0e215d69cb64c1f4f539c0af6909f8666eb02387 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 16 Oct 2025 15:53:38 -0400 Subject: [PATCH] nm: revise enterprise flow --- Modals/WifiPasswordModal.qml | 144 ++++------------------------- Services/NetworkManagerService.qml | 9 +- Services/NetworkService.qml | 8 +- assets/systemd/dms.service | 14 +++ 4 files changed, 37 insertions(+), 138 deletions(-) create mode 100644 assets/systemd/dms.service diff --git a/Modals/WifiPasswordModal.qml b/Modals/WifiPasswordModal.qml index 8e9e8f19..4516fe3e 100644 --- a/Modals/WifiPasswordModal.qml +++ b/Modals/WifiPasswordModal.qml @@ -12,19 +12,15 @@ DankModal { property string wifiUsernameInput: "" property bool requiresEnterprise: false - property string wifiRealmInput: "" - property bool wifiUseAtRealm: true property string wifiAnonymousIdentityInput: "" - property string wifiDomainSuffixMatchInput: "" + property string wifiDomainInput: "" function show(ssid) { wifiPasswordSSID = ssid wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid) requiresEnterprise = network?.enterprise || false @@ -43,15 +39,13 @@ DankModal { shouldBeVisible: false width: 420 - height: requiresEnterprise ? 520 : 230 + height: requiresEnterprise ? 430 : 230 onShouldBeVisibleChanged: () => { if (!shouldBeVisible) { wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" } } onOpened: { @@ -69,10 +63,8 @@ DankModal { close() wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" } Connections { @@ -101,10 +93,8 @@ DankModal { close() wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" event.accepted = true } @@ -144,6 +134,8 @@ DankModal { close() wifiPasswordInput = "" wifiUsernameInput = "" + wifiAnonymousIdentityInput = "" + wifiDomainInput = "" } } } @@ -221,18 +213,14 @@ DankModal { wifiPasswordSSID, passwordInput.text, username, - wifiRealmInput, - wifiUseAtRealm, wifiAnonymousIdentityInput, - wifiDomainSuffixMatchInput + wifiDomainInput ) close() wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" passwordInput.text = "" if (requiresEnterprise) usernameInput.text = "" } @@ -268,100 +256,6 @@ DankModal { } } - Rectangle { - visible: requiresEnterprise - width: parent.width - height: 50 - radius: Theme.cornerRadius - color: Theme.surfaceHover - border.color: realmInput.activeFocus ? Theme.primary : Theme.outlineStrong - border.width: realmInput.activeFocus ? 2 : 1 - - MouseArea { - anchors.fill: parent - onClicked: () => { - realmInput.forceActiveFocus() - } - } - - DankTextField { - id: realmInput - - anchors.fill: parent - font.pixelSize: Theme.fontSizeMedium - textColor: Theme.surfaceText - text: wifiRealmInput - placeholderText: I18n.tr("Realm / Domain (optional)") - backgroundColor: "transparent" - enabled: root.shouldBeVisible - onTextEdited: () => { - wifiRealmInput = text - } - } - } - - Row { - visible: requiresEnterprise - spacing: Theme.spacingM - width: parent.width - - Rectangle { - id: atRealmBtn - - height: 36 - width: (parent.width - Theme.spacingM) / 2 - radius: Theme.cornerRadius - color: wifiUseAtRealm ? Theme.primary : Theme.surfaceHover - border.color: wifiUseAtRealm ? Theme.primary : Theme.outlineStrong - border.width: 1 - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: () => { - wifiUseAtRealm = true - } - } - - StyledText { - anchors.centerIn: parent - text: "username@realm" - color: wifiUseAtRealm ? Theme.background : Theme.surfaceText - font.pixelSize: Theme.fontSizeMedium - font.weight: Font.Medium - } - } - - Rectangle { - id: domainSlashBtn - - height: 36 - width: (parent.width - Theme.spacingM) / 2 - radius: Theme.cornerRadius - color: !wifiUseAtRealm ? Theme.primary : Theme.surfaceHover - border.color: !wifiUseAtRealm ? Theme.primary : Theme.outlineStrong - border.width: 1 - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: () => { - wifiUseAtRealm = false - } - } - - StyledText { - anchors.centerIn: parent - text: "DOMAIN\\username" - color: !wifiUseAtRealm ? Theme.background : Theme.surfaceText - font.pixelSize: Theme.fontSizeMedium - font.weight: Font.Medium - } - } - } - Rectangle { visible: requiresEnterprise width: parent.width @@ -416,12 +310,12 @@ DankModal { anchors.fill: parent font.pixelSize: Theme.fontSizeMedium textColor: Theme.surfaceText - text: wifiDomainSuffixMatchInput - placeholderText: I18n.tr("Server Domain for certificate (optional)") + text: wifiDomainInput + placeholderText: I18n.tr("Domain (optional)") backgroundColor: "transparent" enabled: root.shouldBeVisible onTextEdited: () => { - wifiDomainSuffixMatchInput = text + wifiDomainInput = text } } } @@ -504,10 +398,8 @@ DankModal { close() wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" } } } @@ -543,18 +435,14 @@ DankModal { wifiPasswordSSID, passwordInput.text, username, - wifiRealmInput, - wifiUseAtRealm, wifiAnonymousIdentityInput, - wifiDomainSuffixMatchInput + wifiDomainInput ) close() wifiPasswordInput = "" wifiUsernameInput = "" - wifiRealmInput = "" - wifiUseAtRealm = true wifiAnonymousIdentityInput = "" - wifiDomainSuffixMatchInput = "" + wifiDomainInput = "" passwordInput.text = "" if (requiresEnterprise) usernameInput.text = "" } diff --git a/Services/NetworkManagerService.qml b/Services/NetworkManagerService.qml index 6c45d0ed..f7e4e941 100644 --- a/Services/NetworkManagerService.qml +++ b/Services/NetworkManagerService.qml @@ -244,10 +244,9 @@ Singleton { scanWifi() } - function connectToWifi(ssid, password = "", username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") { + function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") { if (!networkAvailable || isConnecting) return - isConnecting = true connectingSSID = ssid connectionError = "" connectionStatus = "connecting" @@ -255,8 +254,6 @@ Singleton { const params = { ssid: ssid } if (password) params.password = password if (username) params.username = username - if (realmOrDomain) params.realmOrDomain = realmOrDomain - if (username) params.useAtRealm = useAtRealm if (anonymousIdentity) params.anonymousIdentity = anonymousIdentity if (domainSuffixMatch) params.domainSuffixMatch = domainSuffixMatch @@ -387,8 +384,8 @@ Singleton { } } - function connectToWifiAndSetPreference(ssid, password, username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") { - connectToWifi(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch) + function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") { + connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch) setNetworkPreference("wifi") } diff --git a/Services/NetworkService.qml b/Services/NetworkService.qml index 8fc4f80b..799c295c 100644 --- a/Services/NetworkService.qml +++ b/Services/NetworkService.qml @@ -149,9 +149,9 @@ Singleton { } } - function connectToWifi(ssid, password = "", username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") { + function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") { if (activeService && activeService.connectToWifi) { - activeService.connectToWifi(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch) + activeService.connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch) } } @@ -191,9 +191,9 @@ Singleton { } } - function connectToWifiAndSetPreference(ssid, password, username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") { + function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") { if (activeService && activeService.connectToWifiAndSetPreference) { - activeService.connectToWifiAndSetPreference(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch) + activeService.connectToWifiAndSetPreference(ssid, password, username, anonymousIdentity, domainSuffixMatch) } } diff --git a/assets/systemd/dms.service b/assets/systemd/dms.service new file mode 100644 index 00000000..c14412ee --- /dev/null +++ b/assets/systemd/dms.service @@ -0,0 +1,14 @@ +[Unit] +Description=Dank Material Shell (DMS) +PartOf=graphical-session.target +After=graphical-session-pre.target +Wants=graphical-session-pre.target + +[Service] +Type=simple +ExecStart=/usr/bin/dms run +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=graphical-session.target \ No newline at end of file