Reset keyboard selection when using mouse rubberband to select items

This relates to Bug 1961
pull/2/head
Timothy Pearson 11 years ago
parent f4dab230c4
commit 4e5a99f6d2

@ -406,11 +406,8 @@ void KonqBaseListViewWidget::initConfig()
updateListContents(); updateListContents();
} }
void KonqBaseListViewWidget::contentsMousePressEvent( TQMouseEvent *e ) void KonqBaseListViewWidget::contentsMousePressEvent( TQMouseEvent *e ) {
{ if ( m_rubber ) {
if ( m_rubber )
{
TQRect r( m_rubber->normalize() ); TQRect r( m_rubber->normalize() );
delete m_rubber; delete m_rubber;
m_rubber = 0; m_rubber = 0;
@ -428,37 +425,34 @@ void KonqBaseListViewWidget::contentsMousePressEvent( TQMouseEvent *e )
TDEListView::contentsMousePressEvent( e ); TDEListView::contentsMousePressEvent( e );
} }
else { else {
if ( e->button() == Qt::LeftButton ) if ( e->button() == Qt::LeftButton ) {
{
m_rubber = new TQRect( e->x(), e->y(), 0, 0 ); m_rubber = new TQRect( e->x(), e->y(), 0, 0 );
clearSelection(); clearSelection();
emit selectionChanged(); emit selectionChanged();
m_fileTip->setItem( 0 ); m_fileTip->setItem( 0 );
} }
if ( e->button() != Qt::RightButton ) if ( e->button() != Qt::RightButton ) {
TQListView::contentsMousePressEvent( e ); TQListView::contentsMousePressEvent( e );
} }
}
// Store list of selected items at mouse-press time. // Store list of selected items at mouse-press time.
// This is used when autoscrolling (why?) // This is used when autoscrolling (why?)
// and during dnd (the target item is temporarily selected) // and during dnd (the target item is temporarily selected)
selectedItems( m_selected ); selectedItems( m_selected );
} }
void KonqBaseListViewWidget::contentsMouseReleaseEvent( TQMouseEvent *e ) void KonqBaseListViewWidget::contentsMouseReleaseEvent( TQMouseEvent *e ) {
{ if ( m_rubber ) {
if ( m_rubber ) resetKeyboardSelectionOperation();
{
TQRect r( m_rubber->normalize() ); TQRect r( m_rubber->normalize() );
delete m_rubber; delete m_rubber;
m_rubber = 0; m_rubber = 0;
repaintContents( r, FALSE ); repaintContents( r, FALSE );
} }
if ( m_scrollTimer ) if ( m_scrollTimer ) {
{ disconnect( m_scrollTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotAutoScroll() ) );
disconnect( m_scrollTimer, TQT_SIGNAL( timeout() ),
this, TQT_SLOT( slotAutoScroll() ) );
m_scrollTimer->stop(); m_scrollTimer->stop();
delete m_scrollTimer; delete m_scrollTimer;
m_scrollTimer = 0; m_scrollTimer = 0;
@ -558,7 +552,6 @@ void KonqBaseListViewWidget::drawRubber( TQPainter *p )
style().tqdrawPrimitive( TQStyle::PE_RubberBand, p, style().tqdrawPrimitive( TQStyle::PE_RubberBand, p,
TQRect( pt.x(), pt.y(), m_rubber->width(), m_rubber->height() ), TQRect( pt.x(), pt.y(), m_rubber->width(), m_rubber->height() ),
colorGroup(), TQStyle::Style_Default, colorGroup().base() ); colorGroup(), TQStyle::Style_Default, colorGroup().base() );
} }
void KonqBaseListViewWidget::slotAutoScroll() void KonqBaseListViewWidget::slotAutoScroll()
@ -570,6 +563,7 @@ void KonqBaseListViewWidget::slotAutoScroll()
const TQPoint pos = viewport()->mapFromGlobal( TQCursor::pos() ); const TQPoint pos = viewport()->mapFromGlobal( TQCursor::pos() );
const TQPoint vc = viewportToContents( pos ); const TQPoint vc = viewportToContents( pos );
TQListViewItem *at = itemAt( vc );
if ( vc == m_rubber->bottomRight() ) if ( vc == m_rubber->bottomRight() )
return; return;
@ -626,6 +620,7 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( !cur->isSelected() && cur->isSelectable() ) if ( !cur->isSelected() && cur->isSelectable() )
{ {
setSelected( cur, true ); setSelected( cur, true );
setActiveMultiSelectItem( at );
changed = TRUE; changed = TRUE;
rr = rr.unite( itemRect( cur ) ); rr = rr.unite( itemRect( cur ) );
} }
@ -641,6 +636,7 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) ) if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
{ {
setSelected( cur, false ); setSelected( cur, false );
setActiveMultiSelectItem( at );
} }
} }
@ -662,6 +658,7 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( !cur->isSelected() && cur->isSelectable() ) if ( !cur->isSelected() && cur->isSelectable() )
{ {
setSelected( cur, true ); setSelected( cur, true );
setActiveMultiSelectItem( at );
changed = TRUE; changed = TRUE;
rr = rr.unite( itemRect( cur ) ); rr = rr.unite( itemRect( cur ) );
} }
@ -677,6 +674,7 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) ) if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
{ {
setSelected( cur, false ); setSelected( cur, false );
setActiveMultiSelectItem( at );
} }
} }

Loading…
Cancel
Save