Advertisement
Guest User

Untitled

a guest
Aug 6th, 2013
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import "pages"
  4. import net.khertan.python 1.0
  5.  
  6. ApplicationWindow
  7. {
  8.     initialPage: FirstPage { }
  9.     cover: Qt.resolvedUrl("cover/CoverPage.qml")
  10.  
  11.     Python {
  12.         id: pyNotes
  13.         signal requireRefresh()
  14.  
  15.         function loadNote(path) {
  16.             var message = call('ownnotes.loadNote', [path,]);
  17.             return message;
  18.         }
  19.  
  20.         function listNotes(text) {
  21.             threadedCall('ownnotes.listNotes', [text,]);
  22.             console.log('listNotes called');
  23.         }
  24.  
  25.         function getCategories() {
  26.             var categories = call('ownnotes.getCategories', []);
  27.             return categories;
  28.         }
  29.  
  30.         function setCategory(path, category) {
  31.             call('ownnotes.setCategory', [path, category]);
  32.             requireRefresh();
  33.         }
  34.  
  35.         function remove(path) {
  36.             call('ownnotes.rm', [path, ]);
  37.             requireRefresh();
  38.         }
  39.  
  40.         function duplicate(path) {
  41.             call('ownnotes.duplicate', [path, ]);
  42.             requireRefresh();
  43.         }
  44.  
  45.         function get(section, option) {
  46.             return call('ownnotes.getSetting', [section, option])
  47.         }
  48.  
  49.         function set(section, option, value) {
  50.             call('ownnotes.setSetting', [section, option, value])
  51.         }
  52.  
  53.         function createNote() {
  54.             var path = call('ownnotes.createNote', []);
  55.             return path;
  56.         }
  57.  
  58.         function publishToScriptogram(text) {
  59.             call('ownnotes.publishToScriptogram', [text]);
  60.         }
  61.  
  62.         function publishAsPostToKhtCMS(text) {
  63.             call('ownnotes.publishAsPostToKhtCMS', [text]);
  64.         }
  65.  
  66.         function publishAsPageToKhtCMS(text) {
  67.             call('ownnotes.publishAsPageToKhtCMS', [text]);
  68.         }
  69.         onException: {
  70.             console.log('Type:' + type);
  71.             console.log('Message:' + message);
  72.             onError(type + ' : ' + message);
  73.         }
  74.  
  75.         /*onMessage: {
  76.                 notesModel.fill(message)
  77.             }*/
  78.  
  79.         Component.onCompleted: {
  80.             console.debug('pyNotes start oncompleted');
  81.             addImportPath('/usr/share/ownNotesForSailfish/python');
  82.             importModule('ownnotes');
  83.             console.debug('pyNotes completed');
  84.         }
  85.     }
  86.  
  87.     function onError(errMsg) {
  88.         //errorEditBanner.text = errMsg;
  89.         //errorEditBanner.show();
  90.         console.log(errMsg);
  91.     }
  92.  
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement