kde
KDE 1y ago
Jump
How to get network status in QML?
  • fkfd fkfd 1y ago 100%

    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
    
    1
  • kde
    KDE 1y ago
    Jump
    How to get network status in QML?
  • fkfd fkfd 1y ago 100%

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

    1
  • 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](https://invent.kde.org/plasma/plasma-nm/-/blob/master/libs/declarative/networkstatus.h) 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](https://invent.kde.org/fakefred/kanvas/-/blob/master/contents/ui/main.qml#L150)

    8
    6
    Object oriented programming
  • fkfd fkfd 1y ago 100%

    ocaml: the socdem of programming languages

    2
  • biologyhumor
    Biology Humor fkfd 2y ago 100%
    Stop
    1
    0
    "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearBR
    utab: New Tab, but better
    https://git.sr.ht/~fkfd/utab

    I started this project a few weeks ago for my transition from Firefox to Falkon, and I've been using it ever since. It's a daemon running on a local port for all web browsers to access. It now provides two features: Top Sites, inspired by Firefox's new tab, and a search bar with customizable engines, inspired by DDG's bangs (but it's a slash instead of a bang, to save you a shift press). Check out the source code (0BSD): [utab](https://git.sr.ht/~fkfd/utab) utab is almost definitely *not* what you exactly wanted, given its intentionally limited config options and features, but given the power of free software anyone can build upon it themselves. Also, it is 100% JavaScript-free.

    1
    0
    "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearCR
    Creepy fkfd 4y ago 100%
    Zuckerberg is Watching You
    3
    0