From 12ac4079b1b02ce03e12b273917b52635ec73cb8 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 28 May 2011 17:10:27 -0400 Subject: [PATCH] activate current page in the sourcetree if new playlist dialog is cancelled --- src/sourcetree/items/categoryitems.cpp | 6 ++++-- src/sourcetree/sourcesmodel.cpp | 3 ++- src/sourcetree/sourcesmodel.h | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/sourcetree/items/categoryitems.cpp b/src/sourcetree/items/categoryitems.cpp index c51a92748..82064636e 100644 --- a/src/sourcetree/items/categoryitems.cpp +++ b/src/sourcetree/items/categoryitems.cpp @@ -78,6 +78,8 @@ CategoryAddItem::activate() // create Auto Playlist QString playlistName = playlistSelectorDlg.playlistName(); APP->mainWindow()->createAutomaticPlaylist( playlistName ); + } else if ( !successfulReturn ) { + model()->viewPageActivated( ViewManager::instance()->currentPage() ); } break; @@ -233,6 +235,6 @@ CategoryItem::activate() { if( m_category == SourcesModel::StationsCategory ) { // TODO activate stations page - } - + } + } diff --git a/src/sourcetree/sourcesmodel.cpp b/src/sourcetree/sourcesmodel.cpp index 9bc01f52c..b72f75613 100644 --- a/src/sourcetree/sourcesmodel.cpp +++ b/src/sourcetree/sourcesmodel.cpp @@ -30,11 +30,13 @@ #include #include +#include using namespace Tomahawk; SourcesModel::SourcesModel( QObject* parent ) : QAbstractItemModel( parent ) + , m_rootItem( 0 ) , m_viewPageDelayedCacheItem( 0 ) { m_rootItem = new SourceTreeItem( this, 0, Invalid ); @@ -389,7 +391,6 @@ SourcesModel::linkSourceItemToPage( SourceTreeItem* item, ViewPage* p ) m_viewPageDelayedCacheItem = 0; } - SourceTreeItem* SourcesModel::itemFromIndex( const QModelIndex& idx ) const { diff --git a/src/sourcetree/sourcesmodel.h b/src/sourcetree/sourcesmodel.h index 0ea3579e5..5455da673 100644 --- a/src/sourcetree/sourcesmodel.h +++ b/src/sourcetree/sourcesmodel.h @@ -90,16 +90,6 @@ public: QModelIndex indexFromItem( SourceTreeItem* item ) const; -signals: - void selectRequest( const QModelIndex& idx ); - -private slots: - void onSourcesAdded( const QList& sources ); - void onSourceAdded( const Tomahawk::source_ptr& source ); - void onSourceRemoved( const Tomahawk::source_ptr& source ); - - void viewPageActivated( Tomahawk::ViewPage* ); - public slots: void loadSources(); @@ -108,6 +98,17 @@ public slots: void onItemRowsAddedDone(); void onItemRowsRemovedBegin( int first, int last ); void onItemRowsRemovedDone(); + + void viewPageActivated( Tomahawk::ViewPage* ); + +signals: + void selectRequest( const QModelIndex& idx ); + +private slots: + void onSourcesAdded( const QList& sources ); + void onSourceAdded( const Tomahawk::source_ptr& source ); + void onSourceRemoved( const Tomahawk::source_ptr& source ); + private: SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const; int rowForItem( SourceTreeItem* item ) const;