Bug 122158 - Processtable : dangerous ad buggy behaviour of processes' selection in process table
Summary: Processtable : dangerous ad buggy behaviour of processes' selection in proces...
Status: RESOLVED FIXED
Alias: None
Product: ksysguard
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-17 14:52 UTC by Lorenzo Paulatto
Modified: 2006-04-03 19:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Paulatto 2006-02-17 14:52:37 UTC
Version:           1.2.0 (using KDE KDE 3.5.1)
Installed from:    SuSE RPMs
OS:                Linux

I don't know if this problem is common to the non-SUSE version of ksysguard, but I guess it is.

1. Open ksysguard --processtable
2. enter a pretty much strict search string in the search field
    e.g. Searching "ine" would find both and only xinetd and kaffeine 
3. Select the first process of the list, than SHIFT+CLICK on the last one, in order to select them all
4. Press "kill"

Look at the confirm pop-up: you will notice that also the "hidden" processes have ben selected
    e.g. all the processes with a PID between the xinted and the kaffeine ones

A user who doesn't pay attention will probably kick himself out of kde loosing all the unsaved work.
Comment 1 Philip Rodrigues 2006-02-18 19:03:53 UTC
Seems to be a bug in the 'listview with quicksearch' widget, since it turns up in KMail too: see bug 122218
Comment 2 Lubos Lunak 2006-02-20 15:12:32 UTC
SVN commit 511614 by lunakl:

Iterate only over visible items, not all of them (some may be hidden
by the search lineedit).
BUG: 122158



 M  +12 -16    ProcessList.cc  


--- branches/KDE/3.5/kdebase/ksysguard/gui/SensorDisplayLib/ProcessList.cc #511613:511614
@@ -272,11 +272,10 @@
 ProcessList::getSelectedPIds()
 {
 	selectedPIds.clear();
-	// iterate through all items of the listview and find selected processes
-	QListViewItemIterator it(this);
+	// iterate through all selected visible items of the listview
+	QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected );
 	for ( ; it.current(); ++it )
-		if (it.current()->isSelected())
-			selectedPIds.append(it.current()->text(1).toInt());
+		selectedPIds.append(it.current()->text(1).toInt());
 
 	return (selectedPIds);
 }
@@ -285,14 +284,13 @@
 ProcessList::getSelectedAsStrings()
 {
 	selectedAsStrings.clear();
-	// iterate through all items of the listview and find selected processes
-	QListViewItemIterator it(this);
+	// iterate through all selected visible items of the listview
+	QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected );
 	QString spaces;
-	for ( ; it.current(); ++it )
-		if (it.current()->isSelected()) {
-			spaces.fill(QChar(' '), 7 - it.current()->text(1).length());
-			selectedAsStrings.append("(PID: " + it.current()->text(1) + ")" + spaces + " " + it.current()->text(0));
-		}	
+	for ( ; it.current(); ++it ) {
+		spaces.fill(QChar(' '), 7 - it.current()->text(1).length());
+		selectedAsStrings.append("(PID: " + it.current()->text(1) + ")" + spaces + " " + it.current()->text(0));
+	}	
 
 	return (selectedAsStrings);
 }
@@ -868,14 +866,12 @@
 			/* we go through list to get all task also
 			   when update interval is paused */
 			selectedPIds.clear();
-			QListViewItemIterator it(this);
+			QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected);
 
-			// iterate through all items of the listview
+			// iterate through all selected visible items of the listview
 			for ( ; it.current(); ++it )
 			{
-				if (it.current()->isSelected()) {
-					selectedPIds.append(it.current()->text(1).toInt());
-				}
+				selectedPIds.append(it.current()->text(1).toInt());
 			}
 
 			QString msg = i18n("Do you really want to send signal %1 to the selected process?", 
Comment 3 Christian Boltz 2006-04-03 19:55:38 UTC
Your fix works (tested with KDE 3.5.1 on SUSE 10.1 beta9)

Thanks!