author | harlekin <harlekin> | 2003-06-18 21:01:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-06-18 21:01:43 (UTC) |
commit | eff530015d448c27d060824c8ed58bbd7a4b40b9 (patch) (side-by-side diff) | |
tree | a5672a3ac374c5c501dbf93482692bcd4565bdb0 | |
parent | 9bfda722eeba2f5861393e9f5f41170fab502da8 (diff) | |
download | opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.zip opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.tar.gz opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.tar.bz2 |
give save playlist the normal ofileselector too
-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 @@ -82,18 +82,16 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par this, SLOT( addAllVideoToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 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" ), this,SLOT( openFile() ) ); (void)new MenuItem( pmPlayList, tr("Add URL"), this,SLOT( openURL() ) ); 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" ), audioView, SLOT( scanFiles() ) ); (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), videoView, SLOT( scanFiles() ) ); @@ -779,16 +777,42 @@ 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(); + //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; Om3u *m3uList; - if( fileDlg->result() == 1 ) { - name = fileDlg->text(); + if( !str.isEmpty() ) { + name = str; + // name = fileDlg->text(); // qDebug( filename ); if( name.find("/",0,true) != -1) {// assume they specify a file path filename = name; name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); @@ -810,9 +834,9 @@ void PlayListWidget::writem3u() { m3uList->write(); m3uList->close(); delete m3uList; - delete fileDlg; + //delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); |