maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   ical sync via dbus - howto? (https://talk.maemo.org/showthread.php?t=62705)

erniadeldesktop 2010-09-22 04:57

ical sync via dbus - howto?
 
I've almost complete a new app, but i need to use the calendar import feature of the default calendar. Generating an ics file and opening it via file manager works. How can I automate this operation? I've tried of course from cli, but "of course" osso-filemanager accepts no arguments.
So the question is: what are file bindings or whatever they're called, that we can launch skipping file-manager? ie: can we use the sharing file fun. from outside? etc.

erniadeldesktop 2010-09-30 05:23

Re: pipe thru osso-file-manager| file bindings | howto?
 
ok, sorry guys i didn't know i should have to use dbus & mime types. can someone be so kind and help me find the dbus-send command for opening a file in calendar?

AlMehdi 2010-09-30 05:58

Re: pipe thru osso-file-manager| file bindings | howto?
 
Quote:

Originally Posted by erniadeldesktop (Post 829824)
ok, sorry guys i didn't know i should have to use dbus & mime types. can someone be so kind and help me find the dbus-send command for opening a file in calendar?

You could use D-feet or dbus-monitor to find out the right strings.. i am not aware what the dbus for the calender is.

erniadeldesktop 2010-09-30 07:18

Re: pipe thru osso-file-manager| file bindings | howto?
 
just in case someone else looks for it this is how to use it in a python function. The bold part is the dbus call.
Code:

def on_actionSync_triggered(self):
        import os
        self.cal.parse_events()
        try:
            os.system('dbus-send --type=method_call --dest=com.nokia.calendar /com/nokia/calendar com.nokia.calendar.mime_open string:"file:///$1"')
        except: print "you should be using me on maemo5"


erniadeldesktop 2010-09-30 10:51

Re: [solved] pipe thru osso-file-manager| file bindings | howto?
 
ok, seemed nice but there's something wrong: the calendar application crashes with an "error encountered". But opening the file via file manager works. what I'm missing? should I register the application somehow?

erniadeldesktop 2010-09-30 11:15

Re: pipe thru osso-file-manager| file bindings | howto?
 
and this is the dbus monitor out, just in case ...
Code:

method call sender=:1.301 -> dest=com.nokia.calendar serial=17 path=/com/nokia/calendar; interface=com.nokia.calendar; member=mime_open
  string "file:///home/user/MyDocs/todoy.ics"

tnx

erniadeldesktop 2010-09-30 12:48

Re: ical sync via dbus - howto?
 
oh, and is working also via cepiperez filebox but only sometimes with his "openfile" script

erniadeldesktop 2010-09-30 16:42

Re: ical sync via dbus - howto?
 
I know that I'm quite boring, but I really need someone help with this.

this is the full dbus-monitor out, opening via filebox.
Code:

signal sender=org.freedesktop.DBus -> dest=:1.145 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
  string ":1.145"
method call sender=:1.145 -> dest=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='method_call'"
method call sender=:1.145 -> dest=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='method_return'"
method call sender=:1.145 -> dest=org.freedesktop.DBus serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='error'"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=29 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
  string ":1.146"
  string ""
  string ":1.146"
method call sender=:1.146 -> dest=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
method call sender=:1.146 -> dest=org.gtk.vfs.Daemon serial=2 path=/org/gtk/vfs/mounttracker; interface=org.gtk.vfs.MountTracker; member=listMountableInfo
method return sender=:1.9 -> dest=:1.146 reply_serial=2
  array [
      struct {
        string "sftp"
        string "sftp"
        array [
            string "ssh"
        ]
        int32 22
        boolean true
      }
      struct {
        string "http"
        string "http"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "trash"
        string "trash"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "obex"
        string "obex"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "computer"
        string "computer"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "network"
        string "network"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "dav"
        string "dav"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "localtest"
        string "localtest"
        array [
        ]
        int32 0
        boolean false
      }
      struct {
        string "ftp"
        string "ftp"
        array [
        ]
        int32 21
        boolean true
      }
      struct {
        string "burn"
        string "burn"
        array [
        ]
        int32 0
        boolean false
      }
  ]
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=30 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
  string ":1.147"
  string ""
  string ":1.147"
method call sender=:1.147 -> dest=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=31 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
  string "com.nokia.osso-filemanager"
  string ""
  string ":1.147"
method call sender=:1.147 -> dest=org.freedesktop.DBus serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RequestName
  string "com.nokia.osso-filemanager"
  uint32 1
method call sender=:1.147 -> dest=com.nokia.calendar serial=3 path=/com/nokia/calendar; interface=com.nokia.calendar; member=mime_open
  string "file:///home/user/.todoy/todoy.ics"
method call sender=:1.147 -> dest=com.nokia.HildonDesktop.AppMgr serial=4 path=/com/nokia/HildonDesktop/AppMgr; interface=com.nokia.HildonDesktop.AppMgr; member=LaunchApplication
  string ""
method return sender=:1.35 -> dest=:1.147 reply_serial=4
method return sender=:1.144 -> dest=:1.147 reply_serial=3
error sender=:1.144 -> dest=:1.147 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=3
  string "Method "mime_open" with signature "s" on interface "com.nokia.calendar" doesn't exist
"


nicolai 2010-09-30 19:59

Re: pipe thru osso-file-manager| file bindings | howto?
 
Quote:

Originally Posted by erniadeldesktop (Post 829866)
just in case someone else looks for it this is how to use it in a python function. The bold part is the dbus call.
Code:

def on_actionSync_triggered(self):
        import os
        self.cal.parse_events()
        try:
            os.system('dbus-send --type=method_call --dest=com.nokia.calendar /com/nokia/calendar com.nokia.calendar.mime_open string:"file:///$1"')
        except: print "you should be using me on maemo5"


Just a simple example:

Code:

import os         
import dbus                               
                                           
bus = dbus.SessionBus()                   
proxy=bus.get_object('com.nokia.calendar','/com/nokia/calendar')
iface=dbus.Interface(proxy,dbus_interface='com.nokia.calendar')
iface.mime_open('file:///home/user/MyDocs/GermanHolidays.ics')

And it works.
There must be something other wrong with your code.

I am not good in python, and don't know
how $1 will be replaced, but maybe it should be
outside of the single quote?


os.system('dbus-send --type=method_call --dest=com.nokia.calendar /com/nokia/calendar com.nokia.calendar.mime_open string:"file:///$1"')

regards
Nicolai

erniadeldesktop 2010-10-01 06:22

Re: ical sync via dbus - howto?
 
is working now.. thanks. Really! I owe you one...


All times are GMT. The time now is 04:50.

vBulletin® Version 3.8.8