How to create a calendar event programmatically?
Following the Sailfish documentation I try to use the nemo QML calendar plugin:
import org.nemomobile.calendar 1.0
In the source code of the calendar plguin I can find a usefull QML component:
Component {
name: "NemoCalendarApi"
prototype: "QObject"
exports: ["org.nemomobile.calendar/Calendar 1.0"]
isCreatable: false
isSingleton: true
...
Method {
name: "createModification"
type: "NemoCalendarEventModification*"
Parameter { name: "sourceEvent"; type: "NemoCalendarEvent"; isPointer: true }
}
Because the component is a singleton I tried this in the code to set the properties from the QML form to save the event afterwards:
var newEvent = Calendar.createModification
Unfortuantely I get the following error:
[W] unknown:0 - Unable to create calendar database directory: "/home/nemo/.local/share/system/privileged/Calendar/mkcal"
[C] unknown:0 - semaphore_p.cpp: 57 - Unable to get semaphore /home/nemo/.local/share/system/privileged/Calendar/mkcal/db: Invalid argument (22)
[C] unknown:0 - semaphore_p.cpp: 215 - Unable to create semaphore array!
[C] unknown:0 - semaphore_p.cpp: 57 - Unable to decrement semaphore /home/nemo/.local/share/system/privileged/Calendar/mkcal/db: Success (0)
[C] unknown:0 - sqlitestorage.cpp: 180 - cannot lock "/home/nemo/.local/share/system/privileged/Calendar/mkcal/db" error "Success"
Even if this would work, the next question would be, how to retrieve the calendar Ids to provide them as options for the event form.
I found a Nemo Mobile project for a calendar. It uses QtOrganiser. Unfortunately this module is currently part of Sailfish. I get an import error:
import QtOrganizer 5.0
...
property OrganizerModel organizer: OrganizerModel {
manager: "qtorganizer:mkcal"
...
}
Any ideas? Maybe there is any open source project as a template?
Another approach is to trigger the standard app for the EditEvent.qml page. Unfortunately, I couldn't find a DBus service for this purpose.