Qt.openUrlExternally(link) in a notification?

I’m trying to generate notifications (generated in JS, work fine with DBUS methods directly), but I’d like the methods to be called like Qt.openUrlExternally(link) giving the option to the user instead of having the notification directly call the app which generated the notification.

As it is I’m creating:

notifcation = Qt.createQmlObject('import org.nemomobile.notifications 1.0; 
  Notification { category: "x-harbour.tooterb.activity"; appName: "Tooter β"; itemCount: 1; 

remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates",  "service": "de.poetaster.harbour.tooterb", "path": "/", "iface": "de.poetaster.harbour.tooterb", "method": "openUrl", "arguments": [ "'+item.key+'" ] }]; urgency: Notification.Normal;  }', Qt.application, 'InternalQmlObject');
       

And I’d prefer to NOT use the remoteActions directly. Is there a way to just push a link into a notification and have it used like Qt.openUrlExternally ?

I never used Actions really, but there is this dbus thing in Lipstick, can you call that?

busctl --user introspect com.jolla.lipstick / org.sailfishos.fileservice
NAME                       TYPE      SIGNATURE RESULT/VALUE FLAGS
.checkMimeSupported        method    s         b            -
.checkUrlSupported         method    s         b            -
.openUrl                   method    s         -            -
4 Likes

yes, I’ve said it before. Rock God.

      notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0;  Notification {  category: "x-harbour.tooterb.activity";  appName: "Tooter β"; itemCount: 1; 

remoteActions: [  { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates",  "service": "org.sailfishos.fileservice",  "path": "/",  "iface": "org.sailfishos.fileservice",  "method": "openUrl", "arguments": [ "'+item.key+'" ] }];  

urgency: Notification.Normal;  }', Qt.application, 'InternalQmlObject');

That remoteAction attribute does exactly what I want.

THANKS (up to two cases of beer yet?)

2 Likes

Aha! much easier to share between us!

1 Like