Bug 119724 - automatically select next item after delete
Summary: automatically select next item after delete
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: triaged
: 118229 190616 278937 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-08 06:50 UTC by jason fuchs
Modified: 2012-07-11 16:30 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jason fuchs 2006-01-08 06:50:41 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages

When viewing the article list, deleting an item automatically displays the next feed item in the preview window, but the feed item itself is not *selected*, so the user must click on the item to delete it.

For example, browsing the article list, you click on one, see the summary/preview, decide to delete it, you press delete, the next item is displayed, but if you also want to delete this one without reading, you have to click on it in the list, instead of just pressing delete key again.
Comment 1 Frank Osterfeld 2006-01-10 12:41:04 UTC
Classifying as (usability) bug instead wishlist.
Comment 2 Frank Osterfeld 2006-01-10 13:01:35 UTC
SVN commit 496329 by osterfeld:

select the next article in the article list when deleting the only selected article (doesn't apply when deleting multiple 
articles)

BUG: 119724


 M  +2 -0      ChangeLog  
 M  +48 -1     src/articlelistview.cpp  


--- branches/KDE/3.5/kdepim/akregator/ChangeLog #496328:496329
@@ -7,6 +7,8 @@
 
 Bug fixes:
 
+ 2006/01/10 Select next item in article list when deleting the selected article
+            (single selection mode only) (#119724) -fo
  2006/01/10 Fix item handling in the feed list, avoid crashes as happening 
             after moving a folder and deleting a subitem afterwards 
             (#118659) -fo
--- branches/KDE/3.5/kdepim/akregator/src/articlelistview.cpp #496328:496329
@@ -368,6 +368,12 @@
 {
     setUpdatesEnabled(false);
 
+    // if only one item is selected and this selected item
+    // is deleted, we will select the next item in the list
+    bool singleSelected = selectedArticles().count() == 1;
+    
+    QListViewItem* next = 0; // the item to select if a selected item is deleted
+    
     for (QValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
     {
         
@@ -375,8 +381,16 @@
         {
             ArticleItem* ali = d->articleMap[*it];
 
-            if ((*it).isDeleted()) // if article was set to deleted, delete item
+            if (ali && (*it).isDeleted()) // if article was set to deleted, delete item
             {
+                if (singleSelected && ali->isSelected())
+                {
+                    if (ali->itemBelow())
+                        next = ali->itemBelow();
+                    else if (ali->itemAbove())
+                        next = ali->itemAbove();
+                }
+                
                 d->articleMap.remove(*it);
                 delete ali;
             }
@@ -390,22 +404,55 @@
         }
     }
 
+    // if the only selected item was deleted, select
+    // an item next to it
+    if (singleSelected && next != 0)
+    {
+        setSelected(next, true);
+        setCurrentItem(next);
+    }
+
     setUpdatesEnabled(true);
     triggerUpdate();
 }
 
 void ArticleListView::slotArticlesRemoved(TreeNode* /*node*/, const QValueList<Article>& list)
 {
+    // if only one item is selected and this selected item
+    // is deleted, we will select the next item in the list
+    bool singleSelected = selectedArticles().count() == 1;
+
+    QListViewItem* next = 0; // the item to select if a selected item is deleted
+    
     setUpdatesEnabled(false);
+    
     for (QValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
     {
         if (d->articleMap.contains(*it))
         {
             ArticleItem* ali = d->articleMap[*it];
             d->articleMap.remove(*it);
+            
+            if (singleSelected && ali->isSelected())
+            {
+                if (ali->itemBelow())
+                    next = ali->itemBelow();
+                else if (ali->itemAbove())
+                    next = ali->itemAbove();
+            }
+            
             delete ali;
         }
     }
+    
+    // if the only selected item was deleted, select
+    // an item next to it
+    if (singleSelected && next != 0)
+    {
+        setSelected(next, true);
+        setCurrentItem(next);
+    }
+
     setUpdatesEnabled(true);
     triggerUpdate();
 }
Comment 3 Frank Osterfeld 2006-01-16 01:49:39 UTC
*** Bug 118229 has been marked as a duplicate of this bug. ***
Comment 4 Dotan Cohen 2008-07-09 23:52:52 UTC
This bug seems to have cropped up again in Akregator 1.2.50 on KDE 4.1 beta 2. Should I start a new bug, or reopen this one?

To clarify, when deleting an entry, the next entry shows in the view pane, however, it is not selected. Therefore, the entry cannot be scrolled nor deleted.
Comment 5 Dominik Tritscher 2008-11-09 15:49:17 UTC
This bug still exists in Akregator 1.3.3 from KDE 4.1.3
Comment 6 Thomas 2009-01-18 17:04:17 UTC
This Bug still exists in Akregator 1.3.4 on KDE 4.1.4 (Kubuntu-Packages)
Comment 7 Dotan Cohen 2009-01-30 04:25:27 UTC
Fixed in KDE 4.2.
Comment 8 Eckhart Wörner 2010-03-29 13:53:14 UTC
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529227 says the bug is still present in 4.2.2 and 4.3.4
Comment 9 Eckhart Wörner 2010-03-29 13:54:05 UTC
And I can reproduce it in KDE SC 4.4.1
Comment 10 Christophe Marin 2010-03-29 14:13:33 UTC
Reopening this KDE3 report is not needed. There's already bug 190616 for KDE4.
Comment 11 Eckhart Wörner 2010-03-29 14:30:49 UTC
(In reply to comment #10)
> Reopening this KDE3 report is not needed. There's already bug 190616 for KDE4.

I don't want to nitpick, but everything from comment #4 on is related to KDE 4. Comment #4 is from 2008 which predates bug 190616 by almost a year and therefore makes it a duplicate.
Comment 12 Eckhart Wörner 2010-03-29 14:31:00 UTC
*** Bug 190616 has been marked as a duplicate of this bug. ***
Comment 13 Nico Dorn 2010-05-08 17:03:54 UTC
Unfortunately, I can confirm this behaviour for Akregator 1.6.2/KDE SC 4.4.2 (Kubuntu).
Comment 14 Andreas Pietzowski 2010-05-08 19:21:47 UTC
This bug still exists in KDE 4.4.3 ;-(
Comment 15 Nico Dorn 2011-01-03 23:25:57 UTC
Confirmed also for 4.5.4.
Comment 16 Christophe Marin 2011-08-01 12:27:13 UTC
*** Bug 278937 has been marked as a duplicate of this bug. ***
Comment 17 Laurent Bonnaud 2011-08-02 05:58:53 UTC
This bug still exists in akregator 4.7.0.
Comment 18 Szczepan Hołyszewski 2012-01-30 13:38:41 UTC
This bug still exists in Akregator 4.8.0, and is now 3.5 years old. Developers helllloooooooo? Is it really that hard to fix?
Comment 19 Yuriy Vidineev 2012-04-20 07:13:18 UTC
Akregator 4.8.2, Kubuntu 12.04. Bug still here
Comment 20 Lê Hoàng Phương 2012-07-11 15:59:41 UTC
The bug is fixed in latest commit. 
KDE 4.9: http://commits.kde.org/kdepim/244f18a4d9813f064c95dce0db426d52bda84617
KDE 4.8.5: http://commits.kde.org/kdepim/807c0aa23de75a9eb67c8e3f00fc992efbb4c930
KDE 4.10: http://commits.kde.org/kdepim/86f5008a2558e488c2fae82cd0df3caff252bf6a
Please help me close this bug because I do not have the permission to do that.