Commit 5d35f2a8 authored by Scott Wheeler's avatar Scott Wheeler

Add the same "don't update while doing multiselect" thing for keyboard

selection.

svn path=/trunk/kdemultimedia/juk/; revision=250054
parent 85b2766a
......@@ -43,7 +43,7 @@ PlaylistBox::PlaylistBox(PlaylistSplitter *parent, const QString &name) :
m_updatePlaylistStack(true),
m_viewModeIndex(0),
m_hasSelection(false),
m_mousePressed(false)
m_doingMultiSelect(false)
{
readConfig();
addColumn("Playlists", width());
......@@ -435,19 +435,35 @@ void PlaylistBox::contentsDragMoveEvent(QDragMoveEvent *e)
void PlaylistBox::contentsMousePressEvent(QMouseEvent *e)
{
if(e->button() == LeftButton)
m_mousePressed = true;
m_doingMultiSelect = true;
KListView::contentsMousePressEvent(e);
}
void PlaylistBox::contentsMouseReleaseEvent(QMouseEvent *e)
{
if(e->button() == LeftButton) {
m_mousePressed = false;
m_doingMultiSelect = false;
slotPlaylistChanged();
}
KListView::contentsMouseReleaseEvent(e);
}
void PlaylistBox::keyPressEvent(QKeyEvent *e)
{
if((e->key() == Key_Up || e->key() == Key_Down) && e->state() == ShiftButton)
m_doingMultiSelect = true;
KListView::keyPressEvent(e);
}
void PlaylistBox::keyReleaseEvent(QKeyEvent *e)
{
if(m_doingMultiSelect && e->key() == Key_Shift) {
m_doingMultiSelect = false;
slotPlaylistChanged();
}
KListView::keyReleaseEvent(e);
}
PlaylistBox::ItemList PlaylistBox::selectedItems()
{
ItemList l;
......@@ -475,7 +491,7 @@ void PlaylistBox::slotPlaylistChanged()
{
// Don't update while the mouse is pressed down.
if(m_mousePressed)
if(m_doingMultiSelect)
return;
ItemList items = selectedItems();
......
......@@ -111,6 +111,8 @@ private:
virtual void contentsDragMoveEvent(QDragMoveEvent *e);
virtual void contentsMousePressEvent(QMouseEvent *e);
virtual void contentsMouseReleaseEvent(QMouseEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void keyReleaseEvent(QKeyEvent *e);
/**
* This is used by PlaylistItemBox (a friend class) to add names to the name
......@@ -145,7 +147,7 @@ private:
QValueList<ViewMode *> m_viewModes;
KSelectAction *m_viewModeAction;
bool m_hasSelection;
bool m_mousePressed;
bool m_doingMultiSelect;
};
......
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