-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 41fcb30..2323ac2 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -417,11 +417,17 @@ void PlayListWidget::writeConfig( Config& cfg ) const { void PlayListWidget::addToSelection( const DocLnk& lnk ) { // qDebug("add"); - d->setDocumentUsed = FALSE; - if ( mediaPlayerState->playlist() ) { - if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) - d->selectedFiles->addToSelection( lnk ); + if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","You are trying to play\na malformed url."); + + } else { + + d->setDocumentUsed = FALSE; + if ( mediaPlayerState->playlist() ) { + if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) + d->selectedFiles->addToSelection( lnk ); + } + else + mediaPlayerState->setPlaying( TRUE ); } - else - mediaPlayerState->setPlaying( TRUE ); } @@ -847,32 +853,36 @@ void PlayListWidget::btnPlay(bool b) { case 0: { - - mediaPlayerState->setPlaying(b); - } + qDebug("here we are"); + if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","You are trying to play\na malformed url."); + + } else { + + mediaPlayerState->setPlaying(b); + } } break; case 1: { - addToSelection( audioView->currentItem() ); - mediaPlayerState->setPlaying(b); - d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(1); - d->selectedFiles->unSelect(); - insanityBool=FALSE; -// audioView->clearSelection(); - } + addToSelection( audioView->currentItem() ); + mediaPlayerState->setPlaying(b); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(1); + d->selectedFiles->unSelect(); + insanityBool=FALSE; + }// audioView->clearSelection(); break; case 2: { - addToSelection( videoView->currentItem() ); - mediaPlayerState->setPlaying(b); - qApp->processEvents(); - d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(2); - d->selectedFiles->unSelect(); - insanityBool=FALSE; -// videoView->clearSelection(); - } + addToSelection( videoView->currentItem() ); + mediaPlayerState->setPlaying(b); + qApp->processEvents(); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(2); + d->selectedFiles->unSelect(); + insanityBool=FALSE; + }// videoView->clearSelection(); break; }; + } @@ -1069,7 +1079,10 @@ void PlayListWidget::openFile() { // http://205.188.234.129:8030 // http://66.28.68.70:8000 - filename.replace(QRegExp("%20")," "); - - qDebug("Selected filename is "+filename); +// filename.replace(QRegExp("%20")," "); + if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","Spaces in urls are not allowed."); + return; + } else { + qDebug("Selected filename is "+filename); if(filename.right(3) == "m3u") readm3u( filename); @@ -1095,4 +1108,5 @@ void PlayListWidget::openFile() { } } + } if(fileDlg) delete fileDlg; @@ -1206,5 +1220,8 @@ void PlayListWidget::readm3u(const QString &filename) { // Lview->insertLine(t.readLine(),-1); s=t.readLine(); - if(s.find("#",0,TRUE) == -1) { + if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","Spaces in urls are not allowed."); + } + else if(s.find("#",0,TRUE) == -1) { if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat if(s.left(2) == "E:" || s.left(2) == "P:") { @@ -1221,4 +1238,5 @@ void PlayListWidget::readm3u(const QString &filename) { d->selectedFiles->addToSelection( lnk); } else { // is url + s.replace(QRegExp("%20")," "); DocLnk lnk( s); @@ -1239,4 +1257,5 @@ void PlayListWidget::readm3u(const QString &filename) { } } + f.close(); } |