25 #include <tqapplication.h>
105 for (ConnectionHash::const_iterator it =
connectionHash.constBegin();
123 for (ConnectionHash::const_iterator it =
connectionHash.constBegin();
126 it.data()->bindToApplication();
203 DBusConnection *c = 0;
206 c = dbus_bus_get(DBUS_BUS_SYSTEM, &
d->
error);
209 c = dbus_bus_get(DBUS_BUS_SESSION, &
d->
error);
212 c = dbus_bus_get(DBUS_BUS_STARTER, &
d->
error);
223 const TQString &name)
248 DBusTimeout *timeout =
timeouts[e->timerId()];
249 dbus_timeout_handle(timeout);
261 bool isOk = dbus_connection_send(
d->
connection, msg, 0);
262 dbus_message_unref(msg);
267 const char *method)
const
284 DBusMessage *reply = dbus_connection_send_with_reply_and_block(
d->
connection, msg, -1, &
d->
error);
289 dbus_message_unref(msg);
293 dbus_message_unref(reply);
296 bool dbus_error_set = dbus_error_is_set(&
d->
error);
329 bool ok =
object->connect(
d, TQT_SIGNAL(dbusSignal(
const TQT_DBusMessage&)), slot);
339 bool ok =
d->disconnect(
object, slot);
349 TQT_DBusConnectionPrivate::ObjectMap::const_iterator it =
d->
registeredObjects.find(path);
383 TQString::fromUtf8(dbus_bus_get_unique_name(
d->
connection))
389 Q_ASSERT(modeFlags >= 0);
399 dbusFlags |= DBUS_NAME_FLAG_ALLOW_REPLACEMENT;
401 dbusFlags |= DBUS_NAME_FLAG_REPLACE_EXISTING;
409 #include "tqdbusconnection.moc"
Provides access to a specific D-Bus bus.
bool connect(TQObject *object, const char *slot)
Connects an object to receive D-Bus signals.
void flush() const
Flushes buffered outgoing message.
TQT_DBusMessage sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error=0) const
Sends a message over the bus and waits for the reply.
int sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver, const char *slot) const
Sends a message over the bus, specifying a receiver object for replies.
TQT_DBusConnectionPrivate * d
bool disconnect(TQObject *object, const char *slot)
Disconnects a given receiver from the D-Bus signal handling.
TQString uniqueName() const
Returns the connection identifier assigned at connect.
static TQT_DBusConnection addConnection(BusType type, const TQString &name=default_connection_name)
Add a connection to a bus with a specific bus type.
static TQT_DBusConnection sessionBus()
Gets a connection to the session bus.
TQT_DBusConnection & operator=(const TQT_DBusConnection &other)
Creates a shallow copy of the given connection.
bool send(const TQT_DBusMessage &message) const
Sends a message over the bus.
TQT_DBusConnection()
Creates an empty/disconnected connection handle.
TQT_DBusError lastError() const
Returns the last error seen by the connection.
static void closeConnection(const TQString &name=default_connection_name)
Closes a connection with a given name.
static TQT_DBusConnection systemBus()
Gets a connection to the system bus.
void dispatch() const
Processes buffered inbound messages.
void scheduleDispatch() const
Request a delayed check for inbound buffer processing.
bool registerObject(const TQString &path, TQT_DBusObjectBase *object)
Registers a service object for a given path.
~TQT_DBusConnection()
Destroys the connection handle.
QT_STATIC_CONST char * default_connection_name
bool isConnected() const
Returns whether the connection is connected to a bus.
bool requestName(const TQString &name, int modeFlags=NoReplace)
Requests to be addressable on the bus by a given name.
void unregisterObject(const TQString &path)
Unregister a service object on a given path.
static TQT_DBusConnectionManager * instance()
TQT_DBusConnectionPrivate * connection(const TQString &name) const
TQT_DBusConnectionPrivate * default_connection
ConnectionHash connectionHash
void setConnection(const TQString &name, TQT_DBusConnectionPrivate *c)
void removeConnection(const TQString &name)
~TQT_DBusConnectionManager()
static TQT_DBusConnectionManager * managerInstance
TQMap< TQString, TQT_DBusConnectionPrivate * > ConnectionHash
TQT_DBusConnectionManager()
void setConnection(DBusConnection *connection)
DBusConnection * connection
bool handleUnreadMessages()
void timerEvent(TQTimerEvent *e)
ObjectMap registeredObjects
int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver, const char *method)
Class for transporting D-Bus errors.
void setDBUSError(bool err) const
A message converts and transports data over D-Bus.
TQT_DBusMessagePrivate * d
DBusMessage * toDBusMessage() const
Creates a raw D-Bus message from this TQt3-bindings message.
static TQT_DBusMessage fromDBusMessage(DBusMessage *dmsg)
Creates a TQt3-bindings message from the given raw D-Bus message.
Base interface for D-Bus service objects.
void qDBusBindToApplication()
TQT_DBusConnectionManager * manager()