forked from Shinonome/dots-hyprland
sidebar: wifi menu: public wifi login page button
This commit is contained in:
@@ -23,11 +23,11 @@ RippleButton {
|
|||||||
|
|
||||||
buttonRadius: 0
|
buttonRadius: 0
|
||||||
colBackground: ColorUtils.transparentize(Appearance.colors.colLayer3)
|
colBackground: ColorUtils.transparentize(Appearance.colors.colLayer3)
|
||||||
colBackgroundHover: wifiNetwork?.askingPassword ? colBackground : Appearance.colors.colLayer3Hover
|
colBackgroundHover: (wifiNetwork?.askingPassword || wifiNetwork?.active) ? colBackground : Appearance.colors.colLayer3Hover
|
||||||
colRipple: Appearance.colors.colLayer3Active
|
colRipple: Appearance.colors.colLayer3Active
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Network.connectToWifiNetwork(wifiNetwork)
|
Network.connectToWifiNetwork(wifiNetwork);
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
@@ -42,15 +42,12 @@ RippleButton {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
// Name
|
||||||
spacing: 10
|
spacing: 10
|
||||||
MaterialSymbol {
|
MaterialSymbol {
|
||||||
iconSize: Appearance.font.pixelSize.larger
|
iconSize: Appearance.font.pixelSize.larger
|
||||||
property int strength: root.wifiNetwork?.strength ?? 0
|
property int strength: root.wifiNetwork?.strength ?? 0
|
||||||
text: strength > 80 ? "signal_wifi_4_bar" :
|
text: strength > 80 ? "signal_wifi_4_bar" : strength > 60 ? "network_wifi_3_bar" : strength > 40 ? "network_wifi_2_bar" : strength > 20 ? "network_wifi_1_bar" : "signal_wifi_0_bar"
|
||||||
strength > 60 ? "network_wifi_3_bar" :
|
|
||||||
strength > 40 ? "network_wifi_2_bar" :
|
|
||||||
strength > 20 ? "network_wifi_1_bar" :
|
|
||||||
"signal_wifi_0_bar"
|
|
||||||
color: Appearance.colors.colOnSurfaceVariant
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -66,10 +63,10 @@ RippleButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout { // Password
|
||||||
id: passwordPrompt
|
id: passwordPrompt
|
||||||
visible: root.wifiNetwork?.askingPassword ?? false
|
visible: root.wifiNetwork?.askingPassword ?? false
|
||||||
Layout.topMargin: 12
|
Layout.topMargin: 8
|
||||||
|
|
||||||
MaterialTextField {
|
MaterialTextField {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
@@ -81,7 +78,7 @@ RippleButton {
|
|||||||
inputMethodHints: Qt.ImhSensitiveData
|
inputMethodHints: Qt.ImhSensitiveData
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
Network.changePassword(root.wifiNetwork, passwordField.text)
|
Network.changePassword(root.wifiNetwork, passwordField.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,18 +92,37 @@ RippleButton {
|
|||||||
DialogButton {
|
DialogButton {
|
||||||
buttonText: Translation.tr("Cancel")
|
buttonText: Translation.tr("Cancel")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.wifiNetwork.askingPassword = false
|
root.wifiNetwork.askingPassword = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogButton {
|
DialogButton {
|
||||||
buttonText: Translation.tr("Connect")
|
buttonText: Translation.tr("Connect")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Network.changePassword(root.wifiNetwork, passwordField.text)
|
Network.changePassword(root.wifiNetwork, passwordField.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout { // Public wifi login page
|
||||||
|
id: publicWifiPortal
|
||||||
|
visible: root.wifiNetwork?.active && (root.wifiNetwork?.security ?? "").trim().length === 0
|
||||||
|
Layout.topMargin: 8
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
DialogButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
buttonText: Translation.tr("Open network portal")
|
||||||
|
colBackground: Appearance.colors.colLayer4
|
||||||
|
colBackgroundHover: Appearance.colors.colLayer4Hover
|
||||||
|
colRipple: Appearance.colors.colLayer4Active
|
||||||
|
onClicked: {
|
||||||
|
Network.openPublicWifiPortal()
|
||||||
|
GlobalStates.sidebarRightOpen = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ Singleton {
|
|||||||
if (active) disconnectProc.exec(["nmcli", "connection", "down", active.ssid]);
|
if (active) disconnectProc.exec(["nmcli", "connection", "down", active.ssid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openPublicWifiPortal() {
|
||||||
|
Quickshell.execDetached(["xdg-open", "https://nmcheck.gnome.org/"]) // From some StackExchange thread, seems to work
|
||||||
|
}
|
||||||
|
|
||||||
function changePassword(network: WifiAccessPoint, password: string, username = ""): void {
|
function changePassword(network: WifiAccessPoint, password: string, username = ""): void {
|
||||||
// TODO: enterprise wifi with username
|
// TODO: enterprise wifi with username
|
||||||
network.askingPassword = false;
|
network.askingPassword = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user