author | llornkcor <llornkcor> | 2002-11-10 17:11:25 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-10 17:11:25 (UTC) |
commit | 8b6c9588bc499d1c37a0ecf65f59de129b3924e3 (patch) (side-by-side diff) | |
tree | 147dfeb0a09120d8e631ce6e11e0281a18d5c422 | |
parent | 8394ee8e5fc0014605256b243909709864afdc9b (diff) | |
download | opie-8b6c9588bc499d1c37a0ecf65f59de129b3924e3.zip opie-8b6c9588bc499d1c37a0ecf65f59de129b3924e3.tar.gz opie-8b6c9588bc499d1c37a0ecf65f59de129b3924e3.tar.bz2 |
should be selected after adding file
-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 @@ -503,55 +503,62 @@ void PlayListWidget::playIt( QListViewItem *it) { if(!it) return; mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); d->selectedFiles->unSelect(); } 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: { if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(TRUE); d->tbAddToList->setEnabled(FALSE); } break; @@ -732,43 +739,45 @@ void PlayListWidget::openFile() { m3uFile = m3uFile.right( 7); } else if(filename.left(4) == "http"){ m3uFile=filename; m3uFile = m3uFile.right( m3uFile.length() - 7); } else{ m3uFile=filename; } // 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; } } /* reads m3u and shows files/urls to playlist widget */ void PlayListWidget::readm3u( const QString &filename ) { qDebug( "read m3u filename " + filename ); Om3u *m3uList; QString s, name; m3uList = new Om3u( filename, IO_ReadOnly ); @@ -873,32 +882,33 @@ void PlayListWidget::writeCurrentM3u() { Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); if( d->selectedFiles->first()) { do { qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); } 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(); QString name, filename, list; Om3u *m3uList; if( fileDlg->result() == 1 ) { name = fileDlg->text(); // qDebug( filename ); if( name.left( 1) != "/" ) { |