-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 14 |
2 files changed, 13 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 0be727b..039f3b1 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp @@ -51,13 +51,7 @@ Om3u::Om3u( const QString &filePath, int mode) : QStringList (){ -//filePath is path name to m3u //qDebug("<<<<<<<new m3u "+filePath); f.setName(filePath); -// if(f.exists()) -// f.open( IO_ReadWrite); -// else -// f.open( IO_ReadWrite | IO_Truncate); f.open(mode); - } @@ -133,4 +127,5 @@ void Om3u::readPls() { //it's a pls file void Om3u::write() { //writes list to m3u file QString list; + if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { qDebug(*it); @@ -138,4 +133,5 @@ void Om3u::write() { //writes list to m3u file } f.writeBlock( list, list.length() ); + } // f.close(); } @@ -147,4 +143,5 @@ void Om3u::add(const QString &filePath) { //adds to m3u file void Om3u::remove(const QString &filePath) { //removes from m3u list QString list, currentFile; + if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { currentFile=*it; @@ -155,5 +152,5 @@ void Om3u::remove(const QString &filePath) { //removes from m3u list } f.writeBlock( list, list.length() ); - + } } 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 @@ -188,6 +188,6 @@ void PlayListWidget::writeDefaultPlaylist() { Om3u *m3uList; // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); + if( d->selectedFiles->first() ) { m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); - d->selectedFiles->first(); do { // qDebug(d->selectedFiles->current()->file()); @@ -199,4 +199,6 @@ void PlayListWidget::writeDefaultPlaylist() { m3uList->close(); if(m3uList) delete m3uList; + + } } } @@ -854,7 +856,9 @@ void PlayListWidget::writeCurrentM3u() { QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); + if( d->selectedFiles->first()) { Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); - d->selectedFiles->first(); + + qDebug( d->selectedFiles->current()->file()); do { @@ -869,4 +873,5 @@ void PlayListWidget::writeCurrentM3u() { if(m3uList) delete m3uList; } +} /* @@ -891,8 +896,7 @@ void PlayListWidget::writem3u() { } + if( d->selectedFiles->first()) { m3uList = new Om3u(filename, IO_ReadWrite); - d->selectedFiles->first(); - do { m3uList->add( d->selectedFiles->current()->file()); @@ -924,5 +928,5 @@ void PlayListWidget::writem3u() { setCaption(tr("OpiePlayer: ") + name); } - + } } |