author | llornkcor <llornkcor> | 2002-10-10 01:20:36 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-10 01:20:36 (UTC) |
commit | 2cbc91d6aff15c931426f3c835b5126c7da3ba2b (patch) (unidiff) | |
tree | 65d6cf3c96306ccbb55c44c5d21af3777835b134 /noncore/multimedia/opieplayer2/playlistwidget.cpp | |
parent | 41aaa97e19b29f96fced9013a707cc6d16bc2143 (diff) | |
download | opie-2cbc91d6aff15c931426f3c835b5126c7da3ba2b.zip opie-2cbc91d6aff15c931426f3c835b5126c7da3ba2b.tar.gz opie-2cbc91d6aff15c931426f3c835b5126c7da3ba2b.tar.bz2 |
other crash fixes
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index e28efd0..f9192e8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -185,19 +185,21 @@ void PlayListWidget::writeDefaultPlaylist() { | |||
185 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 185 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
186 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 186 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
187 | if( currentString == filename) { | 187 | if( currentString == filename) { |
188 | Om3u *m3uList; | 188 | Om3u *m3uList; |
189 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 189 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
190 | if( d->selectedFiles->first() ) { | ||
190 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 191 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
191 | d->selectedFiles->first(); | ||
192 | do { | 192 | do { |
193 | // qDebug(d->selectedFiles->current()->file()); | 193 | // qDebug(d->selectedFiles->current()->file()); |
194 | m3uList->add( d->selectedFiles->current()->file() ); | 194 | m3uList->add( d->selectedFiles->current()->file() ); |
195 | } | 195 | } |
196 | while ( d->selectedFiles->next() ); | 196 | while ( d->selectedFiles->next() ); |
197 | 197 | ||
198 | m3uList->write(); | 198 | m3uList->write(); |
199 | m3uList->close(); | 199 | m3uList->close(); |
200 | if(m3uList) delete m3uList; | 200 | if(m3uList) delete m3uList; |
201 | |||
202 | } | ||
201 | } | 203 | } |
202 | } | 204 | } |
203 | 205 | ||
@@ -853,9 +855,11 @@ void PlayListWidget::writeCurrentM3u() { | |||
853 | cfg.setGroup("PlayList"); | 855 | cfg.setGroup("PlayList"); |
854 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 856 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
855 | 857 | ||
858 | if( d->selectedFiles->first()) { | ||
856 | Om3u *m3uList; | 859 | Om3u *m3uList; |
857 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 860 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
858 | d->selectedFiles->first(); | 861 | |
862 | |||
859 | qDebug( d->selectedFiles->current()->file()); | 863 | qDebug( d->selectedFiles->current()->file()); |
860 | do { | 864 | do { |
861 | qDebug( d->selectedFiles->current()->file()); | 865 | qDebug( d->selectedFiles->current()->file()); |
@@ -867,6 +871,7 @@ void PlayListWidget::writeCurrentM3u() { | |||
867 | m3uList->close(); | 871 | m3uList->close(); |
868 | 872 | ||
869 | if(m3uList) delete m3uList; | 873 | if(m3uList) delete m3uList; |
874 | } | ||
870 | } | 875 | } |
871 | 876 | ||
872 | /* | 877 | /* |
@@ -890,40 +895,39 @@ void PlayListWidget::writem3u() { | |||
890 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 895 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
891 | } | 896 | } |
892 | 897 | ||
898 | if( d->selectedFiles->first()) { | ||
893 | m3uList = new Om3u(filename, IO_ReadWrite); | 899 | m3uList = new Om3u(filename, IO_ReadWrite); |
894 | |||
895 | d->selectedFiles->first(); | ||
896 | 900 | ||
897 | do { | 901 | do { |
898 | m3uList->add( d->selectedFiles->current()->file()); | 902 | m3uList->add( d->selectedFiles->current()->file()); |
899 | } | 903 | } |
900 | while ( d->selectedFiles->next() ); | 904 | while ( d->selectedFiles->next() ); |
901 | // qDebug( list ); | 905 | // qDebug( list ); |
902 | m3uList->write(); | 906 | m3uList->write(); |
903 | m3uList->close(); | 907 | m3uList->close(); |
904 | if(m3uList) delete m3uList; | 908 | if(m3uList) delete m3uList; |
905 | 909 | ||
906 | if(fileDlg) delete fileDlg; | 910 | if(fileDlg) delete fileDlg; |
907 | 911 | ||
908 | DocLnk lnk; | 912 | DocLnk lnk; |
909 | lnk.setFile( filename); | 913 | lnk.setFile( filename); |
910 | lnk.setIcon("opieplayer2/playlist2"); | 914 | lnk.setIcon("opieplayer2/playlist2"); |
911 | lnk.setName( name); //sets file name | 915 | lnk.setName( name); //sets file name |
912 | 916 | ||
913 | // qDebug(filename); | 917 | // qDebug(filename); |
914 | Config config( "OpiePlayer" ); | 918 | Config config( "OpiePlayer" ); |
915 | config.setGroup( "PlayList" ); | 919 | config.setGroup( "PlayList" ); |
916 | 920 | ||
917 | config.writeEntry("CurrentPlaylist",filename); | 921 | config.writeEntry("CurrentPlaylist",filename); |
918 | currentPlayList=filename; | 922 | currentPlayList=filename; |
919 | 923 | ||
920 | if(!lnk.writeLink()) { | 924 | if(!lnk.writeLink()) { |
921 | qDebug("Writing doclink did not work"); | 925 | qDebug("Writing doclink did not work"); |
922 | } | 926 | } |
923 | 927 | ||
924 | setCaption(tr("OpiePlayer: ") + name); | 928 | setCaption(tr("OpiePlayer: ") + name); |
929 | } | ||
925 | } | 930 | } |
926 | |||
927 | } | 931 | } |
928 | 932 | ||
929 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 933 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |