diff options
Diffstat (limited to 'src/tools/dbusxml2qt3/methodgen.cpp')
-rw-r--r-- | src/tools/dbusxml2qt3/methodgen.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/tools/dbusxml2qt3/methodgen.cpp b/src/tools/dbusxml2qt3/methodgen.cpp index a7e3427..f86f762 100644 --- a/src/tools/dbusxml2qt3/methodgen.cpp +++ b/src/tools/dbusxml2qt3/methodgen.cpp @@ -152,7 +152,7 @@ static bool parseDBusSignature(const TQString& signature, Argument& argument) if (!parseDBusSignature(dictSignature.left(1), key)) return false; Argument value; - if (parseDBusSignature(dictSignature.mid(1), value)) + if (parseDBusSignature(dictSignature.mid(1), value) && !dictSignature.startsWith("oa")) { if (!value.subAccessor.isEmpty()) { @@ -535,6 +535,14 @@ static void writeNodeInitialization(const Class& classData, stream << " return true;" << endl; stream << "}" << endl; stream << endl; + + stream << "void " << classData.name + << "::addChildNode(const TQString& child)" << endl; + stream << "{" << endl; + stream << " m_private->childrenNodes.append(child);" << endl; + stream << "}" << endl; + stream << endl; + } static void writeNodeIntrospection(const Class& classData, @@ -550,11 +558,14 @@ static void writeNodeIntrospection(const Class& classData, stream << " {" << endl; stream << " nodeElement.setAttribute ( \"name\", objectPath );" << endl; stream << " }" << endl; - stream << " TQDomElement interfaceElement = doc.createElement(\"interface\");" + stream << " // Introspectable is added by default. Show it only if there is interface" << endl; + stream << " if (interfaces.count()>1) {" << endl; + stream << " TQDomElement interfaceElement = doc.createElement(\"interface\");" << endl; - stream << " org::freedesktop::DBus::IntrospectableInterface" + stream << " org::freedesktop::DBus::IntrospectableInterface" << "::buildIntrospectionData(interfaceElement);" << endl; - stream << " nodeElement.appendChild(interfaceElement);" << endl; + stream << " nodeElement.appendChild(interfaceElement);" << endl; + stream << " }" << endl; TQValueList<Class>::const_iterator it = interfaces.begin(); TQValueList<Class>::const_iterator endIt = interfaces.end(); @@ -563,7 +574,7 @@ static void writeNodeIntrospection(const Class& classData, if ((*it).dbusName == "org.freedesktop.DBus.Introspectable") continue; stream << endl; - stream << " interfaceElement = doc.createElement(\"interface\");" + stream << " TQDomElement interfaceElement = doc.createElement(\"interface\");" << endl; stream << " " << (*it).namespaces.join("::") + "::" + (*it).name << "Interface::buildIntrospectionData(interfaceElement);" << endl; @@ -571,6 +582,15 @@ static void writeNodeIntrospection(const Class& classData, } stream << endl; + stream << " if (!childrenNodes.isEmpty()) {" << endl; + stream << " for (TQStringList::Iterator it = childrenNodes.begin(); it != childrenNodes.end(); ++it ) {" << endl; + stream << " TQDomElement nodeElement1 = doc.createElement(\"node\");" << endl; + stream << " nodeElement1.setAttribute ( \"name\", *it );" << endl; + stream << " nodeElement.appendChild(nodeElement1);" << endl; + stream << " }" << endl; + stream << " }" << endl; + + stream << endl; stream << " doc.appendChild(nodeElement);" << endl; stream << endl; @@ -1763,6 +1783,7 @@ void MethodGenerator::writeNodePrivate(const Class& classData, TQTextStream& str stream << endl; stream << " TQT_DBusConnection connection;" << endl; stream << " TQString objectPath;" << endl; + stream << " TQStringList childrenNodes;" << endl; stream << endl; stream << "protected:" << endl; |