diff --git a/src/libtomahawk/Source.cpp b/src/libtomahawk/Source.cpp index 26e15dd40..db331385f 100644 --- a/src/libtomahawk/Source.cpp +++ b/src/libtomahawk/Source.cpp @@ -59,10 +59,7 @@ Source::Source( int id, const QString& username ) m_scrubFriendlyName = qApp->arguments().contains( "--demo" ); if ( id == 0 ) - { m_isLocal = true; - m_online = true; - } m_currentTrackTimer.setSingleShot( true ); connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) ); @@ -524,3 +521,26 @@ Source::updateIndexWhenSynced() { m_updateIndexWhenSynced = true; } + + +QString +Source::textStatus() const +{ + if ( !m_textStatus.isEmpty() ) + return m_textStatus; + + if ( !currentTrack().isNull() ) + { + return currentTrack()->artist() + " - " + currentTrack()->track(); + } + + // do not use isOnline() here - it will always return true for the local source + if ( m_online ) + { + return tr( "Online" ); + } + else + { + return tr( "Offline" ); + } +} diff --git a/src/libtomahawk/Source.h b/src/libtomahawk/Source.h index 883b605dc..bd463ae2a 100644 --- a/src/libtomahawk/Source.h +++ b/src/libtomahawk/Source.h @@ -58,7 +58,7 @@ public: virtual ~Source(); bool isLocal() const { return m_isLocal; } - bool isOnline() const { return m_online; } + bool isOnline() const { return m_online || m_isLocal; } QString userName() const { return m_username; } QString friendlyName() const; @@ -83,7 +83,7 @@ public: unsigned int trackCount() const; Tomahawk::query_ptr currentTrack() const { return m_currentTrack; } - QString textStatus() const { return m_textStatus; } + QString textStatus() const; DBSyncConnection::State state() const { return m_state; } Tomahawk::playlistinterface_ptr playlistInterface();