I'm having a hard time finding any literature or examples on how to write notifications for plasmoids.
My plasmoid can so far display notifications and sound alarms when certain conditions are met but i don't know how to:
- add a 'Dismiss' button to the notification to stop playing a continuous alarm, or
 - get the alarm to stop sounding when the notification is closed.
 
This is my (abridged) code so far:
PlasmaCore.DataSource {
    id: notificationSource
    engine: "notifications"
}
SoundEffect {
    id: notificationSound
    source: plasmoid.file("data", "beep-alarm.wav")
    loops: SoundEffect.Infinite
}
function createNotification(text) {
    var service = notificationSource.serviceForSource("notification");
    var operation = service.operationDescription("createNotification");
    operation["appName"] = root.appName;
    operation["appIcon"] = plasmoid.configuration.icon;
    operation.summary = root.title;
    operation["body"] = '<b>' + text + '</b>';
    operation["expireTimeout"] = 0;
    operation["isPersistent"] = 'isPersistent';
    operation["urgency"] = 2;
    var tmp = service.startOperationCall(operation);
    if (plasmoid.configuration.alarmEnabled) {
        notificationSound.play();
    }
}
Plasmoid.compactRepresentation: Item {
...
    PlasmaComponents.Label {
        text: {
            if (Number(root.x) >= plasmoid.configuration.y) {
                root.createNotification(root.x);
            }
            root.x
        }
    }
...
}