Commit 01da2071 authored by Dag Andersen's avatar Dag Andersen
Browse files

Fix: Task tree collapses when new tasks are created

BUG:277071
parent a3f047df
......@@ -2275,7 +2275,6 @@ void NodeItemModel::slotNodeInserted( Node *node )
endInsertRows();
m_node = 0;
emit nodeInserted( node );
slotLayoutChanged(); //HACK to get both treeviews updated FIXME
}
void NodeItemModel::slotNodeToBeRemoved( Node *node )
......@@ -3458,7 +3457,6 @@ QModelIndex NodeItemModel::insertTask( Node *node, Node *after )
QModelIndex NodeItemModel::insertSubtask( Node *node, Node *parent )
{
emit executeCommand( new SubtaskAddCmd( m_project, node, parent, i18nc( "(qtundo-format)", "Add sub-task" ) ) );
reset();
int row = -1;
if ( node->parentNode() ) {
row = node->parentNode()->indexOf( node );
......
......@@ -704,7 +704,6 @@ void TaskEditor::slotAddTask()
Task *t = m_view->project()->createTask( m_view->project()->taskDefaults() );
QModelIndex idx = m_view->baseModel()->insertSubtask( t, m_view->project() );
Q_ASSERT( idx.isValid() );
m_view->setParentsExpanded( idx, true ); // rightview is not automatically expanded
edit( idx );
return;
}
......@@ -727,7 +726,6 @@ void TaskEditor::slotAddMilestone()
t->estimate()->clear();
QModelIndex idx = m_view->baseModel()->insertSubtask( t, m_view->project() );
Q_ASSERT( idx.isValid() );
m_view->setParentsExpanded( idx, true ); // rightview is not automatically expanded
edit( idx );
return;
}
......@@ -739,7 +737,6 @@ void TaskEditor::slotAddMilestone()
t->estimate()->clear();
QModelIndex idx = m_view->baseModel()->insertTask( t, sib );
Q_ASSERT( idx.isValid() );
m_view->setParentsExpanded( idx, true ); // rightview is not automatically expanded
edit( idx );
}
......@@ -758,7 +755,6 @@ void TaskEditor::slotAddSubMilestone()
t->estimate()->clear();
QModelIndex idx = m_view->baseModel()->insertSubtask( t, parent );
Q_ASSERT( idx.isValid() );
m_view->setParentsExpanded( idx, true ); // rightview is not automatically expanded
edit( idx );
}
......@@ -776,20 +772,14 @@ void TaskEditor::slotAddSubtask()
Task *t = m_view->project()->createTask( m_view->project()->taskDefaults() );
QModelIndex idx = m_view->baseModel()->insertSubtask( t, parent );
Q_ASSERT( idx.isValid() );
m_view->setParentsExpanded( idx, true ); // rightview is not automatically expanded
edit( idx );
}
void TaskEditor::edit( QModelIndex i )
{
if ( i.isValid() ) {
if ( m_view->slaveView()->hasFocus() ) {
m_view->masterView()->setFocus();
}
m_view->selectionModel()->select( i, QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect );
QModelIndex p = m_view->model()->parent( i );
m_view->selectionModel()->setCurrentIndex( i, QItemSelectionModel::NoUpdate );
m_view->selectionModel()->setCurrentIndex( i, QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect );
m_view->setParentsExpanded( i, true ); // in case treeview does not have focus
m_view->edit( i );
}
}
......
Supports Markdown
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