qmljs: fix import search paths collecting

Change-Id: I0b977d3186d8a0ab8f48e1d689e0ab9d045b46e3
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-07-22 10:34:28 +02:00
parent aebc90ec08
commit d83aa93780

View File

@@ -604,7 +604,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
if (res.qtQmlPath.isEmpty()) if (res.qtQmlPath.isEmpty())
res.qtQmlPath = pInfo.qtQmlPath; res.qtQmlPath = pInfo.qtQmlPath;
foreach (const QString &path, pInfo.importPaths) foreach (const QString &path, pInfo.importPaths)
if (res.importPaths.contains(path)) if (!res.importPaths.contains(path))
res.importPaths.append(path); res.importPaths.append(path);
} }
return res; return res;
@@ -1105,28 +1105,24 @@ void ModelManagerInterface::updateImportPaths()
while (pInfoIter.hasNext()) { while (pInfoIter.hasNext()) {
pInfoIter.next(); pInfoIter.next();
QString pathAtt = pInfoIter.value().qtQmlPath; QString pathAtt = pInfoIter.value().qtQmlPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
{ {
QString pathAtt = defaultProjectInfo().qtQmlPath; QString pathAtt = defaultProjectInfo().qtQmlPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
pInfoIter.toFront(); pInfoIter.toFront();
while (pInfoIter.hasNext()) { while (pInfoIter.hasNext()) {
pInfoIter.next(); pInfoIter.next();
QString pathAtt = pInfoIter.value().qtImportsPath; QString pathAtt = pInfoIter.value().qtImportsPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
{ {
QString pathAtt = defaultProjectInfo().qtImportsPath; QString pathAtt = defaultProjectInfo().qtImportsPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
allImportPaths += m_defaultImportPaths; allImportPaths += m_defaultImportPaths;