-rw-r--r-- | noncore/multimedia/opieplayer2/playlistselection.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistselection.h b/noncore/multimedia/opieplayer2/playlistselection.h index d10bc82..9cc4e30 100644 --- a/noncore/multimedia/opieplayer2/playlistselection.h +++ b/noncore/multimedia/opieplayer2/playlistselection.h @@ -44,8 +44,10 @@ public slots: bool next(); bool first(); bool last(); + bool isEmpty() const { return childCount() == 0; } + protected: virtual void contentsMouseMoveEvent(QMouseEvent *); /* #ifdef USE_PLAYLIST_BACKGROUND */ virtual void drawBackground( QPainter *p, const QRect &r ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index f53def6..b08204e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -417,9 +417,15 @@ void PlayListWidget::useSelectedDocument() { const DocLnk *PlayListWidget::current() const { // this is fugly assert( currentTab() == CurrentPlayList ); - return d->selectedFiles->current(); + const DocLnk *lnk = d->selectedFiles->current(); + if ( !lnk ) { + d->selectedFiles->first(); + lnk = d->selectedFiles->current(); + } + assert( lnk ); + return lnk; } bool PlayListWidget::prev() { @@ -563,8 +569,10 @@ void PlayListWidget::tabChanged(QWidget *) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(TRUE); d->tbAddToList->setEnabled(FALSE); + + d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); } break; case AudioFiles: { |