void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths)
{
ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode->projectNode());
+ addExistingFiles(projectNode, filePaths);
+}
+
+void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QStringList &filePaths)
+{
Core::ICore *core = Core::ICore::instance();
- const QString dir = directoryFor(d->m_currentNode);
+ const QString dir = directoryFor(projectNode);
QStringList fileNames = filePaths;
QHash<FileType, QString> fileTypeToFiles;
foreach (const QString &fileName, fileNames) {
class Project;
class Node;
class BuildConfiguration;
+class ProjectNode;
namespace Internal {
class ProjectFileFactory;
void runProject(Project *pro, const QString &mode);
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode);
+ void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
void addExistingFiles(const QStringList &filePaths);
signals:
{
setIcon(QIcon(":/projectexplorer/images/MaemoDevice.png"));
connect(parent, SIGNAL(addedTarget(ProjectExplorer::Target*)),
- this, SLOT(handleTargetAdded(ProjectExplorer::Target*)),
- Qt::QueuedConnection); // Otherwise ProjextExplorerPlugin::addExistingFiles() won't be ready.
+ this, SLOT(handleTargetAdded(ProjectExplorer::Target*)));
+ connect(parent, SIGNAL(fromMapFinished()),
+ this, SLOT(handleFromMapFinished()));
}
AbstractQt4MaemoTarget::~AbstractQt4MaemoTarget()
return file;
}
+void AbstractQt4MaemoTarget::handleFromMapFinished()
+{
+ handleTargetAdded(this);
+}
+
void AbstractQt4MaemoTarget::handleTargetAdded(ProjectExplorer::Target *target)
{
if (target != this)
return;
+ if (!project()->rootProjectNode()) {
+ // Project is not fully setup yet, happens on new project
+ // we wait for the fromMapFinished that comes afterwards
+ return;
+ }
+
+ disconnect(project(), SIGNAL(fromMapFinished()),
+ this, SLOT(handleFromMapFinished()));
disconnect(project(), SIGNAL(addedTarget(ProjectExplorer::Target*)),
this, SLOT(handleTargetAdded(ProjectExplorer::Target*)));
connect(project(), SIGNAL(aboutToRemoveTarget(ProjectExplorer::Target*)),
.arg(files.join(QLatin1String("\n "))),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes)
- ProjectExplorer::ProjectExplorerPlugin::instance()->addExistingFiles(files);
+ ProjectExplorer::ProjectExplorerPlugin::instance()->addExistingFiles(project()->rootProjectNode(), files);
}
return actionStatus;
}