src/dbus/qdbusintegrator.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   616         // check access:
   616         // check access:
   617         if (mm.access() != QMetaMethod::Public)
   617         if (mm.access() != QMetaMethod::Public)
   618             continue;
   618             continue;
   619 
   619 
   620         // check type:
   620         // check type:
   621         if (mm.methodType() != QMetaMethod::Slot)
   621         if (mm.methodType() != QMetaMethod::Slot && mm.methodType() != QMetaMethod::Method)
   622             continue;
   622             continue;
   623 
   623 
   624         // check name:
   624         // check name:
   625         QByteArray slotname = mm.signature();
   625         QByteArray slotname = mm.signature();
   626         int paren = slotname.indexOf('(');
   626         int paren = slotname.indexOf('(');
   680 
   680 
   681         // consistency check:
   681         // consistency check:
   682         if (isAsync && metaTypes.count() > i + 1)
   682         if (isAsync && metaTypes.count() > i + 1)
   683             continue;
   683             continue;
   684 
   684 
   685         if (isScriptable && (flags & QDBusConnection::ExportScriptableSlots) == 0)
   685         if (mm.methodType() == QMetaMethod::Slot) {
   686             continue;           // not exported
   686             if (isScriptable && (flags & QDBusConnection::ExportScriptableSlots) == 0)
   687         if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableSlots) == 0)
   687                 continue;           // scriptable slots not exported
   688             continue;           // not exported
   688             if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableSlots) == 0)
       
   689                 continue;           // non-scriptable slots not exported
       
   690         } else {
       
   691             if (isScriptable && (flags & QDBusConnection::ExportScriptableInvokables) == 0)
       
   692                 continue;           // scriptable invokables not exported
       
   693             if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableInvokables) == 0)
       
   694                 continue;           // non-scriptable invokables not exported
       
   695         }
   689 
   696 
   690         // if we got here, this slot matched
   697         // if we got here, this slot matched
   691         return idx;
   698         return idx;
   692     }
   699     }
   693 
   700 
   704     Q_UNUSED(object);
   711     Q_UNUSED(object);
   705 
   712 
   706     int n = metaTypes.count() - 1;
   713     int n = metaTypes.count() - 1;
   707     if (metaTypes[n] == QDBusMetaTypeId::message)
   714     if (metaTypes[n] == QDBusMetaTypeId::message)
   708         --n;
   715         --n;
       
   716 
       
   717     if (msg.arguments().count() < n)
       
   718         return 0;               // too few arguments
   709 
   719 
   710     // check that types match
   720     // check that types match
   711     for (int i = 0; i < n; ++i)
   721     for (int i = 0; i < n; ++i)
   712         if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() &&
   722         if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() &&
   713             msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>())
   723             msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>())
  1377     // try our standard filters
  1387     // try our standard filters
  1378     if (activateInternalFilters(node, msg))
  1388     if (activateInternalFilters(node, msg))
  1379         return;                 // internal filters have already run or an error has been sent
  1389         return;                 // internal filters have already run or an error has been sent
  1380 
  1390 
  1381     // try the object itself:
  1391     // try the object itself:
  1382     if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) {
  1392     if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots) ||
       
  1393         node.flags & (QDBusConnection::ExportScriptableInvokables|QDBusConnection::ExportNonScriptableInvokables)) {
  1383         bool interfaceFound = true;
  1394         bool interfaceFound = true;
  1384         if (!msg.interface().isEmpty())
  1395         if (!msg.interface().isEmpty())
  1385             interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface());
  1396             interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface());
  1386 
  1397 
  1387         if (interfaceFound) {
  1398         if (interfaceFound) {