summaryrefslogtreecommitdiffstats
path: root/ksysguard
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-15 15:33:01 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-15 15:33:01 -0600
commit64f3533baa6463879500569f1b539864131451ee (patch)
tree49de7148419bd35de63e3948b641e6675b3d4302 /ksysguard
parenta37d3e5ac533dff3c7e8a43c671c4dfc42b99e69 (diff)
downloadtdebase-64f3533baa6463879500569f1b539864131451ee.zip
tdebase-64f3533baa6463879500569f1b539864131451ee.tar.gz
Fix keyboard multi-select failure in ksysguard
Diffstat (limited to 'ksysguard')
-rw-r--r--ksysguard/gui/SensorDisplayLib/ProcessList.cc133
-rw-r--r--ksysguard/gui/SensorDisplayLib/ProcessList.h6
2 files changed, 87 insertions, 52 deletions
diff --git a/ksysguard/gui/SensorDisplayLib/ProcessList.cc b/ksysguard/gui/SensorDisplayLib/ProcessList.cc
index e0b5f79..44ce491 100644
--- a/ksysguard/gui/SensorDisplayLib/ProcessList.cc
+++ b/ksysguard/gui/SensorDisplayLib/ProcessList.cc
@@ -228,6 +228,8 @@ ProcessList::ProcessList(TQWidget *parent, const char* name)
* settings. */
connect(header(), TQT_SIGNAL(clicked(int)), this, TQT_SLOT(sortingChanged(int)));
+ ctrlKeyDown = false;
+ shiftKeyDown = false;
treeViewEnabled = false;
openAll = true;
@@ -294,73 +296,76 @@ ProcessList::getSelectedAsStrings()
bool
ProcessList::update(const TQString& list)
{
- /* Disable painting to avoid flickering effects,
- * especially when in tree view mode.
- * Ditto for the scrollbar. */
- setUpdatesEnabled(false);
- viewport()->setUpdatesEnabled(false);
-
- pl.clear();
-
- // Convert ps answer in a list of tokenized lines
- KSGRD::SensorTokenizer procs(list, '\n');
- for (unsigned int i = 0; i < procs.count(); i++)
+ if ((!shiftKeyDown) && (!ctrlKeyDown))
{
- KSGRD::SensorPSLine* line = new KSGRD::SensorPSLine(procs[i]);
- if (line->count() != (uint) columns())
+ /* Disable painting to avoid flickering effects,
+ * especially when in tree view mode.
+ * Ditto for the scrollbar. */
+ setUpdatesEnabled(false);
+ viewport()->setUpdatesEnabled(false);
+
+ pl.clear();
+
+ // Convert ps answer in a list of tokenized lines
+ KSGRD::SensorTokenizer procs(list, '\n');
+ for (unsigned int i = 0; i < procs.count(); i++)
{
+ KSGRD::SensorPSLine* line = new KSGRD::SensorPSLine(procs[i]);
+ if (line->count() != (uint) columns())
+ {
#if 0
- // This is needed for debugging only.
- kdDebug(1215) << list << endl;
- TQString l;
- for (uint j = 0; j < line->count(); j++)
- l += (*line)[j] + "|";
- kdDebug(1215) << "Incomplete ps line:" << l << endl;
+ // This is needed for debugging only.
+ kdDebug(1215) << list << endl;
+ TQString l;
+ for (uint j = 0; j < line->count(); j++)
+ l += (*line)[j] + "|";
+ kdDebug(1215) << "Incomplete ps line:" << l << endl;
#endif
- return (false);
+ return (false);
+ }
+ else
+ pl.append(line);
}
+
+ int currItemPos = itemPos(currentItem());
+ int vpos = verticalScrollBar()->value();
+ int hpos = horizontalScrollBar()->value();
+
+ updateMetaInfo();
+
+ clear();
+
+ if (treeViewEnabled)
+ buildTree();
else
- pl.append(line);
- }
-
- int currItemPos = itemPos(currentItem());
- int vpos = verticalScrollBar()->value();
- int hpos = horizontalScrollBar()->value();
-
- updateMetaInfo();
-
- clear();
-
- if (treeViewEnabled)
- buildTree();
- else
- buildList();
-
- TQListViewItemIterator it( this );
- while ( it.current() ) {
- if ( itemPos( it.current() ) == currItemPos ) {
- setCurrentItem( it.current() );
- break;
+ buildList();
+
+ TQListViewItemIterator it( this );
+ while ( it.current() ) {
+ if ( itemPos( it.current() ) == currItemPos ) {
+ setCurrentItem( it.current() );
+ break;
+ }
+ ++it;
}
- ++it;
+
+ verticalScrollBar()->setValue(vpos);
+ horizontalScrollBar()->setValue(hpos);
+
+ // Re-enable painting, and force an update.
+ setUpdatesEnabled(true);
+ viewport()->setUpdatesEnabled(true);
+
+ triggerUpdate();
}
- verticalScrollBar()->setValue(vpos);
- horizontalScrollBar()->setValue(hpos);
-
- // Re-enable painting, and force an update.
- setUpdatesEnabled(true);
- viewport()->setUpdatesEnabled(true);
-
- triggerUpdate();
-
return (true);
}
void
ProcessList::setTreeView(bool tv)
{
- if (treeViewEnabled = tv)
+ if ((treeViewEnabled = tv))
{
savedWidth[0] = columnWidth(0);
openAll = true;
@@ -938,4 +943,28 @@ ProcessList::selectAllChilds(int pid, bool select)
}
}
+void
+ProcessList::keyPressEvent(TQKeyEvent *e)
+{
+ if (e->key() == Key_Shift) {
+ shiftKeyDown = true;
+ }
+ if (e->key() == Key_Control) {
+ ctrlKeyDown = true;
+ }
+ KListView::keyPressEvent(e);
+}
+
+void
+ProcessList::keyReleaseEvent(TQKeyEvent *e)
+{
+ if (e->key() == Key_Shift) {
+ shiftKeyDown = false;
+ }
+ if (e->key() == Key_Control) {
+ ctrlKeyDown = false;
+ }
+ KListView::keyReleaseEvent(e);
+}
+
#include "ProcessList.moc"
diff --git a/ksysguard/gui/SensorDisplayLib/ProcessList.h b/ksysguard/gui/SensorDisplayLib/ProcessList.h
index 370fe23..fc668cf 100644
--- a/ksysguard/gui/SensorDisplayLib/ProcessList.h
+++ b/ksysguard/gui/SensorDisplayLib/ProcessList.h
@@ -170,6 +170,10 @@ signals:
void listModified(bool);
+protected:
+ void keyPressEvent(TQKeyEvent *e);
+ void keyReleaseEvent(TQKeyEvent *e);
+
private:
// items of table header RMB popup menu
enum
@@ -244,6 +248,8 @@ private:
bool killSupported;
bool treeViewEnabled;
bool openAll;
+ bool ctrlKeyDown;
+ bool shiftKeyDown;
/* The following lists are primarily used to store table specs between
* load() and the actual table creation in addColumn(). */