Browse Source

Konqueror: Deselect items that are hidden by the filter during Select and Deselect

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Slávek Banko 1 year ago
parent
commit
924d993671
2 changed files with 38 additions and 16 deletions
  1. 18
    8
      konqueror/iconview/konq_iconview.cc
  2. 20
    8
      konqueror/listview/konq_listview.cc

+ 18
- 8
konqueror/iconview/konq_iconview.cc View File

@@ -557,10 +557,15 @@ void KonqKfmIconView::slotSelect()
557 557
         m_pIconView->blockSignals( true );
558 558
 
559 559
         TQIconViewItem *it = m_pIconView->firstItem();
560
-        while ( it )
561
-        {
562
-            if ( re.exactMatch( it->text() ) )
563
-                it->setSelected( true, true );
560
+        while ( it ) {
561
+            if ( it->isVisible() ) {
562
+                if ( re.exactMatch( it->text() ) ) {
563
+                    it->setSelected( true, true );
564
+                }
565
+            }
566
+            else {
567
+                    it->setSelected( false, true );
568
+            }
564 569
             it = it->nextItem();
565 570
         }
566 571
 
@@ -584,10 +589,15 @@ void KonqKfmIconView::slotUnselect()
584 589
         m_pIconView->blockSignals( true );
585 590
 
586 591
         TQIconViewItem *it = m_pIconView->firstItem();
587
-        while ( it )
588
-        {
589
-            if ( re.exactMatch( it->text() ) )
590
-                it->setSelected( false, true );
592
+        while ( it ) {
593
+            if ( it->isVisible() ) {
594
+                if ( re.exactMatch( it->text() ) ) {
595
+                    it->setSelected( false, true );
596
+                }
597
+            }
598
+            else {
599
+                    it->setSelected( false, true );
600
+            }
591 601
             it = it->nextItem();
592 602
         }
593 603
 

+ 20
- 8
konqueror/listview/konq_listview.cc View File

@@ -389,17 +389,22 @@ void KonqListView::slotSelect()
389 389
 
390 390
    for (KonqBaseListViewWidget::iterator it = m_pListView->begin(); it != m_pListView->end(); it++ )
391 391
    {
392
-      if ((m_pListView->automaticSelection()) && (it->isSelected()))
393
-      {
392
+      if ((m_pListView->automaticSelection()) && (it->isSelected())) {
394 393
          it->setSelected(FALSE);
395 394
          //the following line is to prevent that more than one item were selected
396 395
          //and now get deselected and automaticSelection() was true, this shouldn't happen
397 396
          //but who knows, aleXXX
398 397
          m_pListView->deactivateAutomaticSelection();
399
-      };
400
-      if ( re.exactMatch( it->text(0) ) )
401
-         it->setSelected( TRUE);
402
-   };
398
+      }
399
+      if ( it->isVisible() ) {
400
+         if ( re.exactMatch( it->text(0) ) ) {
401
+            it->setSelected(TRUE);
402
+         }
403
+      }
404
+      else {
405
+         it->setSelected(FALSE);
406
+      }
407
+   }
403 408
    m_pListView->blockSignals( false );
404 409
    m_pListView->deactivateAutomaticSelection();
405 410
    emit m_pListView->selectionChanged();
@@ -418,9 +423,16 @@ void KonqListView::slotUnselect()
418 423
 
419 424
    m_pListView->blockSignals(TRUE);
420 425
 
421
-   for (KonqBaseListViewWidget::iterator it = m_pListView->begin(); it != m_pListView->end(); it++ )
422
-      if ( re.exactMatch( it->text(0) ) )
426
+   for (KonqBaseListViewWidget::iterator it = m_pListView->begin(); it != m_pListView->end(); it++ ) {
427
+      if ( it->isVisible() ) {
428
+         if ( re.exactMatch( it->text(0) ) ) {
429
+            it->setSelected(FALSE);
430
+         }
431
+      }
432
+      else {
423 433
          it->setSelected(FALSE);
434
+      }
435
+   }
424 436
 
425 437
    m_pListView->blockSignals(FALSE);
426 438
    m_pListView->deactivateAutomaticSelection();

Loading…
Cancel
Save