summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index cc4be23..c0d3108 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -494,13 +494,13 @@ void PlayListWidget::playIt( QListViewItem *it) {
494 d->selectedFiles->unSelect(); 494 d->selectedFiles->unSelect();
495} 495}
496 496
497 497
498void PlayListWidget::addToSelection( QListViewItem *it) { 498void PlayListWidget::addToSelection( QListViewItem *it) {
499 d->setDocumentUsed = FALSE; 499 d->setDocumentUsed = FALSE;
500 qDebug("addToSelection2"); 500
501 if(it) { 501 if(it) {
502 switch ( whichList()) { 502 switch ( whichList()) {
503 case 1: { 503 case 1: {
504 QListIterator<DocLnk> dit( files.children() ); 504 QListIterator<DocLnk> dit( files.children() );
505 for ( ; dit.current(); ++dit ) { 505 for ( ; dit.current(); ++dit ) {
506 if( dit.current()->name() == it->text(0)) { 506 if( dit.current()->name() == it->text(0)) {
@@ -720,36 +720,27 @@ void PlayListWidget::openFile() {
720 m3uFile=filename; 720 m3uFile=filename;
721 m3uFile = m3uFile.right( m3uFile.length() - 7); 721 m3uFile = m3uFile.right( m3uFile.length() - 7);
722 } else{ 722 } else{
723 m3uFile=filename; 723 m3uFile=filename;
724 } 724 }
725 725
726 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 726// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
727 m3uList = new Om3u( cfg.readEntry("CurrentPlaylist",""), IO_Append | IO_ReadWrite );
728 m3uList->add( filename);
729 m3uList->write();
730 m3uList->close();
731 if(m3uList) delete m3uList;
732 lnk.setName( filename ); //sets name 727 lnk.setName( filename ); //sets name
733 lnk.setFile( filename ); //sets file name 728 lnk.setFile( filename ); //sets file name
734 lnk.setIcon("opieplayer2/musicfile"); 729 lnk.setIcon("opieplayer2/musicfile");
735 d->selectedFiles->addToSelection( lnk ); 730 d->selectedFiles->addToSelection( lnk );
731 writeCurrentM3u();
736 } 732 }
737 else if( filename.right( 3) == "m3u" ) { 733 else if( filename.right( 3) == "m3u" ) {
738 readm3u( filename ); 734 readm3u( filename );
739 735
740 } else if( filename.right(3) == "pls" ) { 736 } else if( filename.right(3) == "pls" ) {
741 readPls( filename ); 737 readPls( filename );
742 } 738 } else {
743 else {
744 m3uList = new Om3u( cfg.readEntry("CurrentPlaylist",""), IO_Append | IO_ReadWrite );
745 m3uList->add( filename);
746 m3uList->write();
747 m3uList->close();
748 if(m3uList) delete m3uList;
749 d->selectedFiles->addToSelection( DocLnk(filename) ); 739 d->selectedFiles->addToSelection( DocLnk(filename) );
740 writeCurrentM3u();
750 } 741 }
751 } 742 }
752 743
753 if( fileDlg ) { 744 if( fileDlg ) {
754 delete fileDlg; 745 delete fileDlg;
755 } 746 }
@@ -846,26 +837,26 @@ void PlayListWidget::readPls( const QString &filename ) {
846 if(m3uList) delete m3uList; 837 if(m3uList) delete m3uList;
847} 838}
848 839
849/* 840/*
850 writes current playlist to current m3u file */ 841 writes current playlist to current m3u file */
851void PlayListWidget::writeCurrentM3u() { 842void PlayListWidget::writeCurrentM3u() {
852 qDebug("writting to current m3u"); 843 qDebug("writing to current m3u");
853 Config cfg( "OpiePlayer" ); 844 Config cfg( "OpiePlayer" );
854 cfg.setGroup("PlayList"); 845 cfg.setGroup("PlayList");
855 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 846 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
856 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 847 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
857 Om3u *m3uList; 848 Om3u *m3uList;
858 m3uList = new Om3u( currentPlaylist, IO_ReadWrite |IO_Truncate ); 849 m3uList = new Om3u( currentPlaylist, IO_ReadWrite |IO_Truncate );
859 d->selectedFiles->first(); 850 d->selectedFiles->first();
860 851
861 do { 852 do {
862 m3uList->add( d->selectedFiles->current()->file()); 853 m3uList->add( d->selectedFiles->current()->file());
863 } 854 }
864 while ( d->selectedFiles->next() ); 855 while ( d->selectedFiles->next() );
865 // qDebug( list ); 856// qDebug( list );
866 m3uList->write(); 857 m3uList->write();
867 m3uList->close(); 858 m3uList->close();
868 859
869 if(m3uList) delete m3uList; 860 if(m3uList) delete m3uList;
870} 861}
871 862
@@ -877,13 +868,13 @@ void PlayListWidget::writem3u() {
877 fileDlg->exec(); 868 fileDlg->exec();
878 QString name, filename, list; 869 QString name, filename, list;
879 Om3u *m3uList; 870 Om3u *m3uList;
880 871
881 if( fileDlg->result() == 1 ) { 872 if( fileDlg->result() == 1 ) {
882 name = fileDlg->text(); 873 name = fileDlg->text();
883 qDebug( filename ); 874// qDebug( filename );
884 875
885 if( name.left( 1) != "/" ) { 876 if( name.left( 1) != "/" ) {
886 filename = QPEApplication::documentDir() + "/" + name; 877 filename = QPEApplication::documentDir() + "/" + name;
887 } 878 }
888 879
889 if( name.right( 3 ) != "m3u" ) { 880 if( name.right( 3 ) != "m3u" ) {