44 #include <QMetaMethod> 45 #include <QScriptExtensionPlugin> 55 int firstArgument = 0;
73 for (
int i = firstArgument; i < context->
argumentCount(); ++i) {
82 if (args.count() != 1)
87 && variant.
userType() == qMetaTypeId<QDBusObjectPath>()) {
107 if (!qobject_cast<QDBusConnectionInterface *>(iface)) {
113 int parenIndex = signature.
indexOf(
'(');
114 if (parenIndex == -1)
183 :
QObject(parent), connection(conn)
255 for (
int i = 0; i < args.
count(); ++i)
272 for (
quint32 i = 0; i < len; ++i) {
306 template <
typename T>
317 for (
int i = 0; i < lst.
count(); ++i)
322 template <
typename T>
389 engine->globalObject().setProperty(
QLatin1String(
"QDBus"), qdbus);
The QVariant class acts like a union for the most common Qt data types.
QScriptValue newFunction(FunctionSignature signature, int length=0)
Creates a QScriptValue that wraps a native (C++) function.
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
The QScriptContext class represents a Qt Script function invocation.
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
The QDBusConnectionInterface class provides access to the D-Bus bus daemon service.
The QScriptExtensionPlugin class provides an abstract base for custom QScript extension plugins...
QScriptValue property(const QString &name, const ResolveFlags &mode=ResolvePrototype) const
Returns the value of this QScriptValue's property with the given name, using the given mode to resolv...
QDBusMessage createError(const QString &name, const QString &msg)
QDBusConnectionInterface * interface() const
Returns a QDBusConnectionInterface object that represents the D-Bus server interface on this connecti...
QString path() const
Returns the object path that this interface is associated with.
bool isValid() const
Returns true if this is a valid error condition (i.e., if there was an error), otherwise false...
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QScriptValue qDBusReplyToScriptValue(QScriptEngine *eng, const QDBusReply< T > &reply)
static QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
Constructs a new DBus message with the given path, interface and name, representing a signal emission...
bool isValid() const
Returns true if this is a valid reference to a remote object.
QScriptValue callee() const
Returns the callee.
The QDBusReply class stores the reply for a method call to a remote object.
The QByteArray class provides an array of bytes.
QDBusConnection connection() const
Returns the connection this interface is assocated with.
QString service() const
Returns the name of the service or the bus address of the remote method call.
QScriptDBusInterfaceConstructor(QScriptEngine *engine, QScriptValue extensionObject)
QStringList keys() const
Returns the list of keys this plugin supports.
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
The QDBusError class represents an error received from the D-Bus bus or from remote applications foun...
QScriptValue globalObject() const
Returns this engine's Global Object.
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
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...
The QDBusInterface class is a proxy for interfaces on remote objects.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QDBusConnection systemBus()
Returns a QDBusConnection object opened with the system bus.
QScriptEngine * engine() const
Returns a pointer to the QScriptEngine associated with the current Qt function call, or 0 if the Qt function was not invoked from script code.
void qDBusReplyFromScriptValue(const QScriptValue &, QDBusReply< T > &)
int count(const T &t) const
Returns the number of occurrences of value in the list.
QScriptValue qscript_call(const QString &service, const QString &path, const QString &interface=QString(), const QScriptValue &conn=QScriptValue())
QObject * toQObject() const
If this QScriptValue is a QObject, returns the QObject pointer that the QScriptValue represents; othe...
void setDelayedReply(bool enable) const
Sets whether the message will be replied later (if enable is true) or if an automatic reply should be...
QString interface() const
Returns the name of this interface.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
QDBusMessage createMethodCall(const QString &destination, const QString &path, const QString &interface, const QString &method)
QObject * qscript_call(const QString &name)
ErrorType type() const
Returns this error's ErrorType.
QScriptValue sessionBus() const
QDBusMessage createErrorReply(const QString name, const QString &msg) const
Constructs a new DBus message representing an error reply message, with the given name and msg...
QString signature() const
Returns the signature of the signal that was received or for the output arguments of a method call...
static QString toString(Register *reg, int type, bool *ok=0)
void append(const T &t)
Inserts value at the end of the list.
The QScriptEngine class provides an environment for evaluating Qt Script code.
The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding...
Q_EXPORT_PLUGIN2(qjpcodecs, JPTextCodecs)
Q_EXPORT_STATIC_PLUGIN(JPTextCodecs)
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
static void disconnectFromBus(const QString &name)
Closes the bus connection of name name.
QString path() const
Returns the path of the object that this message is being sent to (in the case of a method call) or b...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QScriptValue createReply(QScriptContext *context, QScriptEngine *engine)
QDBusConnectionConstructor(QScriptEngine *engine, QScriptValue extensionObject)
const T & at(int i) const
Returns the item at index position i in the list.
bool isReplyRequired() const
Returns the flag that indicates if this message should see a reply or not.
QVariant toVariant() const
Returns the QVariant value of this QScriptValue, if it can be converted to a QVariant; otherwise retu...
The QStringList class provides a list of strings.
static QScriptValue createErrorReply(QScriptContext *context, QScriptEngine *engine)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QScriptValue newObject()
Creates a QtScript object of class Object.
QString path() const
Returns this object path.
QString name() const
Returns this error's name.
quint32 toUInt32() const
Returns the unsigned 32-bit integer value of this QScriptValue, using the conversion rules described ...
BusType
Specifies the type of the bus connection.
QByteArray left(int len) const
Returns a byte array that contains the leftmost len bytes of this byte array.
QString member() const
Returns the name of the signal that was emitted or the name of the method that was called...
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
bool toBoolean() const
Use toBool() instead.
bool isDelayedReply() const
Returns the delayed reply flag, as set by setDelayedReply().
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
int argumentCount() const
Returns the number of arguments passed to the function in this invocation.
QScriptValue newQObject(QObject *object, ValueOwnership ownership=QtOwnership, const QObjectWrapOptions &options=0)
Creates a QtScript object that wraps the given QObject object, using the given ownership.
QDBusMessage createReply(const QList< QVariant > &arguments=QList< QVariant >()) const
Constructs a new DBus message representing a reply, with the given arguments.
QString interface() const
Returns the interface of the method being called (in the case of a method call) or of the signal bein...
#define Q_ASSERT_X(cond, where, what)
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue's property with the given name to the given value.
int userType() const
Returns the storage type of the value stored in the variant.
QScriptValue dbusInterface() const
void setPrototype(const QScriptValue &prototype)
If this QScriptValue is an object, sets the internal prototype (__proto__ property) of this object to...
QScriptContext * context() const
Returns a pointer to the QScriptContext associated with the current Qt function call, or 0 if the Qt function was not invoked from script code.
static QScriptValue messageToScriptValue(QScriptEngine *engine, const QDBusMessage &message)
The QDBusConnection class represents a connection to the D-Bus bus daemon.
QScriptDBusMessageConstructor(QScriptEngine *engine, QScriptValue extensionObject)
static QDBusMessage createMethodCall(const QString &destination, const QString &path, const QString &interface, const QString &method)
Constructs a new DBus message representing a method call.
Type type() const
Returns the storage type of the value stored in the variant.
void initialize(const QString &key, QScriptEngine *engine)
Initializes the extension specified by key in the given engine.
QObject * parent() const
Returns a pointer to the parent object.
QScriptValue systemBus() const
QDBusConnection dbusConnection() const
The QDBusObjectPath class enables the programmer to identify the OBJECT_PATH type provided by the D-B...
static QDBusConnection connectToBus(BusType type, const QString &name)
Opens a connection of type type to one of the known busses and associate with it the connection name ...
QDBusConnection connectToBus(const QString &address, const QString &name)
T qvariant_cast(const QVariant &)
QString service() const
Returns the name of the service this interface is associated with.
static QDBusConnection sessionBus()
Returns a QDBusConnection object opened with the session bus.
QScriptValue qDBusErrorToScriptValue(QScriptEngine *engine, const QDBusError &error)
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
The QDBusMessage class represents one message sent or received over the D-Bus bus.
MessageType type() const
Returns the message type.
void disconnectFromBus(const QString &name)
void setArguments(const QList< QVariant > &arguments)
Sets the arguments that are going to be sent over D-Bus to arguments.
QScriptValue newQMetaObject(const QMetaObject *metaObject, const QScriptValue &ctor=QScriptValue())
Creates a QtScript object that represents a QObject class, using the the given metaObject and constru...
static QScriptValue setupDBusInterface(QScriptEngine *engine, QDBusAbstractInterface *iface)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
static void scriptValueToMessage(const QScriptValue &value, QDBusMessage &message)
QDBusConnection connection
QScriptValue newArray(uint length=0)
Creates a QtScript object of class Array with the given length.
QScriptValue thisObject() const
Returns the `this' object associated with this QScriptContext.
static QScriptValue do_dbus_call(QScriptContext *context, QScriptEngine *engine)
void setDefaultPrototype(int metaTypeId, const QScriptValue &prototype)
Sets the default prototype of the C++ type identified by the given metaTypeId to prototype.
#define qPrintable(string)
The QScriptValue class acts as a container for the Qt Script data types.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QScriptValue argument(int index) const
Returns the function argument at the given index.
Type value() const
Returns the remote function's calls return value.
QScriptDBusConnection(const QDBusConnection &conn, QObject *parent)
QScriptValue newVariant(const QVariant &value)
Creates a QtScript object holding the given variant value.
QScriptValue nullValue()
Returns a QScriptValue of the primitive type Null.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
void scriptValueToQDBusError(const QScriptValue &value, QDBusError &error)
T qvariant_cast(const QVariant &value)
Returns the given value converted to the template type T.
QString message() const
Returns the message that the callee associated with this error.