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

DBusObject::DBusObject ( QListViewItem *  parent,
QDomElement const &  elem,
QDBusProxy proxy 
) throw ( QDBusSendError, QDBusXmlError )

Parameters:
parent Parent QListViewItem
elem QDomElement representing this object as returned by org.freedesktop.DBus.Introspectable.Introspect.
connection D-BUS connection to be used for purposes of introspection (if necessary)

Definition at line 49 of file dbusobject.cpp.

References DBusItem::discoverService(), DBusItem::ensureElementIsNamed(), DBusItem::m_error, and DBusItem::m_ok.

 : DBusItem( parent, "/", "Object" ),
   d( new DBusObject::Private() )
{
    d->proxy = proxy;
    d->p = this;

    QDomElement myElem = elem;

    ensureElementIsNamed( myElem, "node" );

    m_object = d->discoverPath( myElem );
    m_service = discoverService();

    // If no name is given, then this is the root object '/'
    if ( myElem.hasAttribute( "name" ) && myElem.attribute( "name" ) != "" ) {
        setText( 0, myElem.attribute( "name" ) );
    }

    /* The spec says this: if an object is described at all, then it is
     * described fully.  If it is not described at all, then it may
     * be necessary to Introspect that object.  Of course, we know the
     * "/" object is always fully introspected, because that's always the
     * first thing we introspect.
     */
    if ( m_object != "/" && !myElem.hasChildNodes() )
        myElem = d->introspect();

    // At this point we are guaranteed to be introspected down
    // to the next level.  Child objects may need further inspection, but they
    // will handle that in their own constructors.

    // It's possible we're an empty object.  If so, we're done.
    if ( !myElem.hasChildNodes() )
        return;

    // Now iterate through self, enumerating interfaces, properties, and
    // other objects.
    myElem = myElem.firstChild().toElement();

    try {
        do {
            if ( myElem.tagName() == "node" )
                new DBusObject( this, myElem, d->proxy );
            else if ( myElem.tagName() == "interface" )
                new DBusInterface( this, myElem );
            else
                kdWarning() << "Unhandled node in introspect data: "
                            << myElem.tagName() << endl;
            myElem = myElem.nextSibling().toElement();
        } while ( !myElem.isNull() );
    }
    catch ( std::runtime_error const & e ) {
        m_ok = false;
        m_error = e.what();
    }
}


Generated by  Doxygen 1.6.0   Back to index