Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- import "pages"
- import net.khertan.python 1.0
- ApplicationWindow
- {
- initialPage: FirstPage { }
- cover: Qt.resolvedUrl("cover/CoverPage.qml")
- Python {
- id: pyNotes
- signal requireRefresh()
- function loadNote(path) {
- var message = call('ownnotes.loadNote', [path,]);
- return message;
- }
- function listNotes(text) {
- threadedCall('ownnotes.listNotes', [text,]);
- console.log('listNotes called');
- }
- function getCategories() {
- var categories = call('ownnotes.getCategories', []);
- return categories;
- }
- function setCategory(path, category) {
- call('ownnotes.setCategory', [path, category]);
- requireRefresh();
- }
- function remove(path) {
- call('ownnotes.rm', [path, ]);
- requireRefresh();
- }
- function duplicate(path) {
- call('ownnotes.duplicate', [path, ]);
- requireRefresh();
- }
- function get(section, option) {
- return call('ownnotes.getSetting', [section, option])
- }
- function set(section, option, value) {
- call('ownnotes.setSetting', [section, option, value])
- }
- function createNote() {
- var path = call('ownnotes.createNote', []);
- return path;
- }
- function publishToScriptogram(text) {
- call('ownnotes.publishToScriptogram', [text]);
- }
- function publishAsPostToKhtCMS(text) {
- call('ownnotes.publishAsPostToKhtCMS', [text]);
- }
- function publishAsPageToKhtCMS(text) {
- call('ownnotes.publishAsPageToKhtCMS', [text]);
- }
- onException: {
- console.log('Type:' + type);
- console.log('Message:' + message);
- onError(type + ' : ' + message);
- }
- /*onMessage: {
- notesModel.fill(message)
- }*/
- Component.onCompleted: {
- console.debug('pyNotes start oncompleted');
- addImportPath('/usr/share/ownNotesForSailfish/python');
- importModule('ownnotes');
- console.debug('pyNotes completed');
- }
- }
- function onError(errMsg) {
- //errorEditBanner.text = errMsg;
- //errorEditBanner.show();
- console.log(errMsg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement