Ask / Submit
0

How to create a note programmatically?

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

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

Comments

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 +0200 )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 +0200 )edit

1 Answer

Sort by » oldest newest most voted
6

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

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
Login/Signup to Answer

Question tools

Follow
4 followers

Stats

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

Seen: 157 times

Last updated: Feb 10