[Kde-bindings] KDE/kdebindings/csharp/qyoto

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sat Jul 12 14:26:56 UTC 2008


SVN commit 831359 by rdale:

* The type of a slot arg should always be in the smoke module of the slot
 being invoked. However, that isn't true for a dataUpdated() slot in a 
 PlasmaScripting.Applet. So make GetMocArguments search through all the
 loaded smoke modules if the arg type isn't found at first.

CCMAIL: kde-bindings at kde.org



 M  +4 -0      ChangeLog  
 M  +32 -6     src/qyotoshared.cpp  


--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #831358:831359
@@ -3,6 +3,10 @@
 	* Change the slot/signal argument parsing code to work the same way as in
 	  QtRuby. Use a QList<MocArgument*> type instead of just an array of
 	  'MocArgument *'.
+	* The type of a slot arg should always be in the smoke module of the slot
+	  being invoked. However, that isn't true for a dataUpdated() slot in a 
+      PlasmaScripting.Applet. So make GetMocArguments search through all the
+	  loaded smoke modules if the arg type isn't found at first.
 
 2008-07-11  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyotoshared.cpp #831358:831359
@@ -369,8 +369,7 @@
 	foreach (QByteArray name, methodTypes) {
 		MocArgument *arg = new MocArgument;
 		Smoke::Index typeId = 0;
-
-		if (name.isEmpty()) {
+		if (name.isEmpty() || name == "void") {
 			arg->argType = xmoc_void;
 			result.append(arg);
 		} else {
@@ -378,11 +377,38 @@
 			QString staticType = (rx->indexIn(name) != -1 ? rx->cap(1) : "ptr");
 			if (staticType == "ptr") {
 				arg->argType = xmoc_ptr;
-				typeId = smoke->idType(name.constData());
+				QByteArray targetType = name;
+				typeId = smoke->idType(targetType.constData());
 				if (typeId == 0 && !name.contains('*')) {
-					if (!name.contains("&")) name += "&";
-					typeId = smoke->idType(name.constData());
+					if (!name.contains("&")) {
+						targetType += "&";
+					}
+					typeId = smoke->idType(targetType.constData());
 				}
+
+				// This shouldn't be necessary because the type of the slot arg should always be in the 
+				// smoke module of the slot being invoked. However, that isn't true for a dataUpdated()
+				// slot in a PlasmaScripting.Applet
+				if (typeId == 0) {
+					QHash<Smoke*, QyotoModule>::const_iterator it;
+					for (it = qyoto_modules.constBegin(); it != qyoto_modules.constEnd(); ++it) {
+						smoke = it.key();
+						targetType = name;
+						typeId = smoke->idType(targetType.constData());
+	
+						if (typeId == 0 && !name.contains('*')) {
+							if (!name.contains("&")) {
+								targetType += "&";
+							}
+
+							typeId = smoke->idType(targetType.constData());
+	
+							if (typeId != 0) {
+								break;
+							}
+						}
+					}
+				}
 			} else if (staticType == "bool") {
 				arg->argType = xmoc_bool;
 				typeId = smoke->idType(name.constData());
@@ -469,7 +495,7 @@
 			metaobject->activate(qobj, _id, (void**) _o);
 			return _id - count;
 		}
-	
+
 		QList<MocArgument*> mocArgs = GetMocArguments(o->smoke, method.typeName(), method.parameterTypes());
 		
 		// invoke slot



More information about the Kde-bindings mailing list