Ivan Čukić

Activities API for QML

I had an unfortunate intermission in kactivities development due to a hard drive failure.

Fortunately, I managed to salvage significant parts of my work, but without git history. Now, it is ready for prime-time.

You are now able to access the activity manager without the need for the ‘clumsy’ activities data-engine. Just import org.kde.activities and create an instance of the ActivityModel.

  import org.kde.activities 0.1 as Activities

  ListView {
      id: main

      model: modelMain

      Activities.ActivityModel {
          id: modelMain

But, this is not all. You are not limited only to retrieve the data, it is also possible to create, delete or alter them. The service control API is asynchronous. Therefore, all methods, apart from regular arguments, receive a continuation function that is called when the method is executed.

Something along these lines:

    function(result) {
      console.log("Activity switched")

    function(result) {
      console.log("Activity id is: " + result)

Well, that is all for now. I’m thinking of adding overloads without callbacks, but these methods are not really meant to be called by everybody, so I’m not sure how important a more pleasant API actually is. :)

Loading comments...