author | zecke <zecke> | 2004-06-29 20:04:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-06-29 20:04:17 (UTC) |
commit | c4405f8d22769e9881484d3f7640e4ba87ed75ee (patch) (side-by-side diff) | |
tree | af997b01742c9b7762babca007edf1310c455289 | |
parent | 8bd9d5e9416166a1bb9a3f455ebf73a14628c628 (diff) | |
download | opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.zip opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.gz opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.bz2 |
As pointed out by bradc OpiePlayer2 is not able to open desktop files.
Now we check if it is a valid desktop file and then ask for the DocLnk::file()
and then use that for open.
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6a15134..36f77be 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -266,131 +266,137 @@ void PlayListWidget::addAllToList() { for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } videoView->populateView(); QListViewItemIterator videoIt( videoView ); for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllMusicToList() { audioView->populateView(); QListViewItemIterator audioIt( audioView ); DocLnk lnk; QString filename; // iterate through all items of the listview for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllVideoToList() { videoView->populateView(); QListViewItemIterator videoIt( videoView ); DocLnk lnk; QString filename; for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } -void PlayListWidget::setDocument( const QString& fileref ) { +void PlayListWidget::setDocument( const QString& _fileref ) { // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; + QString fileref = _fileref; fromSetDocument = TRUE; + + DocLnk lnk(_fileref); + if(lnk.isValid()) + fileref = lnk.file(); + QFileInfo fileInfo(fileref); if ( !fileInfo.exists() ) { QMessageBox::warning( this, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); return; } clearList(); QString extension = fileInfo.extension(false); if( extension.find( "m3u", 0, false) != -1 || extension.find( "pls", 0, false) != -1 ) { readListFromFile( fileref ); } else { clearList(); DocLnk lnk; lnk.setName( fileInfo.baseName() ); //sets name lnk.setFile( fileref ); //sets file name addToSelection( lnk ); writeCurrentM3u(); d->setDocumentUsed = TRUE; mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } } void PlayListWidget::useSelectedDocument() { d->setDocumentUsed = FALSE; } const DocLnk *PlayListWidget::current() const { // this is fugly assert( currentTab() == CurrentPlayList ); const DocLnk *lnk = d->selectedFiles->current(); if ( !lnk ) { d->selectedFiles->first(); lnk = d->selectedFiles->current(); } assert( lnk ); return lnk; } bool PlayListWidget::prev() { if ( mediaPlayerState->isShuffled() ) { const DocLnk *cur = current(); int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); for ( int i = 0; i < j; i++ ) { if ( !d->selectedFiles->next() ) d->selectedFiles->first(); } if ( cur == current() ) if ( !d->selectedFiles->next() ) { d->selectedFiles->first(); } return TRUE; } else { if ( !d->selectedFiles->prev() ) { if ( mediaPlayerState->isLooping() ) { return d->selectedFiles->last(); |