diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-04-30 06:19:02 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-04-30 06:19:02 (GMT) |
commit | 4cdf487e2f00f8d3bb3fff9ce33c02812cb4fe7c (patch) | |
tree | 9af3b6940274b0199f5de8fc35efdc427403ec94 | |
parent | 6409c4256c8f63a981c5448ded84246134ac2a40 (diff) | |
parent | 488d2f6012c13291d2a8fe7907c332e2ab1b1b15 (diff) | |
download | Qt-4cdf487e2f00f8d3bb3fff9ce33c02812cb4fe7c.zip Qt-4cdf487e2f00f8d3bb3fff9ce33c02812cb4fe7c.tar.gz Qt-4cdf487e2f00f8d3bb3fff9ce33c02812cb4fe7c.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r-- | src/declarative/qml/qmlcompositetypemanager_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index ffa4fda..bc86fcf 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -52,6 +52,7 @@ class QmlEngine; class QmlCompiledComponent; class QmlComponentPrivate; class QmlComponent; +class QmlDomDocument; struct QmlCompositeTypeData : public QmlRefCount { QmlCompositeTypeData(); @@ -98,6 +99,7 @@ struct QmlCompositeTypeData : public QmlRefCount private: friend class QmlCompositeTypeManager; friend class QmlCompiler; + friend class QmlDomDocument; QmlScriptParser data; QList<QmlComponentPrivate *> waiters; diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 72c1c76..4e8e1f7 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -42,6 +42,7 @@ #include "qmldom.h" #include "qmldom_p.h" #include "private/qmlcompiler_p.h" +#include "private/qmlengine_p.h" #include "qmlcompiledcomponent_p.h" #include <QtCore/qbytearray.h> #include <QtCore/qstring.h> @@ -159,15 +160,28 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data) QmlCompiledComponent component; QmlCompiler compiler; - // ### -// compiler.compile(engine, parser, &component); + + QmlCompositeTypeData *td = ((QmlEnginePrivate *)QmlEnginePrivate::get(engine))->typeManager.getImmediate(data, QUrl());; + + if(td->status == QmlCompositeTypeData::Error) { + d->error = td->errorDescription; + td->release(); + return false; + } else if(td->status == QmlCompositeTypeData::Waiting) { + d->error = QLatin1String("QmlDomDocument supports local types only"); + td->release(); + return false; + } + + compiler.compile(engine, td, &component); if (compiler.isError()) { d->error = compiler.errorDescription(); + td->release(); return false; } - if (parser.tree()) { + if (td->data.tree()) { component.dump(0, parser.tree()); d->root = parser.tree(); d->root->addref(); |