Commit 30dfae90 authored by Kai Koehne's avatar Kai Koehne
Browse files

Fix Project pane synchronization in case one opens first file via

Locator

Commit 38924e38 makes sure that the Project node is selected after
loading a new project, even when there is a current editor opened.

Make sure that we actually only block the sync if no new file is opened.

Done with mae.

Reviewed-by: mae
parent 299ea32a
......@@ -121,7 +121,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_model(0),
m_filterProjectsAction(0),
m_autoSync(false),
m_currentItemLocked(false)
m_currentItemLocked(0)
{
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
NodesWatcher *watcher = new NodesWatcher(this);
......@@ -251,9 +251,13 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0")
<< ", " << (node ? node->path() : "0") << ")";
if (m_currentItemLocked) {
m_currentItemLocked = false;
return;
if (m_currentItemLocked == node) {
m_currentItemLocked = 0;
return;
}
m_currentItemLocked = 0;
}
if (!project) {
return;
}
......@@ -290,11 +294,14 @@ void ProjectTreeWidget::showContextMenu(const QPoint &pos)
void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
{
// We disable auto-synchronization for the current node so that the project
// is selected until another file is opened
m_currentItemLocked = m_model->nodeForIndex(m_view->currentIndex());
Node *node = project->rootProjectNode();
QModelIndex idx = m_model->indexForNode(node);
m_view->setExpanded(idx, true);
m_view->setCurrentIndex(idx);
m_currentItemLocked = true;
}
void ProjectTreeWidget::startupProjectChanged(ProjectExplorer::Project *project)
......
......@@ -89,7 +89,7 @@ private:
QModelIndex m_subIndex;
QString m_modelId;
bool m_autoSync;
bool m_currentItemLocked;
Node *m_currentItemLocked;
friend class ProjectTreeWidgetFactory;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment