diff options
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e459d0f..a3a43e6 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1486,17 +1486,13 @@ public: QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded; - QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QString *errorString) { + QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); - return QDeclarativeDirComponents(); } QDir dir = QFileInfo(file).dir(); @@ -1516,15 +1512,7 @@ public: plugin.name); if (!resolvedFilePath.isEmpty()) { - if (!engine->importPlugin(resolvedFilePath, uri)) { - if (errorString) - *errorString = QDeclarativeEngine::tr("plugin \"%1\" cannot be loaded for module \"%2\"").arg(resolvedFilePath).arg(uri); - return QDeclarativeDirComponents(); - } - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); - return QDeclarativeDirComponents(); + engine->importPlugin(resolvedFilePath, uri); } } } @@ -1589,9 +1577,7 @@ public: url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, engine); - qmldircomponents = importExtension(absoluteFilePath, uri, engine, errorString); - if (qmldircomponents.isEmpty()) // error (or empty) - return false; + qmldircomponents = importExtension(absoluteFilePath, uri, engine); break; } } @@ -1622,14 +1608,12 @@ public: return false; // local import dirs must exist } uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); + qmldircomponents = importExtension(localFileOrQrc, + uri, + engine); + if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); - if (QFile::exists(localFileOrQrc)) { - qmldircomponents = importExtension(localFileOrQrc, - uri,engine,errorString); - if (qmldircomponents.isEmpty()) // error (or empty) - return false; - } } else { if (prefix.isEmpty()) { // directory must at least exist for valid import |