Logo Search packages:      
Sourcecode: kdbus version File versions  Download package

void DBusService::populate (  )  throw ( QDBusConnectError, QDBusXmlError, QDBusSendError )

Populate with all DBUS interfaces, objects etc. returned by org.freedesktop.DBus.Introspectable.Introspect .

Definition at line 76 of file dbusservice.cpp.

References DBusItem::ensureElementIsNamed(), QDBusMessage::InvalidMessage, DBusItem::m_error, DBusItem::m_ok, and QDBusMessage::type().

                                                          {

    d->proxy->setService( m_service );
    d->proxy->setPath( "/" );
    d->proxy->setInterface( "org.freedesktop.DBus.Introspectable" );

    QDBusMessage reply = d->proxy->sendWithReply(
      "Introspect",
      QValueList<QVariant>()
    );
    if ( reply.type() == QDBusMessage::InvalidMessage )
        throw QDBusSendError(
            QString("%1: %2")
            .arg( d->proxy->lastError().name() )
            .arg( d->proxy->lastError().message() )
        );

    QDomDocument doc;
    if ( !doc.setContent( reply[0].toString() ) )
        throw QDBusXmlError(
          i18n(
            "Do not translate 'Introspect'.",
            "XML parse error in reply to Introspect"
          )
        );

    QDomElement docElem = doc.documentElement();
    ensureElementIsNamed( docElem, "node" );

    try {
        do {
            new DBusObject( this, docElem, d->proxy );
            docElem = docElem.nextSibling().toElement();
        } while ( !docElem.isNull() );
    }
    catch ( std::runtime_error const & e ) {
        m_ok = false;
        m_error = e.what();
    }
}


Generated by  Doxygen 1.6.0   Back to index