-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index e33998f..612fd45 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -324,8 +324,10 @@ void PlayListWidget::readConfig( Config& cfg ) { QString linkFile = cfg.readEntry( entryName ); - DocLnk lnk( linkFile ); - if ( lnk.isValid() ) { - d->selectedFiles->addToSelection( lnk ); + if(QFileInfo( linkFile).exists() ) { + DocLnk lnk( linkFile ); + if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { + d->selectedFiles->addToSelection( lnk ); + } } } - d->selectedFiles->setSelectedItem( currentString); +d->selectedFiles->setSelectedItem( currentString); } @@ -653,3 +655,4 @@ void PlayListWidget::addSelected() { if( dit.current()->name() == it.current()->text(0) ) { - d->selectedFiles->addToSelection( **dit ); + if(QFileInfo( dit.current()->file()).exists()) + d->selectedFiles->addToSelection( **dit ); } @@ -670,3 +673,4 @@ void PlayListWidget::addSelected() { if( dit.current()->name() == it.current()->text(0) ) { - d->selectedFiles->addToSelection( **dit ); + if(QFileInfo( dit.current()->file()).exists()) + d->selectedFiles->addToSelection( **dit ); } @@ -703,3 +707,4 @@ void PlayListWidget::addToSelection( QListViewItem *it) { if( dit.current()->name() == it->text(0)) { - d->selectedFiles->addToSelection( **dit ); + if(QFileInfo( dit.current()->file()).exists()) + d->selectedFiles->addToSelection( **dit ); } @@ -712,3 +717,4 @@ void PlayListWidget::addToSelection( QListViewItem *it) { if( dit.current()->name() == it->text(0)) { - d->selectedFiles->addToSelection( **dit ); + if(QFileInfo( dit.current()->file()).exists()) + d->selectedFiles->addToSelection( **dit ); } @@ -1113,12 +1119,14 @@ void PlayListWidget::readm3u(const QString &filename) { s=s.right(s.length()-2); - DocLnk lnk( s ); - QFileInfo f(s); - QString name = f.baseName(); - name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); - lnk.setName( name ); - s=s.replace( QRegExp("\\"),"/"); - lnk.setFile( s ); - lnk.writeLink(); - qDebug("add "+name); - d->selectedFiles->addToSelection( lnk); + if(QFile(s).exists()) { + DocLnk lnk( s ); + QFileInfo f(s); + QString name = f.baseName(); + name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); + lnk.setName( name ); + s=s.replace( QRegExp("\\"),"/"); + lnk.setFile( s ); + lnk.writeLink(); + qDebug("add "+name); + d->selectedFiles->addToSelection( lnk); + } } else { // is url |