Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QDBusConnectionInterface Class Reference

The QDBusConnectionInterface class provides access to the D-Bus bus daemon service. More...

 #include <QDBusConnectionInterface>

Inherits: QDBusAbstractInterface.

This class was introduced in Qt 4.2.

Public Types

enum RegisterServiceReply { ServiceNotRegistered, ServiceRegistered, ServiceQueued }
enum ServiceQueueOptions { DontQueueService, QueueService, ReplaceExistingService }
enum ServiceReplacementOptions { DontAllowReplacement, AllowReplacement }

Properties

  • 1 property inherited from QObject

Public Slots

QDBusReply<bool> isServiceRegistered ( const QString & serviceName ) const
QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService ( const QString & serviceName, ServiceQueueOptions qoption = DontQueueService, ServiceReplacementOptions roption = DontAllowReplacement )
QDBusReply<QStringList> registeredServiceNames () const
QDBusReply<QString> serviceOwner ( const QString & name ) const
QDBusReply<uint> servicePid ( const QString & serviceName ) const
QDBusReply<uint> serviceUid ( const QString & serviceName ) const
QDBusReply<void> startService ( const QString & name )
QDBusReply<bool> unregisterService ( const QString & serviceName )
  • 1 public slot inherited from QObject

Signals

void callWithCallbackFailed ( const QDBusError & error, const QDBusMessage & call )
void serviceOwnerChanged ( const QString & name, const QString & oldOwner, const QString & newOwner )
void serviceRegistered ( const QString & serviceName )
void serviceUnregistered ( const QString & serviceName )

Additional Inherited Members

Detailed Description

The QDBusConnectionInterface class provides access to the D-Bus bus daemon service.

The D-Bus bus server daemon provides one special interface org.freedesktop.DBus that allows clients to access certain properties of the bus, such as the current list of clients connected. The QDBusConnectionInterface class provides access to that interface.

The most common uses of this class are to register and unregister service names on the bus using the registerService() and unregisterService() functions, query about existing names using the isServiceRegistered(), registeredServiceNames() and serviceOwner() functions, and to receive notification that a client has registered or de-registered through the serviceRegistered(), serviceUnregistered() and serviceOwnerChanged() signals.

Member Type Documentation

enum QDBusConnectionInterface::RegisterServiceReply

The possible return values from registerService():

ConstantValueDescription
QDBusConnectionInterface::ServiceNotRegistered0The call failed and the service name was not registered.
QDBusConnectionInterface::ServiceRegistered1The caller is now the owner of the service name.
QDBusConnectionInterface::ServiceQueued2The caller specified the QueueService flag and the service was already registered, so we are in queue.

The serviceRegistered() signal will be emitted when the service is acquired by this application.

enum QDBusConnectionInterface::ServiceQueueOptions

Flags for determining how a service registration should behave, in case the service name is already registered.

ConstantValueDescription
QDBusConnectionInterface::DontQueueService0If an application requests a name that is already owned, no queueing will be performed. The registeredService() call will simply fail. This is the default.
QDBusConnectionInterface::QueueService1Attempts to register the requested service, but do not try to replace it if another application already has it registered. Instead, simply put this application in queue, until it is given up. The serviceRegistered() signal will be emitted when that happens.
QDBusConnectionInterface::ReplaceExistingService2If another application already has the service name registered, attempt to replace it.

See also ServiceReplacementOptions.

enum QDBusConnectionInterface::ServiceReplacementOptions

Flags for determining if the D-Bus server should allow another application to replace a name that this application has registered with the ReplaceExistingService option.

The possible values are:

ConstantValueDescription
QDBusConnectionInterface::DontAllowReplacement0Do not allow another application to replace us. The service must be explicitly unregistered with unregisterService() for another application to acquire it. This is the default.
QDBusConnectionInterface::AllowReplacement1Allow other applications to replace us with the ReplaceExistingService option to registerService() without intervention. If that happens, the serviceUnregistered() signal will be emitted.

See also ServiceQueueOptions.

Property Documentation

registeredServiceNames : const QDBusReply<QStringList>

This property holds the registered service names.

Lists all names currently registered on the bus.

Access functions:

QDBusReply<QStringList> registeredServiceNames () const

Member Function Documentation

void QDBusConnectionInterface::callWithCallbackFailed ( const QDBusError & error, const QDBusMessage & call ) [signal]

This signal is emitted when there is an error during a QDBusConnection::callWithCallback(). error specifies the error. call is the message that couldn't be delivered.

See also QDBusConnection::callWithCallback().

QDBusReply<bool> QDBusConnectionInterface::isServiceRegistered ( const QString & serviceName ) const [slot]

Returns true if the service name serviceName has is currently registered.

QDBusReply<QDBusConnectionInterface::RegisterServiceReply> QDBusConnectionInterface::registerService ( const QString & serviceName, ServiceQueueOptions qoption = DontQueueService, ServiceReplacementOptions roption = DontAllowReplacement ) [slot]

Requests to register the service name serviceName on the bus. The qoption flag specifies how the D-Bus server should behave if serviceName is already registered. The roption flag specifies if the server should allow another application to replace our registered name.

If the service registration succeeds, the serviceRegistered() signal will be emitted. If we are placed in queue, the signal will be emitted when we obtain the name. If roption is AllowReplacement, the serviceUnregistered() signal will be emitted if another application replaces this one.

See also unregisterService().

QDBusReply<QString> QDBusConnectionInterface::serviceOwner ( const QString & name ) const [slot]

Returns the unique connection name of the primary owner of the name name. If the requested name doesn't have an owner, returns a org.freedesktop.DBus.Error.NameHasNoOwner error.

void QDBusConnectionInterface::serviceOwnerChanged ( const QString & name, const QString & oldOwner, const QString & newOwner ) [signal]

This signal is emitted by the D-Bus server whenever a service ownership change happens in the bus, including apparition and disparition of names.

This signal means the application oldOwner lost ownership of bus name name to application newOwner. If oldOwner is an empty string, it means the name name has just been created; if newOwner is empty, the name name has no current owner and is no longer available.

Note: connecting to this signal will make the application listen for and receive every single service ownership change on the bus. Depending on how many services are running, this make the application be activated to receive more signals than it needs. To avoid this problem, use the QDBusServiceWatcher class, which can listen for specific changes.

QDBusReply<uint> QDBusConnectionInterface::servicePid ( const QString & serviceName ) const [slot]

Returns the Unix Process ID (PID) for the process currently holding the bus service serviceName.

void QDBusConnectionInterface::serviceRegistered ( const QString & serviceName ) [signal]

This signal is emitted by the D-Bus server when the bus service name (unique connection name or well-known service name) given by serviceName is acquired by this application.

Acquisition happens after this application has requested a name using registerService().

QDBusReply<uint> QDBusConnectionInterface::serviceUid ( const QString & serviceName ) const [slot]

Returns the Unix User ID (UID) for the process currently holding the bus service serviceName.

void QDBusConnectionInterface::serviceUnregistered ( const QString & serviceName ) [signal]

This signal is emitted by the D-Bus server when this application loses ownership of the bus service name given by serviceName.

QDBusReply<void> QDBusConnectionInterface::startService ( const QString & name ) [slot]

Requests that the bus start the service given by the name name.

QDBusReply<bool> QDBusConnectionInterface::unregisterService ( const QString & serviceName ) [slot]

Releases the claim on the bus service name serviceName, that had been previously registered with registerService(). If this application had ownership of the name, it will be released for other applications to claim. If it only had the name queued, it gives up its position in the queue.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 56
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 93
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 32
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 231
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web