Commit c89180ee authored by Frerich Raabe's avatar Frerich Raabe

- Now one can add a playlist, and the files in a directory are automatically

  added to it.

svn path=/trunk/kdemultimedia/juk/; revision=234933
parent d133a4e5
......@@ -273,7 +273,12 @@ void JuK::setupActions()
// file menu
//////////////////////////////////////////////////
createSplitterAction(i18n("New Playlist..."), SLOT(slotCreatePlaylist()), "file_new", "filenew", "CTRL+n");
KActionMenu *newMenu = new KActionMenu(i18n("&New"), "", actionCollection(), "file_new");
newMenu->insert(
createSplitterAction(i18n("Empty Playlist..."), SLOT(slotCreatePlaylist()), 0, 0, 0));
newMenu->insert(
createSplitterAction(i18n("Playlist From Directory..."), SLOT(slotCreatePlaylistFromDir()), 0, 0, 0));
createSplitterAction(i18n("Open..."), SLOT(slotOpen()), "file_open", "fileopen", "CTRL+o");
createSplitterAction(i18n("Open &Directory..."), SLOT(slotOpenDirectory()), "openDirectory", "fileopen");
createSplitterAction(i18n("&Rename..."), SLOT(slotRenamePlaylist()), "renamePlaylist");
......
......@@ -310,6 +310,23 @@ Playlist *PlaylistSplitter::slotCreatePlaylist()
return 0;
}
Playlist *PlaylistSplitter::slotCreatePlaylistFromDir()
{
const QString dirName = KFileDialog::getExistingDirectory();
if(dirName.isEmpty())
return 0;
Playlist *playlist = slotCreatePlaylist();
if(!playlist)
return 0;
const QStringList files = QDir(dirName).entryList(QDir::Files);
for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
slotAddToPlaylist(dirName + "/" + *it, playlist);
return playlist;
}
void PlaylistSplitter::slotSelectPlaying()
{
if(!m_playingItem)
......
......@@ -181,6 +181,12 @@ public slots:
*/
Playlist *slotCreatePlaylist();
/**
* Create a playlist from a user-defined directory, and prompt the user for
* a name.
*/
Playlist *slotCreatePlaylistFromDir();
/**
* Sets the selection to the currently playing item and ensures that it is
* visible.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment