![]() |
Accessing contacts from daemon (in Qt)
Hi
I'm trying to access the contacts from a daemon (using Qt), but whenever i try to create an instance of QContactManager the daemon exits. My rutines works in a test program, but not in the daemon. Any ideas what is wrong, and how to solve it ? Could it be because the daemon is running as root ? Thanks |
Re: Accessing contacts from daemon (in Qt)
Quote:
|
Re: Accessing contacts from daemon (in Qt)
I had an feeling it could be something like that, how do I make a daemon run with user permissions ?
Kim |
Re: Accessing contacts from daemon (in Qt)
Quote:
I just guessing though, never wrote a deamon. |
Re: Accessing contacts from daemon (in Qt)
It runs without any problems as user, but I need it to run automatically at startup.
Does anyone know how to start a daemon with user permissions from an event.d script ? Kim. |
Re: Accessing contacts from daemon (in Qt)
The problem isn't root or user permission but the
dbus session. To access users contacts you need the correct user dbus session. You may look at other programs like headphoned how to connect/setup sessionbus. nicolai |
Re: Accessing contacts from daemon (in Qt)
Hi nicolai
Thanks for your answer, and sorry for the long delay, I was busy elsewhere. I have had a long hard look at headphoned and other daemon projects, and as far as I can see all it requires to get the dbus session address is to execute /tmp/session_bus_address.user to export the dbus address before starting my daemon. Unfortunatly that didn't help. Any other ideas, I have an almost finished daemon, I just need this to make it usable ;) Kim |
Re: Accessing contacts from daemon (in Qt)
Any hints what happens when your daemon creates the QContactManager?
Some logging output in /var/log/syslog? Maybe your daemon starts too early. I don't know anything about the internals of QContactManager. But I think it doesn't only needs a sessionbus connection but the contacts backend (osso-addressbook and evolution) must be running and be available through dbus, as well. nicolai |
Re: Accessing contacts from daemon (in Qt)
No sorry, nothing in any log file.
I have placed some debug logging in the code and it is at this line the daemon exits : QContactManager *m_manager = new QContactManager(); If I start the daemon as user in xterminal everything works as planned. If I start the daemon as root in xterminal, the daemon starts, but the moment a call is registered, and the daemon try to find the phone number in contacts it exits (same result when the daemon is started at boot) ! I have tried to log the enviroment variables, and in both cases DBUS_SESSION_BUS_ADDRESS has the same value ! Kim. |
Re: Accessing contacts from daemon (in Qt)
Quote:
Nicolai |
All times are GMT. The time now is 00:59. |
vBulletin® Version 3.8.8