[Kde-bindings] KDE/kdebindings/ruby/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Nov 11 13:40:11 UTC 2007


SVN commit 735361 by rdale:

* Fixed a regression introduced when slots were made directly callable.
  It broke the code to invoke remote QtDBus methods because the 
  remote methods become slots in the QMetaObject of the QDBusInterface
  being used as a proxy. The code was trying to invoke those slots
  directly which didn't work. So special case any QMetaObjects which
  have classNames of "local::Merge" as it means they are remote.

CCMAIL: kde-bindings at kde.org



 M  +9 -0      ChangeLog  
 M  +14 -7     src/Qt.cpp  


--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #735360:735361
@@ -1,3 +1,12 @@
+2007-11-11  Richard Dale  <rdale at foton.es>
+
+	* Fixed a regression introduced when slots were made directly callable.
+	  It broke the code to invoke remote QtDBus methods because the 
+	  remote methods become slots in the QMetaObject of the QDBusInterface
+	  being used as a proxy. The code was trying to invoke those slots
+	  directly which didn't work. So special case any QMetaObjects which
+	  have classNames of "local::Merge" as it means they are remote.
+
 2007-10-31  Richard Dale  <rdale at foton.es>
 
 	* Don't build the qtrubyinternal library anymore as it gave trouble on
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #735360:735361
@@ -124,10 +124,10 @@
 VALUE sonnet_module = Qnil;
 
 
+VALUE kconfiggroup_class = Qnil;
 VALUE kconfigskeleton_class = Qnil;
 VALUE kconfigskeleton_itemenum_choice_class = Qnil;
 VALUE kconfigskeleton_itemenum_class = Qnil;
-VALUE kio_udsatom_class = Qnil;
 VALUE konsole_part_class = Qnil;
 VALUE kwin_class = Qnil;
 VALUE qlistmodel_class = Qnil;
@@ -338,7 +338,10 @@
 		}
 
 		const char *methodName = smoke->methodNames[smoke->methods[method].name];
-	
+		if (qstrncmp(methodName, "operator", sizeof("operator") - 1) == 0) {
+			methodName += (sizeof("operator") - 1);
+		}
+
 		// If the virtual method hasn't been overriden, just call the C++ one.
 		if (rb_respond_to(obj, rb_intern(methodName)) == 0) {
 	    	return false;
@@ -1825,6 +1828,7 @@
 						
 						*name = rb_id2name(SYM2ID(argv[0]));
 						const QMetaObject * meta = qobject->metaObject();
+
 						if (argc == 1) {
 							if (name->endsWith("?")) {
 								name->replace(0, 1, pred->mid(0, 1).toUpper());
@@ -1849,8 +1853,11 @@
 						}
 
 						int classId = o->smoke->idClass(meta->className());
-						// The class isn't in the Smoke lib..
-						while (classId == 0) {
+
+						// The class isn't in the Smoke lib. But if it is called 'local::Merged'
+						// it is from a QDBusInterface and the slots are remote, so don't try to
+						// those.
+						while (classId == 0 && qstrcmp(meta->className(), "local::Merged") != 0) {
 							// Assume the QObject has slots which aren't in the Smoke library, so try
 							// and call the slot directly
 							for (int id = meta->methodOffset(); id < meta->methodCount(); id++) {
@@ -3112,9 +3119,6 @@
 	} else if (packageName.startsWith("KIO::")) {
 		klass = rb_define_class_under(kio_module, package+strlen("KIO::"), base_class);
 		rb_define_singleton_method(klass, "new", (VALUE (*) (...)) _new_kde, -1);
-		if (packageName == "KIO::UDSAtom") {
-			kio_udsatom_class = klass;
-		}
 	} else if (packageName.startsWith("DOM::")) {
 		klass = rb_define_class_under(dom_module, package+strlen("DOM::"), base_class);
 		rb_define_singleton_method(klass, "new", (VALUE (*) (...)) _new_kde, -1);
@@ -3157,6 +3161,9 @@
 				&& packageName.mid(1, 1).contains(QRegExp("[A-Z]")) == 1 ) 
 	{
 		klass = rb_define_class_under(kde_module, package+strlen("K"), base_class);
+		if (packageName == QLatin1String("KConfigGroup")) {
+			kconfiggroup_class = klass;
+		}
 	} else {
 		packageName = packageName.mid(0, 1).toUpper() + packageName.mid(1);
 		klass = rb_define_class_under(kde_module, packageName.toLatin1(), base_class);



More information about the Kde-bindings mailing list