dbus/qt/examples dbus.cpp,1.2,1.3
Thiago J. Macieira
thiago at kemper.freedesktop.org
Sun Apr 23 12:06:57 PDT 2006
- Previous message: dbus/qt qdbusabstractinterface_p.h, 1.1, 1.2 qdbusconnection.cpp,
1.6, 1.7 qdbusconnection_p.h, 1.7, 1.8 qdbusintegrator.cpp,
1.7, 1.8 qdbusinterface.cpp, 1.4, 1.5 qdbusinterface.h, 1.3,
1.4 qdbusmetaobject.cpp, 1.1, 1.2 qdbusmetaobject_p.h, 1.1, 1.2
- Next message: dbus ChangeLog,1.1001,1.1002
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/qt/examples
In directory kemper:/tmp/cvs-serv32004/qt/examples
Modified Files:
dbus.cpp
Log Message:
* qt/examples/dbus.cpp: Use the new merged-interface mode for
the dynamic meta object. No need to guess which interface to
call.
Index: dbus.cpp
===================================================================
RCS file: /cvs/dbus/dbus/qt/examples/dbus.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus.cpp 10 Apr 2006 10:49:36 -0000 1.2
+++ dbus.cpp 23 Apr 2006 19:06:55 -0000 1.3
@@ -127,38 +127,6 @@
delete iface;
}
-QDBusInterface *findMember(const QString &service, const QString &path, const QString &member)
-{
- QDBusInterface *iface = connection->findInterface(service, path,
- "org.freedesktop.DBus.Introspectable");
- QDBusReply<QString> xml = iface->call("Introspect");
-
- if (xml.isError())
- return 0;
-
- QDomDocument doc;
- doc.setContent(xml);
- QDomElement node = doc.documentElement();
- QDomElement child = node.firstChildElement("interface");
- while (!child.isNull()) {
- QDomElement subchild = child.firstChildElement("method");
- while (!subchild.isNull()) {
- if (subchild.attribute("name") == member) {
- QDBusInterface *retval;
- retval = connection->findInterface(service, path, child.attribute("name"));
- delete iface;
- return retval;
- }
- subchild = subchild.nextSiblingElement("method");
- }
-
- child = child.nextSiblingElement("interface");
- }
-
- delete iface;
- return 0;
-}
-
QStringList readList(int &argc, const char *const *&argv)
{
--argc;
@@ -175,10 +143,7 @@
const QString &member, int argc, const char *const *argv)
{
QDBusInterface *iface;
- if (interface.isEmpty())
- iface = findMember(service, path, member);
- else
- iface = connection->findInterface(service, path, interface);
+ iface = connection->findInterface(service, path, interface);
if (!iface) {
fprintf(stderr, "Interface '%s' not available in object %s at %s\n",
@@ -229,7 +194,7 @@
else
p = QString::fromLocal8Bit(argv[0]);
- if (id < QVariant::UserType)
+ if (id < int(QVariant::UserType))
// avoid calling it for QVariant
p.convert( QVariant::Type(id) );
else if (types.at(i) == "QVariant") {
@@ -275,6 +240,12 @@
} else
connection = &QDBus::sessionBus();
+ if (!connection->isConnected()) {
+ fprintf(stderr, "Could not connect to D-Bus server: %s: %s\n",
+ qPrintable(connection->lastError().name()),
+ qPrintable(connection->lastError().message()));
+ return 1;
+ }
QDBusBusService *bus = connection->busService();
if (argc == 1) {
- Previous message: dbus/qt qdbusabstractinterface_p.h, 1.1, 1.2 qdbusconnection.cpp,
1.6, 1.7 qdbusconnection_p.h, 1.7, 1.8 qdbusintegrator.cpp,
1.7, 1.8 qdbusinterface.cpp, 1.4, 1.5 qdbusinterface.h, 1.3,
1.4 qdbusmetaobject.cpp, 1.1, 1.2 qdbusmetaobject_p.h, 1.1, 1.2
- Next message: dbus ChangeLog,1.1001,1.1002
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list