More fixes for Network, NotificationHistory etc
This commit is contained in:
parent
3e001f1282
commit
56ad08816e
6 changed files with 52 additions and 20 deletions
|
|
@ -13,6 +13,7 @@ NIconButton {
|
||||||
readonly property bool wifiEnabled: Settings.data.network.wifiEnabled
|
readonly property bool wifiEnabled: Settings.data.network.wifiEnabled
|
||||||
sizeMultiplier: 0.8
|
sizeMultiplier: 0.8
|
||||||
showBorder: false
|
showBorder: false
|
||||||
|
visible: wifiEnabled
|
||||||
icon: {
|
icon: {
|
||||||
let connected = false
|
let connected = false
|
||||||
let signalStrength = 0
|
let signalStrength = 0
|
||||||
|
|
@ -23,7 +24,7 @@ NIconButton {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return connected ? NetworkService.signalIcon(signalStrength) : "wifi_off"
|
return connected ? NetworkService.signalIcon(signalStrength) : "wifi"
|
||||||
}
|
}
|
||||||
tooltipText: "WiFi Networks"
|
tooltipText: "WiFi Networks"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ NLoader {
|
||||||
border.color: Colors.mOutlineVariant
|
border.color: Colors.mOutlineVariant
|
||||||
border.width: Math.max(1, Style.borderThin * scaling)
|
border.width: Math.max(1, Style.borderThin * scaling)
|
||||||
width: 340 * scaling
|
width: 340 * scaling
|
||||||
height: 320 * scaling
|
height: 500 * scaling
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: Style.marginTiny * scaling
|
anchors.topMargin: Style.marginTiny * scaling
|
||||||
|
|
@ -145,19 +145,7 @@ NLoader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
NToggle {
|
|
||||||
baseSize: Style.baseWidgetSize * 0.75
|
|
||||||
checked: Settings.data.network.wifiEnabled
|
|
||||||
onToggled: checked => {
|
|
||||||
Settings.data.network.wifiEnabled = checked
|
|
||||||
NetworkService.setWifiEnabled(checked)
|
|
||||||
|
|
||||||
// If enabling WiFi while menu is open, refresh after a delay
|
|
||||||
if (checked) {
|
|
||||||
wifiEnableRefreshTimer.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "refresh"
|
icon: "refresh"
|
||||||
|
|
@ -245,7 +233,7 @@ NLoader {
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: parent.width
|
width: parent ? parent.width : 0
|
||||||
height: modelData.ssid === passwordPromptSsid
|
height: modelData.ssid === passwordPromptSsid
|
||||||
&& showPasswordPrompt ? 108 * scaling : Style.baseWidgetSize * 1.5 * scaling
|
&& showPasswordPrompt ? 108 * scaling : Style.baseWidgetSize * 1.5 * scaling
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ NLoader {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: screenEdgeMouseArea
|
id: screenEdgeMouseArea
|
||||||
x: 0
|
x: 0
|
||||||
y: modelData.geometry.height - (fullHeight + 10 * scaling)
|
y: modelData && modelData.geometry ? modelData.geometry.height - (fullHeight + 10 * scaling) : 0
|
||||||
width: screen.width
|
width: screen.width
|
||||||
height: fullHeight + 10 * scaling
|
height: fullHeight + 10 * scaling
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,40 @@ NLoader {
|
||||||
|
|
||||||
NDivider {}
|
NDivider {}
|
||||||
|
|
||||||
|
// Empty state when no notifications
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
visible: NotificationService.historyModel.count === 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Style.marginMedium * scaling
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: "notifications_off"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pointSize: Style.fontSizeXXL * scaling
|
||||||
|
color: Colors.mOnSurfaceVariant
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: "No notifications"
|
||||||
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
color: Colors.mOnSurfaceVariant
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: "Notifications will appear here when you receive them"
|
||||||
|
font.pointSize: Style.fontSizeNormal * scaling
|
||||||
|
color: Colors.mOnSurfaceVariant
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: notificationList
|
id: notificationList
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -157,6 +191,7 @@ NLoader {
|
||||||
spacing: Style.marginMedium * scaling
|
spacing: Style.marginMedium * scaling
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
visible: NotificationService.historyModel.count > 0
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
width: notificationList ? (notificationList.width - 20) : 380 * scaling
|
width: notificationList ? (notificationList.width - 20) : 380 * scaling
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ ColumnLayout {
|
||||||
checked: Settings.data.network.wifiEnabled
|
checked: Settings.data.network.wifiEnabled
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
Settings.data.network.wifiEnabled = checked
|
Settings.data.network.wifiEnabled = checked
|
||||||
|
NetworkService.setWifiEnabled(checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,12 @@ Singleton {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
enableWifiProcess.running = true
|
enableWifiProcess.running = true
|
||||||
} else {
|
} else {
|
||||||
// Store the currently connected network before disabling
|
// Disconnect from current network and store it for reconnection
|
||||||
for (const ssid in networks) {
|
for (const ssid in networks) {
|
||||||
if (networks[ssid].connected) {
|
if (networks[ssid].connected) {
|
||||||
lastConnectedNetwork = ssid
|
lastConnectedNetwork = ssid
|
||||||
|
// Disconnect from the current network before disabling WiFi
|
||||||
|
disconnectNetwork(ssid)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -246,6 +248,11 @@ Singleton {
|
||||||
command: ["nmcli", "connection", "down", connectionName]
|
command: ["nmcli", "connection", "down", connectionName]
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
// Clear connection status when disconnecting
|
||||||
|
root.connectingSsid = ""
|
||||||
|
root.connectStatus = ""
|
||||||
|
root.connectStatusSsid = ""
|
||||||
|
root.connectError = ""
|
||||||
root.refreshNetworks()
|
root.refreshNetworks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -450,9 +457,9 @@ Singleton {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
root.connectingSsid = ""
|
root.connectingSsid = ""
|
||||||
root.connectStatus = "success"
|
root.connectStatus = "success"
|
||||||
root.connectStatusSsid = root.pendingConnect ? root.pendingConnect.ssid : profileName
|
root.connectStatusSsid = root.pendingConnect ? root.pendingConnect.ssid : upConnectionProcess.profileName
|
||||||
root.connectError = ""
|
root.connectError = ""
|
||||||
root.lastConnectedNetwork = profileName
|
root.lastConnectedNetwork = upConnectionProcess.profileName
|
||||||
root.pendingConnect = null
|
root.pendingConnect = null
|
||||||
root.refreshNetworks()
|
root.refreshNetworks()
|
||||||
}
|
}
|
||||||
|
|
@ -461,7 +468,7 @@ Singleton {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
root.connectingSsid = ""
|
root.connectingSsid = ""
|
||||||
root.connectStatus = "error"
|
root.connectStatus = "error"
|
||||||
root.connectStatusSsid = root.pendingConnect ? root.pendingConnect.ssid : profileName
|
root.connectStatusSsid = root.pendingConnect ? root.pendingConnect.ssid : upConnectionProcess.profileName
|
||||||
root.connectError = text
|
root.connectError = text
|
||||||
root.pendingConnect = null
|
root.pendingConnect = null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue