diff --git a/src/TomahawkWindow.cpp b/src/TomahawkWindow.cpp index a7625a4ce..962e513a9 100644 --- a/src/TomahawkWindow.cpp +++ b/src/TomahawkWindow.cpp @@ -372,6 +372,9 @@ TomahawkWindow::setupSignals() connect( account->sipPlugin(), SIGNAL( addMenu( QMenu* ) ), this, SLOT( pluginMenuAdded( QMenu* ) ) ); connect( account->sipPlugin(), SIGNAL( removeMenu( QMenu* ) ), this, SLOT( pluginMenuRemoved( QMenu* ) ) ); } + + connect( ViewManager::instance(), SIGNAL( historyBackAvailable( bool ) ), SLOT( onHistoryBackAvailable( bool ) ) ); + connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) ); } @@ -481,6 +484,20 @@ TomahawkWindow::keyPressEvent( QKeyEvent* e ) } +void +TomahawkWindow::onHistoryBackAvailable( bool avail ) +{ + m_backAction->setEnabled( avail ); +} + + +void +TomahawkWindow::onHistoryForwardAvailable( bool avail ) +{ + m_forwardAction->setEnabled( avail ); +} + + void TomahawkWindow::showSettingsDialog() { diff --git a/src/TomahawkWindow.h b/src/TomahawkWindow.h index d489603dd..d0f0cdaa1 100644 --- a/src/TomahawkWindow.h +++ b/src/TomahawkWindow.h @@ -94,6 +94,9 @@ private slots: void onAccountDisconnected(); void onAccountError(); + void onHistoryBackAvailable( bool avail ); + void onHistoryForwardAvailable( bool avail ); + void onAudioEngineError( AudioEngine::AudioErrorCode error ); void onXSPFError( XSPFLoader::XSPFErrorCode error ); diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index dbaa44195..1608141e5 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -633,6 +633,9 @@ ViewManager::setPage( ViewPage* page, bool trackHistory ) m_pageHistory.insert( 0, page ); } + emit historyBackAvailable( m_pageHistory.count() > 1 ); + emit historyForwardAvailable( false ); + qDebug() << "View page shown:" << page->title(); emit viewPageActivated( page ); diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index 0725b75ab..d6e796363 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -137,6 +137,9 @@ signals: void hideQueueRequested(); void tomahawkLoaded(); + + void historyBackAvailable( bool avail ); + void historyForwardAvailable( bool avail ); public slots: Tomahawk::ViewPage* showSuperCollection();