Commit ff5a8a0f authored by Frerich Raabe's avatar Frerich Raabe

- Now I can right-click on a group of selected items in the collection list

  and select "Create Group from Selected Items"

svn path=/trunk/kdemultimedia/juk/; revision=218465
parent 5272402f
......@@ -20,6 +20,8 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <kpopupmenu.h>
#include <kiconloader.h>
#include <qtimer.h>
......@@ -105,6 +107,9 @@ CollectionList::CollectionList(QWidget *parent) : Playlist(parent, i18n("Collect
connect(m_dirWatch, SIGNAL(deleted(const QString &)), this, SLOT(slotRemoveItem(const QString &)));
connect(m_dirWatch, SIGNAL(dirty(const QString &)), this, SLOT(slotRefreshItem(const QString &)));
m_dirWatch->startScan();
rmbMenu()->insertSeparator();
rmbMenu()->insertItem(SmallIcon("new"), i18n("Create Group from Selected Items"), this, SLOT(slotCreateGroup()));
}
CollectionList::~CollectionList()
......@@ -175,6 +180,15 @@ void CollectionList::slotRefreshItem(const QString &file)
m_itemsDict[file]->slotRefresh();
}
void CollectionList::slotCreateGroup()
{
QValueList<QFileInfo> fileInfos;
PlaylistItemList items = selectedItems();
for(PlaylistItem *item = items.first(); item != 0; item = items.next())
fileInfos << *item->data()->fileInfo();
emit signalRequestPlaylistCreation(fileInfos);
}
////////////////////////////////////////////////////////////////////////////////
// CollectionListItem public slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -93,10 +93,12 @@ protected:
signals:
void signalCollectionChanged();
void signalRequestPlaylistCreation(const QValueList<QFileInfo> &fileInfos);
private slots:
void slotRemoveItem(const QString &file);
void slotRefreshItem(const QString &file);
void slotCreateGroup();
private:
static CollectionList *m_list;
......
......@@ -170,6 +170,9 @@ protected:
static QString resolveSymLinks(const QFileInfo &file);
KPopupMenu *rmbMenu() { return m_rmbMenu; }
const KPopupMenu *rmbMenu() const { return m_rmbMenu; }
signals:
/**
* This signal is connected to PlaylistItem::refreshed() in the
......
......@@ -381,6 +381,7 @@ void PlaylistSplitter::setupLayout()
m_collection = CollectionList::instance();
setupPlaylist(m_collection, true, "folder_sound");
connect(m_collection, SIGNAL(signalCollectionChanged()), m_editor, SLOT(slotUpdateCollection()));
connect(m_collection, SIGNAL(signalRequestPlaylistCreation(const QValueList<QFileInfo> &)), this, SLOT(slotCreatePlaylist(const QValueList<QFileInfo> &)));
// Show the collection on startup.
m_playlistBox->setSelected(0, true);
......@@ -568,6 +569,15 @@ void PlaylistSplitter::slotPlaylistItemRemoved(PlaylistItem *item)
m_nextPlaylistItem = 0;
}
void PlaylistSplitter::slotCreatePlaylist(const QValueList<QFileInfo> &fileInfos)
{
Playlist *playlist = slotCreatePlaylist();
QValueList<QFileInfo>::ConstIterator it = fileInfos.begin();
QValueList<QFileInfo>::ConstIterator end = fileInfos.end();
for(; it != end; ++it)
playlist->createItem(*it);
}
#include "playlistsplitter.moc"
// vim:ts=8
......@@ -285,6 +285,7 @@ private slots:
void slotScanDirectories() { open(m_directoryList); }
void slotSetNextItem(PlaylistItem *item = 0) { m_nextPlaylistItem = item; }
void slotDirChanged(const QString &dir) { slotAddToPlaylist(dir, m_collection); }
void slotCreatePlaylist(const QValueList<QFileInfo> &fileInfos);
private:
PlaylistItem *m_playingItem;
......
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