Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d4e2dd14 authored by Scott Wheeler's avatar Scott Wheeler

*) Create playlist RMB menus on demand.

*) Make it possible to use the "create group from selection" from any
   playlist, not just the collection.
*) Add tag guessing stuff to the RMB menu.

CCMAIL:61182-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=241178
parent 42939be7
......@@ -120,9 +120,6 @@ CollectionList::CollectionList(QWidget *parent) :
m_dirWatch->startScan();
polish();
rmbMenu()->insertSeparator();
rmbMenu()->insertItem(SmallIcon("new"), i18n("Create Group From Selected Items"), this, SLOT(slotCreateGroup()));
}
CollectionList::~CollectionList()
......@@ -171,11 +168,6 @@ void CollectionList::slotRefreshItem(const QString &file)
m_itemsDict[file]->slotRefresh();
}
void CollectionList::slotCreateGroup()
{
emit signalRequestPlaylistCreation(selectedItems());
}
////////////////////////////////////////////////////////////////////////////////
// CollectionListItem public slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -103,13 +103,11 @@ protected:
signals:
void signalCollectionChanged();
void signalRequestPlaylistCreation(const PlaylistItemList &items);
private slots:
void slotRemoveItem(const QString &file);
void slotRefreshItem(const QString &file);
void slotCreateGroup();
private:
/**
* Just the size of the above enum to keep from hard coding it in several
......
......@@ -21,6 +21,7 @@
#include <kiconloader.h>
#include <klineedit.h>
#include <kaction.h>
#include <kmainwindow.h>
#include <kpopupmenu.h>
#include <klocale.h>
#include <kdebug.h>
......@@ -190,7 +191,8 @@ int Playlist::m_leftColumn = 0;
Playlist::Playlist(QWidget *parent, const QString &name) :
KListView(parent, name.latin1()),
m_playlistName(name)
m_playlistName(name),
m_rmbMenu(0)
{
setup();
......@@ -198,7 +200,8 @@ Playlist::Playlist(QWidget *parent, const QString &name) :
Playlist::Playlist(const QFileInfo &playlistFile, QWidget *parent, const QString &name) :
KListView(parent, name.latin1()),
m_fileName(playlistFile.absFilePath())
m_fileName(playlistFile.absFilePath()),
m_rmbMenu(0)
{
setup();
loadFile(m_fileName, playlistFile);
......@@ -821,25 +824,6 @@ void Playlist::polish()
hideColumn(PlaylistItem::CommentColumn);
hideColumn(PlaylistItem::FileNameColumn);
//////////////////////////////////////////////////
// setup playlist RMB menu
//////////////////////////////////////////////////
m_rmbMenu = new KPopupMenu(this);
m_rmbMenu->insertItem(SmallIconSet("player_play"), i18n("Play Next"), this, SLOT(slotSetNext()));
m_rmbMenu->insertSeparator();
m_rmbMenu->insertItem(SmallIconSet("editcut"), i18n("Cut"), this, SLOT(cut()));
m_rmbMenu->insertItem(SmallIconSet("editcopy"), i18n("Copy"), this, SLOT(copy()));
m_rmbPasteID = m_rmbMenu->insertItem(SmallIconSet("editpaste"), i18n("Paste"), this, SLOT(paste()));
m_rmbMenu->insertItem(SmallIconSet("editclear"), i18n("Clear"), this, SLOT(clear()));
m_rmbMenu->insertSeparator();
m_rmbEditID = m_rmbMenu->insertItem(SmallIconSet("edittool"), i18n("Edit"), this, SLOT(slotRenameTag()));
m_rmbMenu->insertItem(SmallIconSet("reload"), i18n("Refresh Items"), this, SLOT(slotRefresh()));
m_rmbMenu->insertItem(SmallIconSet("editdelete"), i18n("Remove From Disk"), this, SLOT(slotRemoveSelectedItems()));
connect(this, SIGNAL(selectionChanged()),
this, SLOT(slotEmitSelected()));
connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)),
......@@ -932,6 +916,38 @@ void Playlist::slotShowRMBMenu(QListViewItem *item, const QPoint &point, int col
if(!item)
return;
// Create the RMB menu on demand.
if(!m_rmbMenu) {
// A bit of a hack to get a pointer to the action collection.
// Probably more of these actions should be ported over to using KActions.
KActionCollection *actionCollection =
static_cast<KMainWindow *>(kapp->mainWidget())->actionCollection();
m_rmbMenu = new KPopupMenu(this);
m_rmbMenu->insertItem(SmallIconSet("player_play"), i18n("Play Next"), this, SLOT(slotSetNext()));
m_rmbMenu->insertSeparator();
m_rmbMenu->insertItem(SmallIconSet("editcut"), i18n("Cut"), this, SLOT(cut()));
m_rmbMenu->insertItem(SmallIconSet("editcopy"), i18n("Copy"), this, SLOT(copy()));
m_rmbPasteID = m_rmbMenu->insertItem(SmallIconSet("editpaste"), i18n("Paste"), this, SLOT(paste()));
m_rmbMenu->insertItem(SmallIconSet("editclear"), i18n("Clear"), this, SLOT(clear()));
m_rmbMenu->insertSeparator();
m_rmbEditID = m_rmbMenu->insertItem(SmallIconSet("edittool"), i18n("Edit"), this, SLOT(slotRenameTag()));
m_rmbMenu->insertItem(SmallIconSet("reload"), i18n("Refresh Items"), this, SLOT(slotRefresh()));
m_rmbMenu->insertItem(SmallIconSet("editdelete"), i18n("Remove From Disk"), this, SLOT(slotRemoveSelectedItems()));
m_rmbMenu->insertSeparator();
actionCollection->action("guessTag")->plug(m_rmbMenu);
m_rmbMenu->insertSeparator();
m_rmbMenu->insertItem(SmallIcon("new"), i18n("Create Group From Selected Items"), this, SLOT(slotCreateGroup()));
}
m_rmbMenu->setItemEnabled(m_rmbPasteID, canDecode(kapp->clipboard()->data()));
bool showEdit =
......
......@@ -269,8 +269,6 @@ protected:
*/
static QString resolveSymLinks(const QFileInfo &file);
KPopupMenu *rmbMenu() const { return m_rmbMenu; }
signals:
/**
* This is emitted when the playlist selection is changed. This is used
......@@ -337,6 +335,11 @@ signals:
*/
void signalVisibleColumnsChanged();
/**
* Request creation of a playlist based on \a items.
*/
void signalCreatePlaylist(const PlaylistItemList &items);
private:
void setup();
......@@ -407,6 +410,11 @@ private slots:
*/
void slotToggleColumnVisible(int column);
/**
* Prompts the user to create a new playlist with from the selected items.
*/
void slotCreateGroup() { emit signalCreatePlaylist(selectedItems()); }
private:
SortedStringList m_members;
int m_currentColumn;
......
......@@ -470,9 +470,6 @@ void PlaylistSplitter::setupLayout()
m_collection = CollectionList::instance();
setupPlaylist(m_collection, true, "folder_sound", true);
connect(m_collection, SIGNAL(signalCollectionChanged()), m_editor, SLOT(slotUpdateCollection()));
connect(m_collection, SIGNAL(signalRequestPlaylistCreation(const PlaylistItemList &)),
this, SLOT(slotCreatePlaylist(const PlaylistItemList &)));
// Create the search widget -- this must be done after the CollectionList is created.
m_searchWidget = new SearchWidget(editorSplitter, "searchWidget");
......@@ -623,6 +620,9 @@ void PlaylistSplitter::setupPlaylist(Playlist *p, bool raise, const char *icon,
connect(p, SIGNAL(itemRenamed(QListViewItem *)),
m_editor, SLOT(slotRefresh()));
connect(p, SIGNAL(signalCreatePlaylist(const PlaylistItemList &)),
this, SLOT(slotCreatePlaylist(const PlaylistItemList &)));
if(icon)
m_playlistBox->createItem(p, icon, raise, sortedFirst);
......
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