author | llornkcor <llornkcor> | 2002-12-16 03:24:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-16 03:24:09 (UTC) |
commit | ffefde3701c0aed084872d05710d78b7201efaa8 (patch) (side-by-side diff) | |
tree | 735f2fe5e07792685234b6b84011bdfdb4928365 | |
parent | 64bc40080abc56e6bd804dadb44d2510f25f2efa (diff) | |
download | opie-ffefde3701c0aed084872d05710d78b7201efaa8.zip opie-ffefde3701c0aed084872d05710d78b7201efaa8.tar.gz opie-ffefde3701c0aed084872d05710d78b7201efaa8.tar.bz2 |
fix writng m3u filenames when user specifies a directory
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6e2457f..707f4d2 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -818,37 +818,38 @@ void PlayListWidget::readListFromFile( const QString &filename ) { /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { InputDialog *fileDlg; fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); fileDlg->exec(); QString name, filename, list; Om3u *m3uList; if( fileDlg->result() == 1 ) { name = fileDlg->text(); // qDebug( filename ); - - if( name.left( 1) != "/" ) { - filename = QPEApplication::documentDir() + "/" + name; - } - - if( name.right( 3 ) != "m3u" ) { - filename = QPEApplication::documentDir() + "/" +name+".m3u"; + if( name.find("/",0,true) != -1) {// assume they specify a file path + filename = name; + name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); } + else //otherwise dump it somewhere noticable + filename = QPEApplication::documentDir() + "/" + name; - if( d->selectedFiles->first()) { - m3uList = new Om3u(filename, IO_ReadWrite); + if( filename.right( 3 ) != "m3u" ) //needs filename extension + filename += ".m3u"; + + if( d->selectedFiles->first()) { //ramble through playlist view + m3uList = new Om3u( filename, IO_ReadWrite); - do { + do { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); // qDebug( list ); m3uList->write(); m3uList->close(); delete m3uList; delete fileDlg; DocLnk lnk; lnk.setFile( filename); |