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

void DBusTreeWidget::dbusSignal ( QDBusMessage const &  message  )  [private, slot]

Called when a DBus signal is emitted.

Definition at line 178 of file dbustreewidget.cpp.

References QDBusMessage::interface(), QDBusMessage::member(), QDBusMessage::path(), reload(), QDBusMessage::sender(), and statusMessage().

Referenced by initObjects().

                                                              {
    kdDebug() << "Received D-BUS message." << endl
              << "Service: " << message.sender() << endl
              << "Object: " << message.path() << endl
              << "Interface: " << message.interface() << endl
              << "Member: " << message.member() << endl;

    if ( !d->app->reloadOnServiceChange() )
        return;

    if ( message.member() != "NameOwnerChanged" )
        return;

    if ( message.count() != 3 ) {
        kdWarning() <<
          QString("Got NameOwnerChanged with %1 arguments, should have been 3")
          .arg( message.count() ) << endl;
        return;
    }

    QString name = message[0].toString();
    QString oldOwner = message[1].toString();
    QString newOwner = message[2].toString();

    if ( name.isEmpty() || ( oldOwner.isEmpty() && newOwner.isEmpty() ) ) {
        kdWarning() <<
          QString("Got NameOwnerChanged with too many empty arguments") << endl;
        return;
    }

    if ( oldOwner.isEmpty() )
        kdDebug() << QString("New service: %1").arg( name ) << endl;
    else if ( newOwner.isEmpty() )
        kdDebug() << QString("Lost service: %1").arg( name ) << endl;

    // For now, take the easy way out; just refresh everything.
    reload();

    if ( oldOwner.isEmpty() )
        statusMessage(
          i18n(
            "A new service became available: %1"
          ).arg( name )
        );
    else if ( newOwner.isEmpty() )
        statusMessage(
          i18n(
            "A service became unavailable: %1"
          ).arg( name )
        );
    else
        statusMessage(
          i18n(
            "A service changed owner: %1"
          ).arg( name )
        );
}


Generated by  Doxygen 1.6.0   Back to index