dbus/qt/examples dbus.cpp,1.1,1.2

Thiago J. Macieira thiago at kemper.freedesktop.org
Mon Apr 10 03:49:38 PDT 2006


Update of /cvs/dbus/dbus/qt/examples
In directory kemper:/tmp/cvs-serv30015/qt/examples

Modified Files:
	dbus.cpp 
Log Message:
	Merge from Subversion:
	* qt/qt-dbus.qdocconf: Update Trolltech's webpage link to
	  something that exists (r526315)
	* qt/qdbusinternalfilters.cpp: Correctly detect non-scriptable
	  slots/signals (r526316)
	* qt/qdbusinternalfilters.cpp: Fix the setProperty call and
	  also return an unknown-method error if the parameters don't
	  match for org.freedesktop.DBus.Properties. (r526842)
	* qt/examples/dbus.cpp: Allow passing of QVariants (r526843)
	* qt/qdbusintegrator.cpp: Restore the proper order of
	  delivery: don't make method returns be delivered on priority
	  (r528150)


Index: dbus.cpp
===================================================================
RCS file: /cvs/dbus/dbus/qt/examples/dbus.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dbus.cpp	28 Mar 2006 19:16:35 -0000	1.1
+++ dbus.cpp	10 Apr 2006 10:49:36 -0000	1.2
@@ -213,11 +213,13 @@
     QVariantList params;
     for (int i = 0; argc && i < types.count(); ++i) {
         int id = QVariant::nameToType(types.at(i));
-        if (id == QVariant::UserType || id == QVariant::Map) {
+        if ((id == QVariant::UserType || id == QVariant::Map) && types.at(i) != "QVariant") {
             fprintf(stderr, "Sorry, can't pass arg of type %s yet\n",
                     types.at(i).constData());
             exit(1);
         }
+        if (id == QVariant::UserType)
+            id = QMetaType::type(types.at(i));
 
         Q_ASSERT(id);
 
@@ -227,7 +229,13 @@
         else
             p = QString::fromLocal8Bit(argv[0]);
 
-        p.convert( QVariant::Type(id) );
+        if (id < QVariant::UserType)
+            // avoid calling it for QVariant
+            p.convert( QVariant::Type(id) );
+        else if (types.at(i) == "QVariant") {
+            QVariant tmp(id, p.constData());
+            p = tmp;
+        }
         params += p;
         --argc;
         ++argv;



More information about the dbus-commit mailing list