Qt 4.8
qdbusabstractinterface.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDBus module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qdbusabstractinterface.h"
44 
45 #include <qthread.h>
46 
47 #include "qdbusargument.h"
48 #include "qdbuspendingcall.h"
49 #include "qdbusmessage_p.h"
50 #include "qdbusmetaobject_p.h"
51 #include "qdbusmetatype_p.h"
52 #include "qdbusutil_p.h"
53 
54 #include <qdebug.h>
55 
56 #ifndef QT_NO_DBUS
57 
59 
60 static QDBusError checkIfValid(const QString &service, const QString &path,
61  const QString &interface, bool isDynamic, bool isPeer)
62 {
63  // We should be throwing exceptions here... oh well
65 
66  // dynamic interfaces (QDBusInterface) can have empty interfaces, but not service and object paths
67  // non-dynamic is the opposite: service and object paths can be empty, but not the interface
68  if (!isDynamic) {
69  // use assertion here because this should never happen, at all
70  Q_ASSERT_X(!interface.isEmpty(), "QDBusAbstractInterface", "Interface name cannot be empty");
71  }
72  if (!QDBusUtil::checkBusName(service, (isDynamic && !isPeer) ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error))
73  return error;
74  if (!QDBusUtil::checkObjectPath(path, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error))
75  return error;
76  if (!QDBusUtil::checkInterfaceName(interface, QDBusUtil::EmptyAllowed, &error))
77  return error;
78 
79  // no error
80  return QDBusError();
81 }
82 
84  const QString &p,
85  const QString &iface,
86  const QDBusConnection& con,
87  bool isDynamic)
88  : connection(con), service(serv), path(p), interface(iface),
89  lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() &&
90  connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))),
91  timeout(-1),
92  isValid(!lastError.isValid())
93 {
94  if (!isValid)
95  return;
96 
97  if (!connection.isConnected()) {
99  QLatin1String("Not connected to D-Bus server"));
100  } else if (!service.isEmpty()) {
101  currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner
102  if (currentOwner.isEmpty()) {
104  }
105  }
106 }
107 
109 {
110  // recheck only if we have a wildcard (i.e. empty) service or path
111  // if any are empty, set the error message according to QDBusUtil
114  if (path.isEmpty())
116  return true;
117 }
118 
120 {
121  if (!isValid || !canMakeCalls()) { // can't make calls
122  where.clear();
123  return;
124  }
125 
126  // is this metatype registered?
127  const char *expectedSignature = "";
128  if (mp.type() != 0xff) {
129  expectedSignature = QDBusMetaType::typeToSignature(where.userType());
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",
133  mp.typeName(), qPrintable(interface), mp.name());
135  QString::fromLatin1("Unregistered type %1 cannot be handled")
136  .arg(QLatin1String(mp.typeName())));
137  where.clear();
138  return;
139  }
140  }
141 
142  // try to read this property
144  QLatin1String(DBUS_INTERFACE_PROPERTIES),
145  QLatin1String("Get"));
147  msg << interface << QString::fromUtf8(mp.name());
149 
150  if (reply.type() != QDBusMessage::ReplyMessage) {
151  lastError = reply;
152  where.clear();
153  return;
154  }
155  if (reply.signature() != QLatin1String("v")) {
156  QString errmsg = QLatin1String("Invalid signature `%1' in return from call to "
157  DBUS_INTERFACE_PROPERTIES);
158  lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature()));
159  where.clear();
160  return;
161  }
162 
163  QByteArray foundSignature;
164  const char *foundType = 0;
165  QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant();
166 
167  if (value.userType() == where.userType() || mp.type() == 0xff
168  || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) {
169  // simple match
170  where = value;
171  return;
172  }
173 
174  if (value.userType() == qMetaTypeId<QDBusArgument>()) {
176 
177  foundType = "user type";
178  foundSignature = arg.currentSignature().toLatin1();
179  if (foundSignature == expectedSignature) {
180  // signatures match, we can demarshall
181  QDBusMetaType::demarshall(arg, where.userType(), where.data());
182  return;
183  }
184  } else {
185  foundType = value.typeName();
186  foundSignature = QDBusMetaType::typeToSignature(value.userType());
187  }
188 
189  // there was an error...
190  QString errmsg = QLatin1String("Unexpected `%1' (%2) when retrieving property `%3.%4' "
191  "(expected type `%5' (%6))");
193  errmsg.arg(QString::fromLatin1(foundType),
194  QString::fromLatin1(foundSignature),
195  interface,
196  QString::fromUtf8(mp.name()),
197  QString::fromLatin1(mp.typeName()),
198  QString::fromLatin1(expectedSignature)));
199  where.clear();
200  return;
201 }
202 
204 {
205  if (!isValid || !canMakeCalls()) // can't make calls
206  return false;
207 
208  // send the value
210  QLatin1String(DBUS_INTERFACE_PROPERTIES),
211  QLatin1String("Set"));
213  msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
214  QDBusMessage reply = connection.call(msg, QDBus::Block, timeout);
215 
216  if (reply.type() != QDBusMessage::ReplyMessage) {
217  lastError = reply;
218  return false;
219  }
220  return true;
221 }
222 
224  const QString &oldOwner,
225  const QString &newOwner)
226 {
227  Q_UNUSED(oldOwner);
228  //qDebug() << "QDBusAbstractInterfacePrivate serviceOwnerChanged" << name << oldOwner << newOwner;
229  if (name == service) {
230  currentOwner = newOwner;
231  }
232 }
233 
235  : QObject(d, parent)
236 {
237 }
238 
240 {
241  int saved_id = _id;
242  _id = QObject::qt_metacall(_c, _id, _a);
243  if (_id < 0)
244  return _id;
245 
247  QMetaProperty mp = metaObject()->property(saved_id);
248  int &status = *reinterpret_cast<int *>(_a[2]);
249  QVariant &variant = *reinterpret_cast<QVariant *>(_a[1]);
250 
251  if (_c == QMetaObject::WriteProperty) {
252  status = d_func()->setProperty(mp, variant) ? 1 : 0;
253  } else {
254  d_func()->property(mp, variant);
255  status = variant.isValid() ? 1 : 0;
256  }
257  _id = -1;
258  }
259  return _id;
260 }
261 
291  : QDBusAbstractInterfaceBase(d, parent)
292 {
293  // keep track of the service owner
294  if (d.isValid &&
296  && !d.service.isEmpty()
297  && !d.service.startsWith(QLatin1Char(':')))
298  d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
299  QString(), // path
300  QLatin1String(DBUS_INTERFACE_DBUS), // interface
301  QLatin1String("NameOwnerChanged"),
302  QStringList() << d.service,
303  QString(), // signature
304  this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
305 }
306 
316  const char *interface, const QDBusConnection &con,
317  QObject *parent)
318  : QDBusAbstractInterfaceBase(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),
319  con, false), parent)
320 {
321  // keep track of the service owner
322  if (d_func()->isValid &&
323  d_func()->connection.isConnected()
324  && !service.isEmpty()
325  && !service.startsWith(QLatin1Char(':')))
326  d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
327  QString(), // path
328  QLatin1String(DBUS_INTERFACE_DBUS), // interface
329  QLatin1String("NameOwnerChanged"),
330  QStringList() << service,
331  QString(), //signature
332  this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
333 }
334 
339 {
340 }
341 
351 {
352  return !d_func()->currentOwner.isEmpty();
353 }
354 
359 {
360  return d_func()->connection;
361 }
362 
367 {
368  return d_func()->service;
369 }
370 
375 {
376  return d_func()->path;
377 }
378 
383 {
384  return d_func()->interface;
385 }
386 
392 {
393  return d_func()->lastError;
394 }
395 
403 {
404  d_func()->timeout = timeout;
405 }
406 
414 {
415  return d_func()->timeout;
416 }
417 
436  const QString& method,
437  const QList<QVariant>& args)
438 {
440 
441  if (!d->isValid || !d->canMakeCalls())
442  return QDBusMessage::createError(d->lastError);
443 
444  QString m = method;
445  // split out the signature from the method
446  int pos = method.indexOf(QLatin1Char('.'));
447  if (pos != -1)
448  m.truncate(pos);
449 
450  if (mode == QDBus::AutoDetect) {
451  // determine if this a sync or async call
452  mode = QDBus::Block;
453  const QMetaObject *mo = metaObject();
454  QByteArray match = m.toLatin1() + '(';
455 
456  for (int i = staticMetaObject.methodCount(); i < mo->methodCount(); ++i) {
457  QMetaMethod mm = mo->method(i);
458  if (QByteArray(mm.signature()).startsWith(match)) {
459  // found a method with the same name as what we're looking for
460  // hopefully, nobody is overloading asynchronous and synchronous methods with
461  // the same name
462 
463  QList<QByteArray> tags = QByteArray(mm.tag()).split(' ');
464  if (tags.contains("Q_NOREPLY"))
465  mode = QDBus::NoBlock;
466 
467  break;
468  }
469  }
470  }
471 
472 // qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path();
475  msg.setArguments(args);
476 
477  QDBusMessage reply = d->connection.call(msg, mode, d->timeout);
478  if (thread() == QThread::currentThread())
479  d->lastError = reply; // will clear if reply isn't an error
480 
481  // ensure that there is at least one element
482  if (reply.arguments().isEmpty())
483  reply << QVariant();
484 
485  return reply;
486 }
487 
503  const QList<QVariant>& args)
504 {
506 
507  if (!d->isValid || !d->canMakeCalls())
508  return QDBusPendingCall::fromError(d->lastError);
509 
512  msg.setArguments(args);
513  return d->connection.asyncCall(msg, d->timeout);
514 }
515 
538  const QList<QVariant> &args,
539  QObject *receiver,
540  const char *returnMethod,
541  const char *errorMethod)
542 {
544 
545  if (!d->isValid || !d->canMakeCalls())
546  return false;
547 
549  path(),
550  interface(),
551  method);
553  msg.setArguments(args);
554 
555  d->lastError = 0;
556  return d->connection.callWithCallback(msg,
557  receiver,
558  returnMethod,
559  errorMethod,
560  d->timeout);
561 }
562 
585  const QList<QVariant> &args,
586  QObject *receiver,
587  const char *slot)
588 {
589  return callWithCallback(method, args, receiver, slot, 0);
590 }
591 
600 {
601  // someone connecting to one of our signals
603  if (!d->isValid)
604  return;
605 
606  // we end up recursing here, so optimize away
607  if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0)
608  return;
609 
610  QDBusConnectionPrivate *conn = d->connectionPrivate();
611  if (conn) {
612  conn->connectRelay(d->service, d->path, d->interface,
613  this, signal);
614  }
615 }
616 
625 {
626  // someone disconnecting from one of our signals
628  if (!d->isValid)
629  return;
630 
631  QDBusConnectionPrivate *conn = d->connectionPrivate();
632  if (conn)
633  conn->disconnectRelay(d->service, d->path, d->interface,
634  this, signal);
635 }
636 
645 {
646  // assume this property exists and is readable
647  // we're only called from generated code anyways
648 
649  return property(propname);
650 }
651 
659 void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value)
660 {
661  setProperty(propname, value);
662 }
663 
686  const QVariant &arg2,
687  const QVariant &arg3,
688  const QVariant &arg4,
689  const QVariant &arg5,
690  const QVariant &arg6,
691  const QVariant &arg7,
692  const QVariant &arg8)
693 {
694  return call(QDBus::AutoDetect, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
695 }
696 
722  const QVariant &arg1,
723  const QVariant &arg2,
724  const QVariant &arg3,
725  const QVariant &arg4,
726  const QVariant &arg5,
727  const QVariant &arg6,
728  const QVariant &arg7,
729  const QVariant &arg8)
730 {
731  QList<QVariant> argList;
732  int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() +
733  arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid();
734 
735  switch (count) {
736  case 8:
737  argList.prepend(arg8);
738  case 7:
739  argList.prepend(arg7);
740  case 6:
741  argList.prepend(arg6);
742  case 5:
743  argList.prepend(arg5);
744  case 4:
745  argList.prepend(arg4);
746  case 3:
747  argList.prepend(arg3);
748  case 2:
749  argList.prepend(arg2);
750  case 1:
751  argList.prepend(arg1);
752  }
753 
754  return callWithArgumentList(mode, method, argList);
755 }
756 
757 
784  const QVariant &arg2,
785  const QVariant &arg3,
786  const QVariant &arg4,
787  const QVariant &arg5,
788  const QVariant &arg6,
789  const QVariant &arg7,
790  const QVariant &arg8)
791 {
792  QList<QVariant> argList;
793  int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() +
794  arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid();
795 
796  switch (count) {
797  case 8:
798  argList.prepend(arg8);
799  case 7:
800  argList.prepend(arg7);
801  case 6:
802  argList.prepend(arg6);
803  case 5:
804  argList.prepend(arg5);
805  case 4:
806  argList.prepend(arg4);
807  case 3:
808  argList.prepend(arg3);
809  case 2:
810  argList.prepend(arg2);
811  case 1:
812  argList.prepend(arg1);
813  }
814 
815  return asyncCallWithArgumentList(method, argList);
816 }
817 
822  const QString &method,
823  const QList<QVariant> &args) const
824 {
825  // ### move the code here, and make the other functions call this
826  return const_cast<QDBusAbstractInterface*>(this)->callWithArgumentList(mode, method, args);
827 }
828 
830 
831 #endif // QT_NO_DBUS
832 
833 #include "moc_qdbusabstractinterface.cpp"
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
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.
Definition: qglobal.h:90
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.
Definition: qdbusargument.h:69
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...
#define error(msg)
void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
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.
#define SLOT(a)
Definition: qobjectdefs.h:226
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&#39;s name property to value.
Definition: qobject.cpp:3755
The QDBusError class represents an error received from the D-Bus bus or from remote applications foun...
Definition: qdbuserror.h:60
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.
Definition: qobject.h:128
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
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.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_D(Class)
Definition: qglobal.h:2482
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.
Definition: qlist.h:152
static void setParametersValidated(QDBusMessage &msg, bool enable)
static const char * typeToSignature(int type)
Returns the D-Bus signature equivalent to the supplied meta type id type.
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
QDBusAbstractInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection &con, bool dynamic)
void * data()
Definition: qvariant.cpp:3077
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)
Definition: qdbusutil_p.h:111
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
static bool demarshall(const QDBusArgument &, int id, void *data)
Executes the demarshalling of type id (whose data will be placed in data) from the D-Bus marshalling ...
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
void truncate(int pos)
Truncates the string at the given position index.
Definition: qstring.cpp:4603
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...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void disconnectRelay(const QString &service, const QString &path, const QString &interface, QDBusAbstractInterface *receiver, const char *signal)
const char * name
void prepend(const T &t)
Inserts value at the beginning of the list.
Definition: qlist.h:541
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
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.
Definition: qstring.cpp:4302
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
Definition: qstring.cpp:2838
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.
Definition: qstring.cpp:3993
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.
Definition: qvariant.cpp:1984
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.
Definition: qvariant.cpp:1993
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
const char * name() const
Returns this property&#39;s name.
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...
Definition: qstring.cpp:4188
const char * tag() const
Returns the tag associated with this method.
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.
Definition: qobject.h:273
if(void) toggleToolbarShown
bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error)
Definition: qdbusutil_p.h:123
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
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&#39;s name property.
Definition: qobject.cpp:3807
QObject * parent
Definition: qobject.h:92
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59
void setArguments(const QList< QVariant > &arguments)
Sets the arguments that are going to be sent over D-Bus to arguments.
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336
static QDBusPendingCall fromError(const QDBusError &error)
Creates a QDBusPendingCall object based on the error condition error.
const char * signature() const
Returns the signature of this method (e.g., setValue(double)).
QThread * thread() const
Returns the thread in which the object lives.
Definition: qobject.cpp:1419
const char * variant
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)
Definition: qdbusutil_p.h:99
virtual ~QDBusAbstractInterface()
Releases this object&#39;s resources.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
#define qPrintable(string)
Definition: qglobal.h:1750
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int methodCount() const
Returns the number of methods known to the meta-object system in this class, including the number of ...
const char * typeName() const
Returns the name of this property&#39;s type.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QString getNameOwner(const QString &service)
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
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.
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.
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
QVariant::Type type() const
Returns this property&#39;s type.