summaryrefslogtreecommitdiffstats
path: root/kdeui
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-01 21:19:21 -0500
committerSlávek Banko <slavek.banko@axis.cz>2015-12-23 02:22:27 +0100
commita4be37c118fb0dbe6c5b069e15379acc33f9612f (patch)
tree4b44d91cf539757d4b3944d4a31dcf2ae0be448f /kdeui
parentc1d2654b775fbd72cfc78b0c1420cfdee62ead47 (diff)
downloadtdelibs-a4be37c118fb0dbe6c5b069e15379acc33f9612f.tar.gz
tdelibs-a4be37c118fb0dbe6c5b069e15379acc33f9612f.zip
Reduce CPU usage of triggerless device polling routine
Fix TDEListView not emitting executed signal for part of entire highlighted item area (cherry picked from commit b282a7bb897aef54980dc0996a842a2253f013da)
Diffstat (limited to 'kdeui')
-rw-r--r--kdeui/kiconview.cpp2
-rw-r--r--kdeui/klistview.cpp78
-rw-r--r--kdeui/klistview.h2
3 files changed, 47 insertions, 35 deletions
diff --git a/kdeui/kiconview.cpp b/kdeui/kiconview.cpp
index 26ff21e86..a8b6bc0a2 100644
--- a/kdeui/kiconview.cpp
+++ b/kdeui/kiconview.cpp
@@ -247,7 +247,7 @@ void KIconView::emitExecute( TQIconViewItem *item, const TQPoint &pos )
m_pAutoSelect->stop();
- //Don�t emit executed if in SC mode and Shift or Ctrl are pressed
+ //Don't emit executed if in SC mode and Shift or Ctrl are pressed
if( !( m_bUseSingle && ((keybstate & ShiftButton) || (keybstate & ControlButton)) ) ) {
setSelected( item, false );
viewport()->unsetCursor();
diff --git a/kdeui/klistview.cpp b/kdeui/klistview.cpp
index b52fe6876..be0332e99 100644
--- a/kdeui/klistview.cpp
+++ b/kdeui/klistview.cpp
@@ -489,36 +489,45 @@ bool KListView::isExecuteArea( int x )
bool KListView::isExecuteArea( int x, TQListViewItem* item )
{
- if( allColumnsShowFocus() )
- return true;
- else {
- int offset = 0;
-
-
- int width = columnWidth( 0 );
-
- TQHeader* const thisHeader = header();
- const int pos = thisHeader->mapToIndex( 0 );
-
- for ( int index = 0; index < pos; ++index )
- offset += columnWidth( thisHeader->mapToSection( index ) );
-
- x += contentsX(); // in case of a horizontal scrollbar
-
- if ( item )
- {
- width = treeStepSize()*( item->depth() + ( rootIsDecorated() ? 1 : 0 ) );
- width += itemMargin();
- int ca = AlignHorizontal_Mask & columnAlignment( 0 );
- if ( ca == AlignLeft || ca == AlignAuto ) {
- width += item->width( fontMetrics(), this, 0 );
- if ( width > columnWidth( 0 ) )
- width = columnWidth( 0 );
+ if ( allColumnsShowFocus() ) {
+ return true;
+ }
+ else {
+ int offset = 0;
+ int width = columnWidth( 0 );
+
+ TQHeader* const thisHeader = header();
+ const int pos = thisHeader->mapToIndex( 0 );
+
+ for ( int index = 0; index < pos; ++index ) {
+ offset += columnWidth( thisHeader->mapToSection( index ) );
+ }
+
+ x += contentsX(); // in case of a horizontal scrollbar
+
+ // What was this supposed to do???
+ // Just use the column width, as at least one entire column is highlighted on row selection!
+#if 0
+ if ( item ) {
+ width = treeStepSize()*( item->depth() + ( rootIsDecorated() ? 1 : 0 ) );
+ width += itemMargin();
+ int ca = AlignHorizontal_Mask & columnAlignment( 0 );
+ if ( ca == AlignLeft || ca == AlignAuto ) {
+ width += item->width( fontMetrics(), this, 0 );
+ if ( width > columnWidth( 0 ) ) {
+ width = columnWidth( 0 );
+ }
+ }
+ }
+#endif
+ if ( item ) {
+ if (!allColumnsShowFocus()) {
+ offset += treeStepSize()*( item->depth() + ( rootIsDecorated() ? 1 : 0 ) );
+ }
+ }
+
+ return ( x > offset && x < ( offset + width ) );
}
- }
-
- return ( x > offset && x < ( offset + width ) );
- }
}
void KListView::slotOnItem( TQListViewItem *item )
@@ -883,8 +892,9 @@ void KListView::contentsMouseDoubleClickEvent ( TQMouseEvent *e )
// We don't want to call the parent method because it does setOpen,
// whereas we don't do it in single click mode... (David)
//TQListView::contentsMouseDoubleClickEvent( e );
- if ( !e || e->button() != Qt::LeftButton )
+ if ( !e || e->button() != Qt::LeftButton ) {
return;
+ }
TQPoint vp = contentsToViewport(e->pos());
TQListViewItem *item = itemAt( vp );
@@ -895,15 +905,17 @@ void KListView::contentsMouseDoubleClickEvent ( TQMouseEvent *e )
if( item ) {
emit doubleClicked( item, e->globalPos(), col );
- if( (e->button() == Qt::LeftButton) && !d->bUseSingle )
+ if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) {
emitExecute( item, e->globalPos(), col );
+ }
}
}
void KListView::slotMouseButtonClicked( int btn, TQListViewItem *item, const TQPoint &pos, int c )
{
- if( (btn == Qt::LeftButton) && item )
+ if( (btn == Qt::LeftButton) && item ) {
emitExecute(item, pos, c);
+ }
}
void KListView::contentsDropEvent(TQDropEvent* e)
@@ -2365,7 +2377,7 @@ void KListViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column,
void KListView::selectAll( bool select )
{
- if ( selectionMode() == Multi || selectionMode() == Extended ) {
+ if ( ((SelectionModeExt)selectionMode() == Multi) || ((SelectionModeExt)selectionMode() == Extended) ) {
bool b = signalsBlocked();
blockSignals( TRUE );
bool anything = FALSE;
diff --git a/kdeui/klistview.h b/kdeui/klistview.h
index db78b3cfb..1c3702e46 100644
--- a/kdeui/klistview.h
+++ b/kdeui/klistview.h
@@ -36,7 +36,7 @@ class KLineEdit;
* There is a new signal executed(). It gets connected to either
* TQListView::clicked() or TQListView::doubleClicked() depending on the KDE
* wide Single Click/Double Click settings. It is strongly recommended that
- * you use this signal instead of the above mentioned. This way you don´t
+ * you use this signal instead of the above mentioned. This way you don't
* need to care about the current settings.
* If you want to get informed when the user selects something connect to the
* TQListView::selectionChanged() signal.