Plasmacore.Datasource notifications dataengine is not working qml kde

Viewed 128

I have the code below to access notifications and use the application name notificationAppName.text = String(data[i]["appName"])as property in a statement:

PlasmaCore.DataSource {
    id: notificationsSource
    engine: "notifications"
    interval: 10

    onSourceAdded: {
        connectSource(source);
    }

    onNewData: {
        notificationsModel.append({"appIcon" : notificationsSource.data[sourceName]["appIcon"],
                            "appName" : notificationsSource.data[sourceName]["appName"],
                            "summary" : notificationsSource.data[sourceName]["summary"],
                            "body" : notificationsSource.data[sourceName]["body"],
                            "expireTimeout" : notificationsSource.data[sourceName]["expireTimeout"],
                            "urgency": notificationsSource.data[sourceName]["urgency"]});
    }

    onDataChanged: {
        var i = connectedSources[connectedSources.length-1]
        lastNotificationText.text = String(data[i]["body"]).replace("\n", " ")
        notificationAppName.text = String(data[i]["appName"])
        
    }
}` 

The statement I use is text: notificationAppName.text != null ? "Updates" : ""

The problem is that I can not get notifications from notificationsSource datasource. What am I doing wrong?

0 Answers
Related