[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kjsembed/kjsembed
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2008-06-14 21:35:32
Message-ID: 1213479332.754274.672.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 820592 by sebsauer:

made the inheritance-lookup working in kjsembed.


 M  +14 -21    qobject_binding.cpp  


--- trunk/KDE/kdelibs/kjsembed/kjsembed/qobject_binding.cpp #820591:820592
@@ -484,6 +484,12 @@
             if( VariantBinding *valImp = \
                KJSEmbed::extractBindingImp<VariantBinding>(exec,args[idx]) )
                 return new Value<QColor>( valImp->variant().value<QColor>() );
             break;
+        case QVariant::Url:
+            if( args[idx]->type() == KJS::StringType )
+                return new Value<QUrl>( toQString(args[idx]->toString(exec) ));
+            if( VariantBinding *valImp = \
KJSEmbed::extractBindingImp<VariantBinding>(exec,args[idx]) ) +                return \
new Value<QUrl>( valImp->variant().value<QUrl>() ); +            break;
         case QVariant::List:
             if( args[idx]->type() == KJS::ObjectType )
                 return new Value<QVariantList>( convertArrayToList(exec, args[idx]) \
); @@ -496,9 +502,9 @@
         default:
             if( args[idx]->type() == KJS::NullType )
                 return new NullPtr();
-            if ( args[idx]->type() == KJS::StringType )
+            if( args[idx]->type() == KJS::StringType )
             {
-                if ( varianttype == QVariant::Url || \
strcmp(types[idx].constData(),"KUrl") == 0 ) +                if( \
                strcmp(types[idx].constData(),"KUrl") == 0 ) //downcast to QUrl
                     return new Value<QUrl>( toQString(args[idx]->toString(exec) ));
             }
             if( args[idx]->type() == KJS::ObjectType )
@@ -521,36 +527,23 @@
                         // since the QMetaMethod parameterTypes doesn't 
                         // include implicit namespace information.
 
-                        QByteArray className;
-                        int pos;
-
                         //qDebug() << "\tMaking sure " << qObj << " inherits from " \
                << typeName << " inherits(typeName)=" << qObj->inherits(typeName);
-                        const QMetaObject* meta = qObj->metaObject();
-                        do 
+                        for(const QMetaObject* meta = qObj->metaObject(); meta; meta \
= meta->superClass())  {
                             //qDebug() << "1: Checking if " << typeName << " matches \
                " << meta->className();
-                            //if (typeName == meta->className())
-                            {
-                                //qDebug("Yeah! we found a winnder!");
+                            if( typeName == meta->className() )
                                 return new Value<void*>(qObj);
-                            }
 
                             // try with all leading namespacing stripped
-                            className = meta->className();
-                            if ((pos = className.lastIndexOf("::")) != -1)
+                            QByteArray className = meta->className();
+                            int pos = className.lastIndexOf("::");
+                            if( pos != -1 )
                                 className.remove(0, pos + 2);
 
                             //qDebug() << "2: Checking if " << typeName << " matches \
                " << className;
-                            if (typeName == className)
-                            {
-                                //qDebug() << "Yeah! we found a winnder!" << \
typeName << " ~= " << className << "(" << meta->className() << ")"; +                 \
if( typeName == className )  return new Value<void*>(qObj);
-                            }
-
-                            meta = meta->superClass();
-
                         }
-                        while (meta);
                     }
                 }
                 else if(ObjectBinding *objImp = \
KJSEmbed::extractBindingImp<ObjectBinding>(exec, args[idx]))


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic