// $Id$ // -*- c++ -*- /* * Copyright (C) 2003, Ian Reinhart Geiser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include "dcop_imp.h" #include "dcop_imp.moc" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../jsbinding.h" #include #include #include namespace KJSEmbed { namespace Bindings { KJS::Object JSDCOPRefLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const { TTQString application = extractTQString(exec, args, 0); TTQString object = extractTQString(exec, args, 1); JSOpaqueProxy * prx; if( application.isEmpty() ) prx= new JSOpaqueProxy( new DCOPRef(), "DCOPRef" ); else prx= new JSOpaqueProxy( new DCOPRef(application.latin1(),object.latin1()), "DCOPRef" ); KJS::Object proxyObj( prx ); prx->setOwner( JSProxy::JavaScript ); addBindings(jspart,exec,proxyObj); return proxyObj; } void JSDCOPRefLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const { JSDCOPRef::addBindings( exec, proxy ); } JSDCOPRef::JSDCOPRef(KJS::ExecState *exec, int id) : JSProxyImp(exec), mid(id) { } JSDCOPRef::~JSDCOPRef() { } void JSDCOPRef::addBindings( KJS::ExecState *exec, KJS::Object &object ) { JSOpaqueProxy *op = JSProxy::toOpaqueProxy( object.imp() ); if ( !op ) { kdWarning() << "JSDCOPRef::addBindings() failed, not a JSOpaqueProxy" << endl; return; } if ( op->typeName() != "DCOPRef" ) { kdWarning() << "JSDCOPRef::addBindings() failed, type is " << op->typeName() << endl; return; } DCOPRef *ref = op->toNative(); JSProxy::MethodTable methods[] = { { Methodcall, "call"}, { Methodsend, "send" }, { Methodapp, "app" }, { Methodobj, "obj" }, { Methodtype, "type" }, { MethodsetRef, "setRef" }, { 0, 0 } }; int idx = 0; do { JSDCOPRef *meth = new JSDCOPRef( exec, methods[idx].id ); object.put( exec, methods[idx].name, KJS::Object(meth) ); ++idx; } while( methods[idx].id ); } KJS::Value JSDCOPRef::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) { JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() ); if ( !op ) { kdWarning() << "JSDCOPRef::call() failed, not a JSOpaqueProxy" << endl; return KJS::Boolean(false); } if ( op->typeName() != "DCOPRef" ) { kdWarning() << "JSDCOPRef::call() failed, type is " << op->typeName() << endl; return KJS::Boolean(false); } DCOPRef *ref = op->toNative(); kdDebug() << "Ref valid" << ref << endl; if( !ref ) { kdWarning() << "Ref invalid" << ref << endl; return KJS::Null(); } kdDebug() << "DCOPRef call. " << mid << endl; KJS::Value retValue = KJS::Value(); switch ( mid ) { case Methodcall: { if ( args.size() < 1 ) { kdWarning() << "Not enough args..." << endl; return KJS::Boolean(false); } TTQByteArray data, replyData; TTQDataStream ds( replyData, IO_ReadOnly); TTQCString type; TTQString app = ref->app(); TTQString interface = ref->obj(); TTQString function = extractTQString(exec, args, 0); TTQStringList argTypes = JSDCOPClient::getTypes( function ); if( args.size() > 1) for( int idx = 1; idx < args.size(); ++idx) { JSDCOPClient::marshall(convertToVariant(exec,args[idx] ), argTypes[idx - 1], data); } if( !kapp->dcopClient()->call(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data, type, replyData)) retValue = KJS::Boolean(false); else retValue = JSDCOPClient::demarshall(exec, type, ds); break; } case Methodsend: { if ( args.size() < 1 ) return KJS::Boolean(false); TTQByteArray data; TTQString app = ref->app(); TTQString interface = ref->obj(); TTQString function = extractTQString(exec, args, 0); TTQStringList argTypes = JSDCOPClient::getTypes( function ); if( args.size() > 1) for( int idx = 1; idx < args.size(); ++idx) { JSDCOPClient::marshall(convertToVariant(exec,args[idx] ), argTypes[idx - 1], data); } retValue = KJS::Boolean( kapp->dcopClient()->send(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data)); break; } case Methodapp: { retValue = convertToValue( exec, ref->app() ); break; } case Methodobj: { retValue = convertToValue( exec, ref->obj() ); break; } case Methodtype: { retValue = convertToValue( exec, ref->type() ); break; } case MethodsetRef: { TTQString arg0 = extractTQString(exec, args, 0); TTQString arg1 = extractTQString(exec, args, 1); TTQString arg2 = extractTQString(exec, args, 0); ref->setRef(arg0.latin1(), arg1.latin1(), arg2.latin1() ); break; } default: { kdWarning() << "JSDCOPClient has no method " << mid << endl; break; } } op->setValue( ref, "DCOPRef" ); return retValue; } KJS::Object JSDCOPClientLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &/*args*/) const { JSOpaqueProxy * prx = new JSOpaqueProxy( kapp->dcopClient(), "DCOPClient" ); prx->setOwner( JSProxy::Native ); KJS::Object proxyObj( prx ); addBindings( jspart, exec, proxyObj ); return proxyObj; } void JSDCOPClientLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const { JSDCOPClient::addBindings( exec, proxy ); } JSDCOPClient::JSDCOPClient( KJS::ExecState *exec, int id ) : JSProxyImp(exec), mid(id) { } JSDCOPClient::~JSDCOPClient() { } void JSDCOPClient::addBindings( KJS::ExecState *exec, KJS::Object &object ) { if( !JSProxy::checkType(object, JSProxy::OpaqueProxy, "DCOPClient") ) return; JSProxy::MethodTable methods[] = { { Methodattach, "attach"}, { Methoddetach, "detach"}, { MethodisAttached, "isAttached" }, { MethodregisteredApplications, "registeredApplications" }, { MethodremoteObjects, "remoteObjects" }, { MethodremoteInterfaces, "remoteInterfaces" }, { MethodremoteFunctions, "remoteFunctions" }, { MethodconnectDCOPSignal, "connectDCOPSignal" }, { MethoddisconnectDCOPSignal, "disconnectDCOPSignal"}, { Methodcall, "call"}, { Methodsend, "send"}, { MethodDCOPStart, "dcopStart"}, { MethodappId, "appId"}, { MethodisApplicationRegistered, "isApplicationRegistered" }, { 0, 0 } }; JSProxy::addMethods(exec, methods, object ); } KJS::Value JSDCOPClient::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) { if( !JSProxy::checkType(self, JSProxy::OpaqueProxy, "DCOPClient") ) return KJS::Value(); JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() ); KJS::Value retValue = KJS::Value(); switch ( mid ) { case Methodattach: { retValue = KJS::Boolean(attach( )); break; } case Methoddetach: { retValue = KJS::Boolean(detach( )); break; } case MethodisAttached: { retValue = KJS::Boolean(isAttached( )); break; } case MethodregisteredApplications: { retValue = convertToValue(exec, registeredApplications()); break; } case MethodremoteObjects: { TTQString arg0 = extractTQString(exec, args, 0); retValue = convertToValue( exec, remoteObjects(arg0)); break; } case MethodremoteInterfaces: { TTQString arg0 = extractTQString(exec, args, 0); TTQString arg1 = extractTQString(exec, args, 1); this->remoteInterfaces(arg0, arg1); break; } case MethodremoteFunctions: { TTQString arg0 = extractTQString(exec, args, 0); TTQString arg1 = extractTQString(exec, args, 1); remoteFunctions(arg0, arg1); break; } case MethodconnectDCOPSignal: { TTQString arg0 = extractTQString(exec, args, 0); TTQString arg1 = extractTQString(exec, args, 1); TTQString arg2 = extractTQString(exec, args, 2); TTQString arg3 = extractTQString(exec, args, 3); TTQString arg4 = extractTQString(exec, args, 4); bool arg5 = (args.size() > 5) ? args[5].toBoolean(exec) : false; connectDCOPSignal( arg0, arg1, arg2, arg3, arg4, arg5); break; } case MethoddisconnectDCOPSignal: { TTQString arg0 = extractTQString(exec, args, 0); TTQString arg1 = extractTQString(exec, args, 1); TTQString arg2 = extractTQString(exec, args, 2); TTQString arg3 = extractTQString(exec, args, 3); TTQString arg4 = extractTQString(exec, args, 4); disconnectDCOPSignal(arg0, arg1, arg2, arg3, arg4); break; } case MethodDCOPStart: { TTQString arg0 = extractTQString(exec, args, 0); retValue = KJS::String( dcopStart( arg0, TTQStringList() ) ); break; } case MethodappId: retValue = KJS::String( kapp->dcopClient()->appId().data() ); break; case MethodisApplicationRegistered: { TTQString arg0 = extractTQString(exec, args, 0); retValue = KJS::Boolean( kapp->dcopClient()->isApplicationRegistered( arg0.latin1() ) ); break; } case Methodsend: return dcopSend( exec, self, args ); break; case Methodcall: return dcopCall( exec, self, args ); break; default: kdWarning() << "JSDCOPClient has no method " << mid << endl; break; } return retValue; } bool JSDCOPClient::attach() const { if( !kapp->dcopClient()->isAttached() ) return kapp->dcopClient()->attach(); return true; } bool JSDCOPClient::detach() const { return kapp->dcopClient()->detach(); } bool JSDCOPClient::isAttached() const { return kapp->dcopClient()->isAttached(); } KJS::Value JSDCOPClient::dcopCall( KJS::ExecState * exec, KJS::Object &, const KJS::List & args ) { if ( args.size() < 3 ) return KJS::Boolean(false); TTQStringList types; TTQByteArray data, replyData; TTQDataStream ds( replyData, IO_ReadOnly); TTQCString type; TTQString app = extractTQString(exec, args, 0); TTQString interface = extractTQString(exec, args, 1); TTQString function = extractTQString(exec, args, 2); TTQStringList argTypes = getTypes( function ); if( args.size() > 3) for( int idx = 3; idx < args.size(); ++idx) { TTQVariant var = convertToVariant(exec,args[idx] ); marshall(var, argTypes[idx -3 ], data); } if( !kapp->dcopClient()->call(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data, type, replyData)) return KJS::Boolean(false); else return demarshall(exec, type, ds); } KJS::Value JSDCOPClient::dcopSend( KJS::ExecState * exec, KJS::Object &, const KJS::List & args ) { if ( args.size() < 3 ) return KJS::Boolean(false); TTQByteArray data; TTQString app = extractTQString(exec, args, 0); TTQString interface = extractTQString(exec, args, 1); TTQString function = extractTQString(exec, args, 2); TTQStringList argTypes = getTypes( function ); if( args.size() > 3) for( int idx = 3; idx < args.size(); ++idx) { TTQVariant var = convertToVariant(exec,args[idx] ); marshall(var, argTypes[idx - 3], data); } return KJS::Boolean( kapp->dcopClient()->send(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data)); } KJS::Value JSDCOPClient::demarshall( KJS::ExecState * exec, const TTQCString& type, TTQDataStream& data) { kdDebug() << "Demarshall " << type << endl; if( type == "DCOPRef" ) { DCOPRef *ref = new DCOPRef(); data >> *ref; JSOpaqueProxy *prx = new JSOpaqueProxy(ref, "DCOPRef" ); KJS::Object proxyObj(prx); kdDebug() << "DCOPRef " << ref->app() << endl; Bindings::JSDCOPRef::addBindings( exec, proxyObj ); return proxyObj; } else return convertToValue(exec, demarshall(type, data)); } TTQStringList JSDCOPClient::getTypes( const TTQString& function ) { TTQCString myFunction = DCOPClient::normalizeFunctionSignature (function.latin1()); TTQString args = myFunction.mid( myFunction.find('(') + 1 ); args = args.left( args.length() - 1); return TTQStringList::split(',', args); } void JSDCOPClient::marshall( const TTQVariant& data, const TTQString& typeName, TTQByteArray& buffer ) { TTQDataStream stream(buffer, IO_WriteOnly | IO_Append); if ( typeName == "TTQString" ) { stream << data.toString(); } else if ( typeName == "TTQCString") { stream << data.toCString(); } else if ( typeName == "int") { stream << data.toInt(); } else if ( typeName == "uint") { stream << data.toUInt(); } else if ( typeName == "bool") { stream << data.toBool(); } else if ( typeName == "double") { stream << data.toDouble(); } else if ( typeName == "TTQMap" ) { stream << data.toMap(); } else if ( typeName == "TTQValueList") { stream << data.toList(); } else if ( typeName == "TTQFont") { stream << data.toFont(); } else if ( typeName == "TTQPixmap") { stream << data.toPixmap(); } else if ( typeName == "TTQBrush") { stream << data.toBrush(); } else if ( typeName == "TTQRect") { stream << data.toRect(); } else if ( typeName == "TTQSize") { stream << data.toSize(); } else if ( typeName == "TTQColor") { stream << data.toColor(); } else if ( typeName == "TTQPalette") { stream << data.toPalette(); } else if ( typeName == "TTQColorGroup") { stream << data.toColorGroup(); } /*else if ( typeName == "TTQIconSet") { stream << data.toIconSet(); }*/ else if ( typeName == "TTQPoint") { stream << data.toPoint(); } else if ( typeName == "TTQImage") { stream << data.toImage(); } else if ( typeName == "TTQPointArray") { stream << data.toPointArray(); } else if ( typeName == "TTQRegion") { stream << data.toRegion(); } else if ( typeName == "TTQBitmap") { stream << data.toBitmap(); } else if ( typeName == "TTQCursor") { stream << data.toCursor(); } /*else if ( typeName == "TTQSizePolicy") { stream << data.toSizePolicy(); }*/ else if ( typeName == "TTQDate") { stream << data.toDate(); } else if ( typeName == "TTQTime") { stream << data.toTime(); } else if ( typeName == "TTQDateTime") { stream << data.toDateTime(); } else if ( typeName == "TTQByteArray") { stream << data.toByteArray(); } else if ( typeName == "TTQBitArray") { stream << data.toBitArray(); } else if ( typeName == "TTQKeySequence") { stream << data.toKeySequence(); } else if ( typeName == "KURL" ) { KURL url = data.toString(); stream << url; } else stream << 0; } TTQString JSDCOPClient::dcopStart( const TTQString &appName, const TTQStringList& args ) { TTQString error; TTQString startFunction; if (appName.endsWith(".desktop")) startFunction = "start_service_by_desktop_path(TTQString,TTQStringList)"; else startFunction = "start_service_by_desktop_name(TTQString,TTQStringList)"; TTQByteArray data, replyData; TTQCString replyType; TTQDataStream arg(data, IO_WriteOnly); arg << appName << args; if ( !kapp->dcopClient()->call( "klauncher", "klauncher", startFunction.latin1(), data, replyType, replyData) ) { kdWarning() << "Error: Dcop call failed" << endl; } else { TTQDataStream reply(replyData, IO_ReadOnly); if ( replyType != "serviceResult" ) { kdWarning() << "Error: No serviceResult " << endl; } else { int result; TTQCString dcopName; TTQString error; reply >> result >> dcopName >> error; if (result != 0) { kdWarning() << "Error: " << error.local8Bit().data() << endl; } else if (!dcopName.isEmpty()) { return dcopName; } else kdWarning() << "Error: no app name returned." << endl; } } return ""; } TTQStringList JSDCOPClient::remoteFunctions( const TTQString & remApp, const TTQString & remObj ) { TTQStringList returnList; TQCStringList lst = kapp->dcopClient()->remoteFunctions(remApp.local8Bit(), remObj.local8Bit()); for(uint idx = 0; idx < lst.count(); ++idx) returnList += lst[idx]; return returnList; } TTQStringList JSDCOPClient::remoteInterfaces( const TTQString & remApp, const TTQString & remObj ) { TTQStringList returnList; TQCStringList lst = kapp->dcopClient()->remoteInterfaces(remApp.local8Bit(), remObj.local8Bit()); for(uint idx = 0; idx < lst.count(); ++idx) returnList += lst[idx]; return returnList; } TTQStringList JSDCOPClient::remoteObjects( const TTQString & remApp ) { TTQStringList returnList; TQCStringList lst = kapp->dcopClient()->remoteObjects(remApp.local8Bit()); for(uint idx = 0; idx < lst.count(); ++idx) returnList += lst[idx]; return returnList; } TTQStringList JSDCOPClient::registeredApplications( ) { TTQStringList returnList; TQCStringList lst = kapp->dcopClient()->registeredApplications( ); for(uint idx = 0; idx < lst.count(); ++idx) returnList += lst[idx]; return returnList; } bool JSDCOPClient::connectDCOPSignal (const TTQString &sender, const TTQString &senderObj, const TTQString &signal, const TTQString &receiverObj, const TTQString &slot, bool Volatile) { return kapp->dcopClient()->connectDCOPSignal(sender.latin1(), senderObj.latin1(), signal.latin1(), receiverObj.latin1(), slot.latin1(), Volatile); } bool JSDCOPClient::disconnectDCOPSignal (const TTQString &sender, const TTQString &senderObj, const TTQString &signal, const TTQString &receiverObj, const TTQString &slot) { return kapp->dcopClient()->disconnectDCOPSignal(sender.latin1(), senderObj.latin1(), signal.latin1(), receiverObj.latin1(), slot.latin1()); } KJS::Object JSDCOPInterfacerLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const { TTQObject *parent = extractTQObject(exec, args, 0); TTQString name = extractTQString(exec, args, 1); TTQObject *obj = new JSDCOPInterface(jspart->interpreter(),parent, name.latin1() ); JSObjectProxy *prxy = new JSObjectProxy(jspart, obj); KJS::Object object(prxy); addBindings(jspart,exec,object); return object; } void JSDCOPInterfacerLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const { JSObjectProxy *prx = JSProxy::toObjectProxy( proxy.imp() ); if( prx ) prx->addBindings( exec, proxy ); } void JSDCOPInterface::publish( const TTQString & signature ) { if( m_Members.find(signature.latin1() ) == m_Members.end()) m_Members.append(signature.latin1() ); } JSDCOPInterface::~ JSDCOPInterface( ) { } JSDCOPInterface::JSDCOPInterface( KJS::Interpreter *js, TTQObject * parent, const char * name ) : BindingObject( parent, name ),DCOPObject(name), m_js(js) { m_Members.clear(); } TTQCStringList JSDCOPInterface::functionsDynamic( ) { return m_Members; } bool JSDCOPInterface::processDynamic( const TTQCString & rawFunction, const TTQByteArray & data, TTQCString & replyType, TTQByteArray & replyData ) { bool isOkay = false; TTQRegExp reg = TTQRegExp("([_\\d\\w]+)(\\()(.*)(\\))"); reg.search(rawFunction); kdDebug() << "Raw function: " << rawFunction << endl; kdDebug() << "Reply type: " << replyType << endl; kdDebug() << "Signature: " << reg.cap(1) << endl; kdDebug() << "Args: " << reg.cap(3) << endl; TTQString signature = reg.cap(1); TTQStringList argStrings = TTQStringList::split(',', reg.cap(3), false); kdDebug() << argStrings.count() << " args..." << endl; KJS::ExecState *exec = m_js->globalExec(); KJS::Object obj = m_js->globalObject(); KJS::Identifier id( KJS::UString( signature.latin1() ) ); KJS::Object fun = obj.get(exec, id ).toObject( exec ); KJS::Value retValue; if ( fun.implementsCall() ) { TTQDataStream ds( data, IO_ReadOnly ); KJS::List args; for( uint idx = 0; idx < argStrings.count(); ++idx) { kdDebug() << "Get arg: " << argStrings[idx] << endl; args.append( JSDCOPClient::demarshall( exec, argStrings[idx].latin1(), ds)); } retValue = fun.call(exec, obj, args); if( exec->hadException() ) { kdWarning() << "Got error: " << exec->exception().toString(exec).qstring() << endl; } else { kdDebug() << "Returned type is a " << retValue.type() << endl; if( retValue.isA(KJS::UndefinedType) ) { replyType = "void"; isOkay = true; } else if( retValue.isA(KJS::ObjectType) ) { JSOpaqueProxy *oprx = JSProxy::toOpaqueProxy( retValue.imp() ); if( oprx ) { replyType = "DCOPRef"; TTQDataStream refStream( replyData, IO_WriteOnly ); if( oprx->typeName() == "DCOPRef" ) { DCOPRef ref(*oprx->toNative()); refStream << ref; isOkay = true; } } } else { TTQVariant returnVariant = convertToVariant(exec, retValue); JSDCOPClient::marshall(returnVariant,returnVariant.typeName(), replyData); replyType = returnVariant.typeName(); isOkay = true; } } } return isOkay; } TTQVariant JSDCOPClient::demarshall( const TTQCString & type, TTQDataStream & reply ) { kdDebug() << "Type: '" << type << "'"<< endl; /*if ( type == "TTQMap" ) // ? dont handle? { TTQMap result; reply >> result; return TTQVariant(result); } else if ( type == "TTQValueList") // ? dont handle? { TTQValueList result; reply >> result; return TTQVariant(result); }else if ( type == "TQVariantList") { TQVariantList result; reply >> result; return TTQVariant(result); } else */ if ( type == "TTQString") { TTQString result; reply >> result; return TTQVariant(result); } else if ( type == "int") { int result; reply >> result; kdDebug() << "Result: " << result << endl; return TTQVariant(result); } else if ( type == "uint") { uint result; reply >> result; return TTQVariant(result); } else if ( type == "bool") { bool result; reply >> result; return TTQVariant(result); } else if ( type == "double") { double result; reply >> result; return TTQVariant(result); } else if ( type == "TTQCString") { TTQCString result; reply >> result; return TTQVariant(result); } else if ( type == "TTQVariant") { TTQVariant result; reply >> result; return TTQVariant(result); } else if ( type == "TTQFont") { TTQFont result; reply >> result; return TTQVariant(result); } else if ( type == "TTQPixmap") { TTQPixmap result; reply >> result; return TTQVariant(result); } else if ( type == "TTQBrush") { TTQBrush result; reply >> result; return TTQVariant(result); } else if ( type == "TTQRect") { TTQRect result; reply >> result; return TTQVariant(result); } else if ( type == "TTQSize") { TTQSize result; reply >> result; return TTQVariant(result); } else if ( type == "TTQColor") { TTQColor result; reply >> result; return TTQVariant(result); } else if ( type == "TTQPalette") { TTQPalette result; reply >> result; return TTQVariant(result); } else if ( type == "TTQColorGroup") { TTQColorGroup result; reply >> result; return TTQVariant(result); } /*else if ( type == "TTQIconSet") { TTQIconSet result; reply >> result; return TTQVariant(result); }*/ else if ( type == "TTQPoint") { TTQPoint result; reply >> result; return TTQVariant(result); } else if ( type == "TTQImage") { TTQImage result; reply >> result; return TTQVariant(result); } else if ( type == "TTQPointArray") { TTQPointArray result; reply >> result; return TTQVariant(result); } else if ( type == "TTQRegion") { TTQRegion result; reply >> result; return TTQVariant(result); } else if ( type == "TTQBitmap") { TTQBitmap result; reply >> result; return TTQVariant(result); } else if ( type == "TTQCursor") { TTQCursor result; reply >> result; return TTQVariant(result); } /*else if ( type == "TTQSizePolicy") { TTQSizePolicy result; reply >> result; return TTQVariant(result); }*/ else if ( type == "TTQDate") { TTQDate result; reply >> result; return TTQVariant(result); } else if ( type == "TTQTime") { TTQTime result; reply >> result; return TTQVariant(result); } else if ( type == "TTQDateTime") { TTQDateTime result; reply >> result; return TTQVariant(result); } else if ( type == "TTQByteArray") { TTQByteArray result; reply >> result; return TTQVariant(result); } else if ( type == "TTQBitArray") { TTQBitArray result; reply >> result; return TTQVariant(result); } else if ( type == "TTQKeySequence") { TTQKeySequence result; reply >> result; return TTQVariant(result); } else if ( type == "TTQStringList") { TTQStringList result; reply >> result; return TTQVariant(result); } else if ( type == "TQCStringList") { TTQStringList result; reply >> result; return TTQVariant(result); } else return TTQVariant(); } } // namespace Bindings } // namespace KJSEmbed