![User banner](https://lemmy.ml/pictrs/image/833bc75c-2a22-4966-a91b-4243fc309d38.jpeg)
It seems networkStatus
doesn't provide a connectivity
attribute and PlasmaNM.NetworkManager
doesn't have a Full
either:
console.log(Object.keys(networkStatus))
qml: [objectName,activeConnections,networkStatus,objectNameChanged,activeConnectionsChanged,networkStatusChanged]
networkStatus.connectivity !== PlasmaNM.NetworkManager.Full
.../contents/ui/main.qml:150: TypeError: Cannot read property 'Full' of undefined
I wrote an applet that makes an API call every 10 minutes, but I want it to show a message if the computer is offline. This means I need to get the network status within QML. I thought a DataEngine might be available, but there isn't.
I read the code for plasma-nm and found this solution hack:
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM PlasmaNM.NetworkStatus { id: networkStatus } PlasmaComponents3.Label { visible: networkStatus.networkStatus != "Connected" text: i18n("Network disconnected") }
But I think comparing strings is a terrible way because I don't know what will happen in other locales.
Is there a better way?
![fkfd](https://lemmy.ml/pictrs/image/hcppoz.png?format=webp&thumbnail=64)
This is Frederick Yin, he/they. UTC+8
I once banned a user for scat porn, so you can say… I've seen some shit