From 7ea0de753e7797716fb3f1d839798bfd1399e011 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 31 Jul 2011 19:46:24 -0400 Subject: [PATCH] remove empty Playlists or Stations entry if all are deleted from peers --- src/sourcetree/items/collectionitem.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sourcetree/items/collectionitem.cpp b/src/sourcetree/items/collectionitem.cpp index 7f034a0ce..6cbc7c156 100644 --- a/src/sourcetree/items/collectionitem.cpp +++ b/src/sourcetree/items/collectionitem.cpp @@ -192,6 +192,14 @@ CollectionItem::playlistDeletedInternal( SourceTreeItem* parent, const T& p ) break; } } + + if( parent->children().isEmpty() && parent->parent() ) // Don't leave an empty Playlist or Station category + { + int idx = parent->parent()->children().indexOf( parent ); + parent->parent()->beginRowsRemoved( idx, idx ); + parent->parent()->removeChild( parent ); + parent->parent()->endRowsRemoved(); + } }