Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 35 |
1 files changed, 27 insertions, 8 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 @@ -416,6 +416,11 @@ void PlayListWidget::writeConfig( Config& cfg ) const { void PlayListWidget::addToSelection( const DocLnk& lnk ) { // qDebug("add"); + 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" ) @@ -424,6 +429,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { else mediaPlayerState->setPlaying( TRUE ); } +} void PlayListWidget::clearList() { @@ -846,9 +852,14 @@ void PlayListWidget::btnPlay(bool b) { switch ( tabWidget->currentPageIndex()) { case 0: { + 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: { @@ -858,8 +869,7 @@ void PlayListWidget::btnPlay(bool b) { tabWidget->setCurrentPage(1); d->selectedFiles->unSelect(); insanityBool=FALSE; -// audioView->clearSelection(); - } + }// audioView->clearSelection(); break; case 2: { @@ -870,10 +880,10 @@ void PlayListWidget::btnPlay(bool b) { tabWidget->setCurrentPage(2); d->selectedFiles->unSelect(); insanityBool=FALSE; -// videoView->clearSelection(); - } + }// videoView->clearSelection(); break; }; + } void PlayListWidget::deletePlaylist() { @@ -1068,8 +1078,11 @@ void PlayListWidget::openFile() { filename = fileDlg->LineEdit1->text(); // http://205.188.234.129:8030 // http://66.28.68.70:8000 - filename.replace(QRegExp("%20")," "); - +// 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); @@ -1094,6 +1107,7 @@ void PlayListWidget::openFile() { // delete fileDlg2; } } + } if(fileDlg) delete fileDlg; } @@ -1205,7 +1219,10 @@ void PlayListWidget::readm3u(const QString &filename) { while ( !t.atEnd()) { // 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:") { s=s.right(s.length()-2); @@ -1220,6 +1237,7 @@ void PlayListWidget::readm3u(const QString &filename) { qDebug("add "+name); d->selectedFiles->addToSelection( lnk); } else { // is url + s.replace(QRegExp("%20")," "); DocLnk lnk( s); QString name = s.right( s.length() - 7); @@ -1238,6 +1256,7 @@ void PlayListWidget::readm3u(const QString &filename) { } } } + f.close(); } void PlayListWidget::writem3u(const QString &filename) { |