void JSObjectProxy::addSlotBinding( const QCString &name, KJS::ExecState *exec, KJS::Object &object ) { // Lookup and bind slot QMetaObject * mo = obj->metaObject(); int slotid = mo->findSlot( name.data(), true ); if ( slotid == -1 ) return ; const QMetaData *md = mo->slot( slotid, true ); if ( md->access != QMetaData::Public ) return ; // Find signature int id = Bindings::JSSlotUtils::findSignature( name ); // kdDebug( 80001 )<<"JSObjectProxy::addSlotBinding()::slot:"<<name<<" id:"<<id<<endl; if ( id < 0 ) return ; QCString jsname = name; jsname.detach(); jsname.replace( QRegExp( "\\([^\\)]*\\)" ), "" ); // Find the return type, we only care if it is a pointer type const QUMethod *m = md->method; const char *retclass = 0; QCString ptr( "ptr" ); if ( m->count && ( m->parameters->inOut == QUParameter::Out ) && ( ptr == m->parameters->type->desc() ) ) { retclass = ( const char * ) m->parameters->typeExtra; // kdDebug(80001) << "Return type is a pointer, type " << retclass << endl; } // Create the Imp JSObjectProxyImp *imp = new JSObjectProxyImp( exec, JSObjectProxyImp::MethodSlot, retclass ? retclass : "", id, name, this ); if ( !object.hasProperty( exec, KJS::Identifier( jsname ) ) ) { // The identifier is unused object.put( exec, KJS::Identifier( jsname.data() ), KJS::Object( imp ) ); } else { // The identifier has already been used QString s( name ); QCString cs = QString( "%1%2" ).arg( jsname ).arg( s.contains( ',' ) + 1 ).ascii(); //kdDebug(80001) << "Method " << jsname << " exists, using " << cs << " for " << s << endl; object.put( exec, KJS::Identifier( cs.data() ), KJS::Object( imp ) ); } }