Commit e3433290 authored by Scott Wheeler's avatar Scott Wheeler

RMB selects the item. Fixed up a couple of things involving making sure

that an item is always selected...

svn path=/trunk/kdemultimedia/juk/; revision=220082
parent 7b2c349d
......@@ -609,7 +609,7 @@ void Playlist::createItems(const PlaylistItemList &siblings)
if(!m_members.insert(resolveSymLinks((*it)->absFilePath()))) {
previous = new PlaylistItem((*it)->collectionItem(), this, previous);
connect((*it), SIGNAL(destroyed()), (*it)->collectionItem(), SLOT(deleteLater()));
connect((*it)->collectionItem(), SIGNAL(destroyed()), *it, SLOT(deleteLater()));
}
}
}
......
......@@ -97,7 +97,6 @@ public:
* both PlaylistItems and CollectionListItems.
*/
virtual PlaylistItem *createItem(const QFileInfo &file, QListViewItem *after = 0);
void createItems(const PlaylistItemList &siblings);
QString fileName() const { return m_fileName; }
......
......@@ -258,6 +258,9 @@ void PlaylistBox::deleteItem(Item *item)
m_names.remove(item->text());
m_playlistDict.remove(item->playlist());
setCurrentItem(item->prev() ? item->prev() : item->next());
delete item->playlist();
delete item;
}
......@@ -358,6 +361,13 @@ QValueList<PlaylistBox::Item *> PlaylistBox::selectedItems() const
return l;
}
void PlaylistBox::setCurrentItem(QListBoxItem *item)
{
setSelectionMode(Single);
KListBox::setCurrentItem(item);
setSelectionMode(Extended);
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox private slots
////////////////////////////////////////////////////////////////////////////////
......@@ -386,6 +396,8 @@ void PlaylistBox::slotShowContextMenu(QListBoxItem *item, const QPoint &point)
m_contextMenuOn = i;
if(i) {
setCurrentItem(i);
bool isCollection = i->playlist() == CollectionList::instance();
bool hasFile = !i->playlist()->fileName().isEmpty();
......
......@@ -91,6 +91,8 @@ private:
QValueList<Item *> selectedItems() const;
void setCurrentItem(QListBoxItem *item);
private slots:
/**
* Catches QListBox::currentChanged(QListBoxItem *), does a cast and then re-emits
......
......@@ -137,9 +137,11 @@ PlaylistItem::PlaylistItem(CollectionListItem *item, Playlist *parent, QListView
setup(item, parent);
}
PlaylistItem::PlaylistItem(CollectionList *parent) : QObject(parent), KListViewItem(parent),
m_collectionItem(static_cast<CollectionListItem *>(this)),
m_data(0), m_playing(false)
// This constructor should only be used by the CollectionList subclass.
PlaylistItem::PlaylistItem(CollectionList *parent) :
QObject(parent), KListViewItem(parent),
m_collectionItem(static_cast<CollectionListItem *>(this)), m_data(0), m_playing(false)
{
setDragEnabled(true);
}
......
......@@ -52,9 +52,10 @@ void processEvents()
// public methods
////////////////////////////////////////////////////////////////////////////////
PlaylistSplitter::PlaylistSplitter(QWidget *parent, bool restore, const char *name) : QSplitter(Qt::Horizontal, parent, name),
m_playingItem(0), m_dynamicList(0),
m_restore(restore), m_nextPlaylistItem(0)
PlaylistSplitter::PlaylistSplitter(QWidget *parent, bool restore, const char *name) :
QSplitter(Qt::Horizontal, parent, name),
m_playingItem(0), m_searchWidget(0), m_dynamicList(0), m_restore(restore),
m_nextPlaylistItem(0)
{
if(!m_mediaExtensions && !m_listExtensions) {
m_mediaExtensions = new QStringList();
......@@ -602,7 +603,8 @@ void PlaylistSplitter::slotChangePlaylist(const PlaylistList &l)
Playlist *current = m_dynamicList;
m_searchWidget->clear();
if(m_searchWidget)
m_searchWidget->clear();
m_nextPlaylistItem = 0;
if(l.count() == 1) {
......
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