fkfd

joined 4 years ago
MODERATOR OF
[–] [email protected] 1 points 2 years ago

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
[–] [email protected] 1 points 2 years ago (1 children)

that would be ideal! but I can't seem to find a way to do it natively without some C++ library like this one?

 

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?

Link to my code

[–] [email protected] 1 points 2 years ago

ocaml: the socdem of programming languages

[–] [email protected] 4 points 2 years ago (1 children)

somebody should cross stitch this meme

[–] [email protected] 16 points 2 years ago

clears throat
Knockia

[–] [email protected] 3 points 2 years ago

every day you learn something you don't want to

 
 
 
 
[–] [email protected] 1 points 4 years ago

Funny how I just took my likely last biology exam in my entire life this afternoon, i.e. 8 hours ago. That's around the time when we discussed the /c/china rules. Anyways, I'm glad it's over, but I'm not letting go of all these meme-able biology gimmicks. It's finally time to pipe all my biology-related atrocities here.