-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 4e31670..4ee784e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -85,7 +85,2 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par pmPlayList->insertSeparator(-1); -// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), -// this, SLOT( saveList() ) ); - (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), - this, SLOT(writem3u() ) ); - pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Add File" ), @@ -95,2 +90,5 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par pmPlayList->insertSeparator(-1); + (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), + this, SLOT(writem3u() ) ); + pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), @@ -782,5 +780,30 @@ void PlayListWidget::readListFromFile( const QString &filename ) { void PlayListWidget::writem3u() { - InputDialog *fileDlg; - fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); - fileDlg->exec(); + //InputDilog *fileDlg; + //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); + //fileDlg->exec(); + + Config cfg( "OpiePlayer" ); + cfg.setGroup("Dialog"); + MimeTypes types; + QStringList audio, video, all; + audio << "audio/*"; + audio << "playlist/plain"; + audio << "audio/x-mpegurl"; + + video << "video/*"; + video << "playlist/plain"; + + all += audio; + all += video; + types.insert("All Media Files", all ); + types.insert("Audio", audio ); + types.insert("Video", video ); + + QString str = OFileDialog::getOpenFileName( 1, + cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", + types, 0 ); + if(str.left(2) == "//") str=str.right(str.length()-1); + cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); + + QString name, filename, list; @@ -788,4 +811,5 @@ void PlayListWidget::writem3u() { - if( fileDlg->result() == 1 ) { - name = fileDlg->text(); + if( !str.isEmpty() ) { + name = str; + // name = fileDlg->text(); // qDebug( filename ); @@ -813,3 +837,3 @@ void PlayListWidget::writem3u() { - delete fileDlg; + //delete fileDlg; |