summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 83eb83b..98326a8 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -745,48 +745,54 @@ void PlayListWidget::openFile() {
745 setButtons(); 745 setButtons();
746} 746}
747 747
748void PlayListWidget::openDirectory() { 748void PlayListWidget::openDirectory() {
749 QString str = OFileDialog::getDirectory( OFileSelector::DirectorySelector, 749 QString str = OFileDialog::getDirectory( OFileSelector::DirectorySelector,
750 QString::null, 0, 750 QString::null, 0,
751 tr( "Add Files from Directory")); 751 tr( "Add Files from Directory"));
752 752
753 if(str.isEmpty() ) 753 if(str.isEmpty() )
754 return; 754 return;
755 755
756 if(str.left(2) == "//") str=str.right(str.length()-1); 756 if(str.left(2) == "//") str=str.right(str.length()-1);
757 QDir dir( str ); 757 QDir dir( str );
758 QStringList lst = dir.entryList(QDir::Files|QDir::Readable); 758 QStringList lst = dir.entryList(QDir::Files|QDir::Readable);
759 759
760 for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 760 for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
761 QString filename = str + "/" + *it; 761 QString filename = str + "/" + *it;
762 762
763 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) 763 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" )
764 readListFromFile( filename ); 764 readListFromFile( filename );
765 else { 765 else {
766 addFileToPlaylist( filename, QFileInfo(*it).baseName() ); 766 addFileToPlaylist( filename, QFileInfo(*it).baseName() );
767 } 767 }
768 } 768 }
769
770 if (!d->selectedFiles->isEmpty()) {
771 d->selectedFiles->first();
772
773 setButtons();
774 }
769} 775}
770 776
771void PlayListWidget::readListFromFile( const QString &filename ) { 777void PlayListWidget::readListFromFile( const QString &filename ) {
772 odebug << "read list filename " + filename << oendl; 778 odebug << "read list filename " + filename << oendl;
773 QFileInfo fi(filename); 779 QFileInfo fi(filename);
774 Om3u *m3uList; 780 Om3u *m3uList;
775 QString s, name; 781 QString s, name;
776 m3uList = new Om3u( filename, IO_ReadOnly ); 782 m3uList = new Om3u( filename, IO_ReadOnly );
777 if(fi.extension(false).find("m3u",0,false) != -1 ) 783 if(fi.extension(false).find("m3u",0,false) != -1 )
778 m3uList->readM3u(); 784 m3uList->readM3u();
779 else if(fi.extension(false).find("pls",0,false) != -1 ) 785 else if(fi.extension(false).find("pls",0,false) != -1 )
780 m3uList->readPls(); 786 m3uList->readPls();
781 787
782 DocLnk lnk; 788 DocLnk lnk;
783 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 789 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
784 s = *it; 790 s = *it;
785 // odebug << s << oendl; 791 // odebug << s << oendl;
786 if(s.left(4)=="http") { 792 if(s.left(4)=="http") {
787 lnk.setName( s ); //sets file name 793 lnk.setName( s ); //sets file name
788 lnk.setIcon("opieplayer2/musicfile"); 794 lnk.setIcon("opieplayer2/musicfile");
789 lnk.setFile( s ); //sets file name 795 lnk.setFile( s ); //sets file name
790 796
791 } else { //is file 797 } else { //is file
792 lnk.setName( QFileInfo(s).baseName()); 798 lnk.setName( QFileInfo(s).baseName());