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

DBusProperty::DBusProperty ( QListViewItem *  parent,
QDomElement const &  elem 
) throw ( QDBusXmlError )

Parameters:
parent parent QListViewItem
elem XML element representing this property

Definition at line 37 of file dbusproperty.cpp.

References DBusUtil::niceType().

  : DBusAnnotatable( parent, "(unknown)", "Property" ),
    d( new DBusProperty::Private() )
{
    ensureElementIsNamed( elem, "property" );
    ensureElementHasAttribute( elem, "name" );
    ensureElementHasAttribute( elem, "type" );
    ensureElementHasAttribute( elem, "access" );

    d->name = elem.attribute( "name" );
    d->type = elem.attribute( "type" );
    d->access = elem.attribute( "access" );
    m_interface = discoverInterface();
    m_object = discoverObject();
    m_service = discoverService();

    d->niceType = DBusUtil::niceType( d->type );

    QString niceAccess;
    if ( d->access == "read" )
        niceAccess = i18n("access modifier", "read only");
    else if ( d->access == "write" )
        niceAccess = i18n("access modifier", "write only");
    else if ( d->access == "readwrite" )
        niceAccess = i18n("access modifier", "read/write");
    else
        throw QDBusXmlError(
          i18n(
            "Property %1 has access modifier %2 "
            "instead of one of '%3', '%4', or '%5'"
          )
          .arg( m_name )
          .arg( m_access )
          .arg( "read" )
          .arg( "write" )
          .arg( "readwrite" )
        );

    setText( 0, d->niceType + " " + d->name + " [" + niceAccess + "]" );

    // Look for annotations
    if ( !elem.hasChildNodes() )
        return;

    QDomElement child = elem.firstChild().toElement();

    do {
        if ( child.tagName() == "annotation" )
            addAnnotation( child );
        else
            kdWarning() << "Unhandled node in introspect data: "
                        << child.tagName() << endl;
        child = child.nextSibling().toElement();
    } while ( !child.isNull() );
}


Generated by  Doxygen 1.6.0   Back to index