-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 0825eed..60eb0c8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -511,39 +511,46 @@ void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { switch ( whichList()) { case 1: { QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it->text(0)) { - if(QFileInfo( dit.current()->file()).exists()) + if(QFileInfo( dit.current()->file()).exists()) { d->selectedFiles->addToSelection( **dit ); + qDebug("blah "+ dit.current()->name()); + d->selectedFiles->setSelectedItem( dit.current()->name()); + } } } writeCurrentM3u(); } break; case 2: { QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it->text(0)) { - if( QFileInfo( dit.current()->file()).exists() ) + if( QFileInfo( dit.current()->file()).exists() ) { d->selectedFiles->addToSelection( **dit ); + qDebug("blah "+ dit.current()->name()); + d->selectedFiles->setSelectedItem( dit.current()->name()); + } } } writeCurrentM3u(); } break; case 0: break; }; tabWidget->setCurrentPage(0); + } } void PlayListWidget::tabChanged(QWidget *) { switch ( whichList()) { case 0: @@ -740,27 +747,29 @@ void PlayListWidget::openFile() { // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); lnk.setName( filename ); //sets name lnk.setFile( filename ); //sets file name // lnk.setIcon("opieplayer2/musicfile"); d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); + d->selectedFiles->setSelectedItem( lnk->name()); } else if( filename.right( 3) == "m3u" ) { readm3u( filename ); } else if( filename.right(3) == "pls" ) { readPls( filename ); } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); + d->selectedFiles->setSelectedItem( lnk.name()); } } if( fileDlg ) { delete fileDlg; } } @@ -881,16 +890,17 @@ void PlayListWidget::writeCurrentM3u() { } while ( d->selectedFiles->next() ); qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); m3uList->write(); m3uList->close(); if(m3uList) delete m3uList; } + } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { InputDialog *fileDlg; fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); fileDlg->exec(); |