We have moved to a new Sailfish OS Forum. Please start new discussions there.

How to create a note programmatically?

asked 2019-02-10 16:54:40 +0300

jsommer gravatar image

Dees someone now, how to create a note programmatically in a QML based app? There are two use cases:

  1. Opening the notes app with a new note like the shortcut in the top menu
  2. Saving a note in the notes app database or file storage. I'm not sure, which storage approach the notes app uses.
edit retag flag offensive close delete


jolla-notes seem to have a normal sqlite database i the folder '/home/nemo/.local/share/jolla-notes/QML/OfflineStorage/D atabases' [nemo@Sailfish Databases]$

Rikujolla ( 2019-02-10 17:49:39 +0300 )edit

@Rikujolla Thanks. So I need to reverse engineer the database model and have to use an SQL statement? Is ther a Qt API wrapper for sent SQL statements?

jsommer ( 2019-02-10 18:55:28 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-02-10 19:00:00 +0300

jsommer gravatar image

For use case 1 I have found the following approach with DBus:

First I used the following import statement in my QML file:

import Nemo.DBus 2.0

Then I defined an item in the QML file:

DBusInterface {
    id: notes
    service: "com.jolla.notes"
    path: "/"
    iface: "com.jolla.notes"

Finally I called the following method:

notes.call("newNote", [])

It might be trivial for most community members. However some beginners might be interested

edit flag offensive delete publish link more


It might be interesting for some developers, that the DBus interface also allows to trigger the import of a note, that was created in your app:

python.saveNote(noteString) // Use python or C++ to save a temporary file
notes.call("importNoteFile", ['/path/to/temp.txt']) // Use DBus interface for import
jsommer ( 2019-03-03 22:46:30 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2019-02-10 16:54:40 +0300

Seen: 176 times

Last updated: Feb 10 '19