SVN commit 1213471 by skelly: Remove the top-level search collection when there are no more search collections. I'm still not convinced this is the right way to do this, but it's at least a partial bug fix. This reverts commit 1203272 M +15 -0 entitytreemodel_p.cpp --- trunk/KDE/kdepimlibs/akonadi/entitytreemodel_p.cpp #1213470:1213471 @@ -724,6 +724,21 @@ const QModelIndex parentIndex = indexForCollection( m_collections.value( parentId ) ); + // Top-level search collection + if ( parentId == 1 && m_childEntities.value( parentId ).size() == 1 && row == 0 ) { + // Special case for removing the last search folder. + // We need to remove the top-level search folder in that case. + const int searchCollectionRow = parentIndex.row(); + q->beginRemoveRows( QModelIndex(), searchCollectionRow, searchCollectionRow ); + + removeChildEntities( parentId ); + m_childEntities[ m_rootCollection.id() ].removeAt( searchCollectionRow ); + m_collections.remove( parentId ); + + q->endRemoveRows(); + return; + } + q->beginRemoveRows( parentIndex, row, row ); // Delete all descendant collections and items.