Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

Bringing up the accounts UI using DBus

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


lists.maemo-developers at jamie-thompson

Jul 9, 2011, 4:30 PM

Post #1 of 3 (241 views)
Permalink
Bringing up the accounts UI using DBus

I'm trying to bring up the Accounts UI using DBus in a Qt application:
> const char * NOKIA_SERVICE_ACCOUNTS_UI("com.nokia.AccountsUI");
> const char * NOKIA_PATH_ACCOUNTS_UI("/com/nokia/AccountsUI");
> const char * NOKIA_IFACE_ACCOUNTS_UI("com.nokia.Accounts");
>
> QDBusInterface nokiaAccountsUI(NOKIA_SERVICE_ACCOUNTS_UI, NOKIA_PATH_ACCOUNTS_UI, NOKIA_IFACE_ACCOUNTS_UI);
> if (nokiaAccountsUI.isValid())
> {
> QDBusReply<void> showAccountsUIReply = nokiaAccountsUI.call("OpenAccountsList", (uint)winId());
>
> if(!showAccountsUIReply.isValid())
> qDebug() << showAccountsUIReply.error().message();
> }
> else
> qDebug() << nokiaAccountsUI.lastError().message();
...but it doesn't seem to work properly.

I'm basing this on the command:
> dbus-send --print-reply --dest=com.nokia.AccountsUI /com/nokia/AccountsUI com.nokia.Accounts.OpenAccountsList uint32:0
...which works perfectly every time.

The first time I create the QDBusInterface, it returns an invalid object
(isValid() == false), and the error message is an empty string.

In the meantime, DBus has activated the rtcom-accounts-ui service, and
dbus-monitor shows introspection going on (which is how I know the
argument is the parent window xid), suggesting that Qt is preparing the
proxy and caching it somewhere (can I not get Qt to wait for the service
to start without bodging this myself?).

The second call (when the rtcom-accounts-ui process is already running)
succeeds, and the UI is displayed. When the UI is closed, after about a
minute or so the rtcom-accounts-ui process terminates, as is reasonable.

However, if I then try to create an instance of the interface again, it
all falls apart, and I get informed:
> "Could not get owner of name 'com.nokia.AccountsUI': no such name"
...and DBus makes no attempt to start the service.

Once I restart my application, it works again. So I basically get one
try per instance...which is clearly not acceptable.

What on earth am I doing wrong here?

- Jamie
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


mardy at users

Jul 11, 2011, 11:28 PM

Post #2 of 3 (224 views)
Permalink
Re: Bringing up the accounts UI using DBus [In reply to]

On 07/10/2011 02:30 AM, Jamie Thompson wrote:
> I'm trying to bring up the Accounts UI using DBus in a Qt application:
>> const char * NOKIA_SERVICE_ACCOUNTS_UI("com.nokia.AccountsUI");
>> const char * NOKIA_PATH_ACCOUNTS_UI("/com/nokia/AccountsUI");
>> const char * NOKIA_IFACE_ACCOUNTS_UI("com.nokia.Accounts");
>>
>> QDBusInterface nokiaAccountsUI(NOKIA_SERVICE_ACCOUNTS_UI, NOKIA_PATH_ACCOUNTS_UI, NOKIA_IFACE_ACCOUNTS_UI);
[...]
> ...but it doesn't seem to work properly.

I'm not sure what the problem is, but maybe QDBusInterface isn't happy
with the result of the introspection.
Try not using QDbusInterface, and just send the method on QDBusConnection.

Ciao,
Alberto

--
http://blog.mardy.it <- geek in un lingua international!
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


lists.maemo-developers at jamie-thompson

Jul 12, 2011, 8:10 AM

Post #3 of 3 (221 views)
Permalink
Re: Bringing up the accounts UI using DBus [In reply to]

> I'm not sure what the problem is, but maybe QDBusInterface isn't
> happy with the result of the introspection. Try not using
> QDbusInterface, and just send the method on QDBusConnection.

Brilliant, works perfectly without any hacks:
> QDBusMessage msg(QDBusMessage::createMethodCall(NOKIA_SERVICE_ACCOUNTS_UI,
> NOKIA_PATH_ACCOUNTS_UI, NOKIA_IFACE_ACCOUNTS_UI, "OpenAccountsList"));
> msg << (uint)winId();
> QDBusConnection::sessionBus().call(msg);

Many thanks. I guess the issue does indeed lie within QDbusInterface then.

- Jamie
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.