Commit 1553c0b7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Backport: fix from sergio

kaddressbook: Fix checking new collections when they are created.

This wasn't working properly for collections with children.
When a new row+children is inserted we only get the row insertion
signal for the parent, not for the children, which must me iterated manually.
parent 07652c9c
......@@ -1029,12 +1029,18 @@ Akonadi::EntityTreeModel *MainWidget::entityTreeModel() const
void MainWidget::slotCheckNewCalendar(const QModelIndex &parent, int begin, int end)
{
// HACK: Check newly created calendars
if ( begin < end ) {
return;
}
Akonadi::EntityTreeModel *etm = entityTreeModel();
if (etm && etm->isCollectionTreeFetched()) {
for (int row = begin; row <= end; ++row) {
QModelIndex index = mCollectionView->model()->index(row, 0, parent);
if (index.isValid()) {
mCollectionView->model()->setData(index, Qt::Checked, Qt::CheckStateRole);
QModelIndex index = model->index( row, 0, parent );
if ( index.isValid() ) {
model->setData( index, Qt::Checked, Qt::CheckStateRole );
slotCheckNewCalendar( index, 0, model->rowCount(index) - 1 );
}
}
if (parent.isValid()) {
......
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