QmlJS: Fix import path handling in the model manager.

Previously, the model manager always had exactly one import path - but
you can open more than one Qml project at once. Now, we store the union
of all import paths in the model manager.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-06-22 12:54:19 +02:00
parent eba9157476
commit 16b4e4e91f
5 changed files with 98 additions and 29 deletions

View File

@@ -96,8 +96,6 @@ void QmlProject::parseProject(RefreshOptions options)
m_projectItem = qobject_cast<QmlProjectItem*>(component->create());
connect(m_projectItem.data(), SIGNAL(qmlFilesChanged(QSet<QString>, QSet<QString>)),
this, SLOT(refreshFiles(QSet<QString>, QSet<QString>)));
connect(m_projectItem.data(), SIGNAL(importPathsChanged()), this, SLOT(refreshImportPaths()));
refreshImportPaths();
} else {
Core::MessageManager *messageManager = Core::ICore::instance()->messageManager();
messageManager->printToOutputPane(tr("Error while loading project file!"));
@@ -126,6 +124,11 @@ void QmlProject::refresh(RefreshOptions options)
if (options & Files)
m_rootNode->refresh();
QmlJS::ModelManagerInterface::ProjectInfo pinfo(this);
pinfo.sourceFiles = files();
pinfo.importPaths = importPaths();
m_modelManager->updateProjectInfo(pinfo);
}
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
@@ -186,11 +189,6 @@ void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString
m_modelManager->removeFiles(removed.toList());
}
void QmlProject::refreshImportPaths()
{
m_modelManager->setProjectImportPaths(importPaths());
}
QString QmlProject::displayName() const
{
return m_projectName;