61 const QString &interface,
bool isDynamic,
bool isPeer)
70 Q_ASSERT_X(!interface.
isEmpty(),
"QDBusAbstractInterface",
"Interface name cannot be empty");
88 : connection(con), service(serv), path(p), interface(iface),
89 lastError(
checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() &&
92 isValid(!lastError.isValid())
127 const char *expectedSignature =
"";
128 if (mp.
type() != 0xff) {
130 if (expectedSignature == 0) {
131 qWarning(
"QDBusAbstractInterface: type %s must be registered with QtDBus before it can be " 132 "used to read property %s.%s",
157 DBUS_INTERFACE_PROPERTIES);
164 const char *foundType = 0;
168 || (expectedSignature[0] ==
'v' && expectedSignature[1] ==
'\0')) {
174 if (value.
userType() == qMetaTypeId<QDBusArgument>()) {
177 foundType =
"user type";
179 if (foundSignature == expectedSignature) {
191 "(expected type `%5' (%6))");
213 msg <<
interface <<
QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
216 if (reply.type() != QDBusMessage::ReplyMessage) {
242 _id = QObject::qt_metacall(_c, _id, _a);
248 int &
status = *
reinterpret_cast<int *
>(_a[2]);
252 status = d_func()->setProperty(mp, variant) ? 1 : 0;
254 d_func()->property(mp, variant);
255 status = variant.
isValid() ? 1 : 0;
352 return !d_func()->currentOwner.isEmpty();
360 return d_func()->connection;
368 return d_func()->service;
376 return d_func()->path;
384 return d_func()->interface;
393 return d_func()->lastError;
415 return d_func()->timeout;
441 if (!
d->isValid || !
d->canMakeCalls())
479 d->lastError = reply;
507 if (!
d->isValid || !
d->canMakeCalls())
513 return d->connection.asyncCall(msg,
d->timeout);
540 const char *returnMethod,
541 const char *errorMethod)
545 if (!
d->isValid || !
d->canMakeCalls())
556 return d->connection.callWithCallback(msg,
607 if (
qstrcmp(signal + 1,
"destroyed(QObject*)") == 0)
833 #include "moc_qdbusabstractinterface.cpp" The QVariant class acts like a union for the most common Qt data types.
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
bool setProperty(const QMetaProperty &mp, const QVariant &value)
void setTimeout(int timeout)
Sets the timeout in milliseconds for all future DBus calls to timeout.
#define QT_END_NAMESPACE
This macro expands to.
QString path() const
Returns the object path that this interface is associated with.
QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent)
void disconnectNotify(const char *signal)
Catch signal disconnections.
The QDBusArgument class is used to marshall and demarshall D-Bus arguments.
bool isValid() const
Returns true if this is a valid reference to a remote object.
CallMode
This enum describes the various ways of placing a function call.
QDBusAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent)
This is the constructor called from static classes derived from QDBusAbstractInterface (i...
void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
The QByteArray class provides an array of bytes.
QDBusPendingCall asyncCall(const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Calls the method method on this interface and passes the parameters to this function to the method...
QDBusConnection connection() const
Returns the connection this interface is assocated with.
QVariant internalPropGet(const char *propname) const
Get the value of the property propname.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
The QDBusError class represents an error received from the D-Bus bus or from remote applications foun...
The QDBusPendingCall class refers to one pending asynchronous call.
static bool match(const uchar *found, const char *target, uint len)
QString currentSignature() const
Returns the type signature of the D-Bus type this QDBusArgument object is currently pointing to...
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static LibLoadStatus status
QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode=QDBus::Block, int timeout=-1) const
Sends the message over this connection and blocks, waiting for a reply, for at most timeout milliseco...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QString interface() const
Returns the name of this interface.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
QDBusError lastError() const
Returns the error the last operation produced, or an invalid error if the last operation did not prod...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static void setParametersValidated(QDBusMessage &msg, bool enable)
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
QDBusAbstractInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection &con, bool dynamic)
The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding...
bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
void truncate(int pos)
Truncates the string at the given position index.
QDBusMessage internalConstCall(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args=QList< QVariant >()) const
void property(const QMetaProperty &mp, QVariant &where) const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void disconnectRelay(const QString &service, const QString &path, const QString &interface, QDBusAbstractInterface *receiver, const char *signal)
void prepend(const T &t)
Inserts value at the beginning of the list.
The QStringList class provides a list of strings.
QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
Places a call to the remote method specified by method on this interface, using args as arguments...
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Q_CORE_EXPORT void qWarning(const char *,...)
void connectRelay(const QString &service, const QString &path, const QString &interface, QDBusAbstractInterface *receiver, const char *signal)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int timeout() const
Returns the current value of the timeout in milliseconds.
static void split(QT_FT_Vector *b)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
void internalPropSet(const char *propname, const QVariant &value)
Set the value of the property propname to value.
const char * typeName() const
Returns the name of the type stored in the variant.
int qt_metacall(QMetaObject::Call, int, void **)
QDBusPendingCall asyncCallWithArgumentList(const QString &method, const QList< QVariant > &args)
Places a call to the remote method specified by method on this interface, using args as arguments...
void clear()
Convert this variant to type Invalid and free up any resources used.
#define Q_ASSERT_X(cond, where, what)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
int userType() const
Returns the storage type of the value stored in the variant.
QDBusConnection connection
static QDBusError checkIfValid(const QString &service, const QString &path, const QString &interface, bool isDynamic, bool isPeer)
The QDBusConnection class represents a connection to the D-Bus bus daemon.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
static QDBusMessage createMethodCall(const QString &destination, const QString &path, const QString &interface, const QString &method)
Constructs a new DBus message representing a method call.
QObject * parent() const
Returns a pointer to the parent object.
if(void) toggleToolbarShown
bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error)
T qvariant_cast(const QVariant &)
QString service() const
Returns the name of the service this interface is associated with.
QVariant property(const char *name) const
Returns the value of the object's name property.
The QDBusMessage class represents one message sent or received over the D-Bus bus.
void setArguments(const QList< QVariant > &arguments)
Sets the arguments that are going to be sent over D-Bus to arguments.
bool canMakeCalls() const
int qstrcmp(const QByteArray &str1, const char *str2)
static QDBusPendingCall fromError(const QDBusError &error)
Creates a QDBusPendingCall object based on the error condition error.
QThread * thread() const
Returns the thread in which the object lives.
bool isConnected() const
Returns true if this QDBusConnection object is connected.
bool callWithCallback(const QString &method, const QList< QVariant > &args, QObject *receiver, const char *member, const char *errorSlot)
Places a call to the remote method specified by method on this interface, using args as arguments...
bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
virtual ~QDBusAbstractInterface()
Releases this object's resources.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
#define qPrintable(string)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QString getNameOwner(const QString &service)
The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus type...
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
void connectNotify(const char *signal)
Catch signal connections.
QDBusMessage call(const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Calls the method method on this interface and passes the parameters to this function to the method...
QDBusConnectionPrivate * connectionPrivate() const