summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-28 01:24:25 (UTC)
committer ulf69 <ulf69>2004-10-28 01:24:25 (UTC)
commit2fe1a56682ef4dc1fa0a30f764c7313b583631c5 (patch) (unidiff)
tree291b87266c05359c8a2ba9a54a9df182380f77ef
parent621a8505690485db909a573f83433873197595c0 (diff)
downloadkdepimpi-2fe1a56682ef4dc1fa0a30f764c7313b583631c5.zip
kdepimpi-2fe1a56682ef4dc1fa0a30f764c7313b583631c5.tar.gz
kdepimpi-2fe1a56682ef4dc1fa0a30f764c7313b583631c5.tar.bz2
removed debugoutput
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 32483bb..6859d36 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -142,769 +142,769 @@ public:
142 bool bUseSingle:1; 142 bool bUseSingle:1;
143 bool bChangeCursorOverItem:1; 143 bool bChangeCursorOverItem:1;
144 bool itemsMovable:1; 144 bool itemsMovable:1;
145 bool selectedBySimpleMove : 1; 145 bool selectedBySimpleMove : 1;
146 bool selectedUsingMouse:1; 146 bool selectedUsingMouse:1;
147 bool itemsRenameable:1; 147 bool itemsRenameable:1;
148 bool validDrag:1; 148 bool validDrag:1;
149 bool dragEnabled:1; 149 bool dragEnabled:1;
150 bool autoOpen:1; 150 bool autoOpen:1;
151 bool dropVisualizer:1; 151 bool dropVisualizer:1;
152 bool dropHighlighter:1; 152 bool dropHighlighter:1;
153 bool createChildren:1; 153 bool createChildren:1;
154 bool pressedOnSelected:1; 154 bool pressedOnSelected:1;
155 bool wasShiftEvent:1; 155 bool wasShiftEvent:1;
156 bool fullWidth:1; 156 bool fullWidth:1;
157 bool sortAscending:1; 157 bool sortAscending:1;
158 bool tabRename:1; 158 bool tabRename:1;
159 159
160 int sortColumn; 160 int sortColumn;
161 161
162 //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX 162 //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX
163 int selectionDirection; 163 int selectionDirection;
164 int tooltipColumn; 164 int tooltipColumn;
165 165
166 SelectionModeExt selectionMode; 166 SelectionModeExt selectionMode;
167 int contextMenuKey; 167 int contextMenuKey;
168 bool showContextMenusOnPress; 168 bool showContextMenusOnPress;
169 169
170 QRect mOldDropVisualizer; 170 QRect mOldDropVisualizer;
171 int mDropVisualizerWidth; 171 int mDropVisualizerWidth;
172 QRect mOldDropHighlighter; 172 QRect mOldDropHighlighter;
173 QListViewItem *afterItemDrop; 173 QListViewItem *afterItemDrop;
174 QListViewItem *parentItemDrop; 174 QListViewItem *parentItemDrop;
175 175
176 QColor alternateBackground; 176 QColor alternateBackground;
177}; 177};
178 178
179/*US 179/*US
180KListViewLineEdit::KListViewLineEdit(KListView *parent) 180KListViewLineEdit::KListViewLineEdit(KListView *parent)
181 : KLineEdit(parent->viewport()), item(0), col(0), p(parent) 181 : KLineEdit(parent->viewport()), item(0), col(0), p(parent)
182{ 182{
183 setFrame( false ); 183 setFrame( false );
184 hide(); 184 hide();
185 connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); 185 connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() ));
186} 186}
187 187
188KListViewLineEdit::~KListViewLineEdit() 188KListViewLineEdit::~KListViewLineEdit()
189{ 189{
190} 190}
191 191
192void KListViewLineEdit::load(QListViewItem *i, int c) 192void KListViewLineEdit::load(QListViewItem *i, int c)
193{ 193{
194 item=i; 194 item=i;
195 col=c; 195 col=c;
196 196
197 QRect rect(p->itemRect(i)); 197 QRect rect(p->itemRect(i));
198 setText(item->text(c)); 198 setText(item->text(c));
199 199
200 int fieldX = rect.x() - 1; 200 int fieldX = rect.x() - 1;
201 int fieldW = p->columnWidth(col) + 2; 201 int fieldW = p->columnWidth(col) + 2;
202 202
203 int pos = p->header()->mapToIndex(col); 203 int pos = p->header()->mapToIndex(col);
204 for ( int index = 0; index < pos; index++ ) 204 for ( int index = 0; index < pos; index++ )
205 fieldX += p->columnWidth( p->header()->mapToSection( index )); 205 fieldX += p->columnWidth( p->header()->mapToSection( index ));
206 206
207 if ( col == 0 ) { 207 if ( col == 0 ) {
208 int d = i->depth() + (p->rootIsDecorated() ? 1 : 0); 208 int d = i->depth() + (p->rootIsDecorated() ? 1 : 0);
209 d *= p->treeStepSize(); 209 d *= p->treeStepSize();
210 fieldX += d; 210 fieldX += d;
211 fieldW -= d; 211 fieldW -= d;
212 } 212 }
213 213
214 if ( i->pixmap( col ) ) {// add width of pixmap 214 if ( i->pixmap( col ) ) {// add width of pixmap
215 int d = i->pixmap( col )->width(); 215 int d = i->pixmap( col )->width();
216 fieldX += d; 216 fieldX += d;
217 fieldW -= d; 217 fieldW -= d;
218 } 218 }
219 219
220 setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); 220 setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2);
221 show(); 221 show();
222 setFocus(); 222 setFocus();
223} 223}
224*/ 224*/
225 /*Helper functions to for 225 /*Helper functions to for
226 *tabOrderedRename functionality. 226 *tabOrderedRename functionality.
227 */ 227 */
228 228
229static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) 229static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir)
230{ 230{
231 if (pi) 231 if (pi)
232 { 232 {
233 //Find the next renameable column in the current row 233 //Find the next renameable column in the current row
234 for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) 234 for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir)
235 if (pl->isRenameable(start)) 235 if (pl->isRenameable(start))
236 return start; 236 return start;
237 } 237 }
238 238
239 return -1; 239 return -1;
240} 240}
241 241
242static QListViewItem *prevItem (QListViewItem *pi) 242static QListViewItem *prevItem (QListViewItem *pi)
243{ 243{
244 QListViewItem *pa = pi->itemAbove(); 244 QListViewItem *pa = pi->itemAbove();
245 245
246 /*Does what the QListViewItem::previousSibling() 246 /*Does what the QListViewItem::previousSibling()
247 *of my dreams would do. 247 *of my dreams would do.
248 */ 248 */
249 if (pa && pa->parent() == pi->parent()) 249 if (pa && pa->parent() == pi->parent())
250 return pa; 250 return pa;
251 251
252 return NULL; 252 return NULL;
253} 253}
254 254
255static QListViewItem *lastQChild (QListViewItem *pi) 255static QListViewItem *lastQChild (QListViewItem *pi)
256{ 256{
257 if (pi) 257 if (pi)
258 { 258 {
259 /*Since there's no QListViewItem::lastChild(). 259 /*Since there's no QListViewItem::lastChild().
260 *This finds the last sibling for the given 260 *This finds the last sibling for the given
261 *item. 261 *item.
262 */ 262 */
263 for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) 263 for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
264 pi = pt; 264 pi = pt;
265 } 265 }
266 266
267 return pi; 267 return pi;
268} 268}
269/*US 269/*US
270void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) 270void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward)
271{ 271{
272 const int ncols = p->columns(); 272 const int ncols = p->columns();
273 const int dir = forward ? +1 : -1; 273 const int dir = forward ? +1 : -1;
274 const int restart = forward ? 0 : (ncols - 1); 274 const int restart = forward ? 0 : (ncols - 1);
275 QListViewItem *top = (pitem && pitem->parent()) 275 QListViewItem *top = (pitem && pitem->parent())
276 ? pitem->parent()->firstChild() 276 ? pitem->parent()->firstChild()
277 : p->firstChild(); 277 : p->firstChild();
278 QListViewItem *pi = pitem; 278 QListViewItem *pi = pitem;
279 279
280 terminate(); //Save current changes 280 terminate(); //Save current changes
281 281
282 do 282 do
283 { 283 {
284*/ 284*/
285 /*Check the rest of the current row for an editable column, 285 /*Check the rest of the current row for an editable column,
286 *if that fails, check the entire next/previous row. The 286 *if that fails, check the entire next/previous row. The
287 *last case goes back to the first item in the current branch 287 *last case goes back to the first item in the current branch
288 *or the last item in the current branch depending on the 288 *or the last item in the current branch depending on the
289 *direction. 289 *direction.
290 */ 290 */
291/*US 291/*US
292 if ((column = nextCol(p, pi, column + dir, dir)) != -1 || 292 if ((column = nextCol(p, pi, column + dir, dir)) != -1 ||
293 (column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 || 293 (column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 ||
294 (column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1) 294 (column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1)
295 { 295 {
296 if (pi) 296 if (pi)
297 { 297 {
298 p->setCurrentItem(pi); //Calls terminate 298 p->setCurrentItem(pi); //Calls terminate
299 p->rename(pi, column); 299 p->rename(pi, column);
300*/ 300*/
301 /*Some listviews may override rename() to 301 /*Some listviews may override rename() to
302 *prevent certain items from being renamed, 302 *prevent certain items from being renamed,
303 *if this is done, [m_]item will be NULL 303 *if this is done, [m_]item will be NULL
304 *after the rename() call... try again. 304 *after the rename() call... try again.
305 */ 305 */
306/*US 306/*US
307 if (!item) 307 if (!item)
308 continue; 308 continue;
309 309
310 break; 310 break;
311 } 311 }
312 } 312 }
313 } 313 }
314 while (pi && !item); 314 while (pi && !item);
315} 315}
316*/ 316*/
317 317
318/*US 318/*US
319#ifdef KeyPress 319#ifdef KeyPress
320#undef KeyPress 320#undef KeyPress
321#endif 321#endif
322 322
323bool KListViewLineEdit::event (QEvent *pe) 323bool KListViewLineEdit::event (QEvent *pe)
324{ 324{
325 if (pe->type() == QEvent::KeyPress) 325 if (pe->type() == QEvent::KeyPress)
326 { 326 {
327 QKeyEvent *k = (QKeyEvent *) pe; 327 QKeyEvent *k = (QKeyEvent *) pe;
328 328
329 if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && 329 if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) &&
330 p->tabOrderedRenaming() && p->itemsRenameable() && 330 p->tabOrderedRenaming() && p->itemsRenameable() &&
331 !(k->state() & ControlButton || k->state() & AltButton)) 331 !(k->state() & ControlButton || k->state() & AltButton))
332 { 332 {
333 selectNextCell(item, col, 333 selectNextCell(item, col,
334 (k->key() == Key_Tab && !(k->state() & ShiftButton))); 334 (k->key() == Key_Tab && !(k->state() & ShiftButton)));
335 return true; 335 return true;
336 } 336 }
337 } 337 }
338 338
339 return KLineEdit::event(pe); 339 return KLineEdit::event(pe);
340} 340}
341 341
342void KListViewLineEdit::keyPressEvent(QKeyEvent *e) 342void KListViewLineEdit::keyPressEvent(QKeyEvent *e)
343{ 343{
344 if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) 344 if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter )
345 terminate(true); 345 terminate(true);
346 else if(e->key() == Qt::Key_Escape) 346 else if(e->key() == Qt::Key_Escape)
347 terminate(false); 347 terminate(false);
348 else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) 348 else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up)
349 { 349 {
350 terminate(true); 350 terminate(true);
351 KLineEdit::keyPressEvent(e); 351 KLineEdit::keyPressEvent(e);
352 } 352 }
353 else 353 else
354 KLineEdit::keyPressEvent(e); 354 KLineEdit::keyPressEvent(e);
355} 355}
356 356
357void KListViewLineEdit::terminate() 357void KListViewLineEdit::terminate()
358{ 358{
359 terminate(true); 359 terminate(true);
360} 360}
361 361
362void KListViewLineEdit::terminate(bool commit) 362void KListViewLineEdit::terminate(bool commit)
363{ 363{
364 if ( item ) 364 if ( item )
365 { 365 {
366 //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; 366 //kdDebug() << "KListViewLineEdit::terminate " << commit << endl;
367 if (commit) 367 if (commit)
368 item->setText(col, text()); 368 item->setText(col, text());
369 int c=col; 369 int c=col;
370 QListViewItem *i=item; 370 QListViewItem *i=item;
371 col=0; 371 col=0;
372 item=0; 372 item=0;
373 hide(); // will call focusOutEvent, that's why we set item=0 before 373 hide(); // will call focusOutEvent, that's why we set item=0 before
374 emit done(i,c); 374 emit done(i,c);
375 } 375 }
376} 376}
377 377
378void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) 378void KListViewLineEdit::focusOutEvent(QFocusEvent *ev)
379{ 379{
380 QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); 380 QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev);
381 // Don't let a RMB close the editor 381 // Don't let a RMB close the editor
382 if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) 382 if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow)
383 terminate(true); 383 terminate(true);
384} 384}
385 385
386void KListViewLineEdit::paintEvent( QPaintEvent *e ) 386void KListViewLineEdit::paintEvent( QPaintEvent *e )
387{ 387{
388 KLineEdit::paintEvent( e ); 388 KLineEdit::paintEvent( e );
389 389
390 if ( !frame() ) { 390 if ( !frame() ) {
391 QPainter p( this ); 391 QPainter p( this );
392 p.setClipRegion( e->region() ); 392 p.setClipRegion( e->region() );
393 p.drawRect( rect() ); 393 p.drawRect( rect() );
394 } 394 }
395} 395}
396 396
397// selection changed -> terminate. As our "item" can be already deleted, 397// selection changed -> terminate. As our "item" can be already deleted,
398// we can't call terminate(false), because that would emit done() with 398// we can't call terminate(false), because that would emit done() with
399// a dangling pointer to "item". 399// a dangling pointer to "item".
400void KListViewLineEdit::slotSelectionChanged() 400void KListViewLineEdit::slotSelectionChanged()
401{ 401{
402 item = 0; 402 item = 0;
403 col = 0; 403 col = 0;
404 hide(); 404 hide();
405} 405}
406*/ 406*/
407 407
408KListView::KListView( QWidget *parent, const char *name ) 408KListView::KListView( QWidget *parent, const char *name )
409 : QListView( parent, name ), 409 : QListView( parent, name ),
410 d (new KListViewPrivate (this)) 410 d (new KListViewPrivate (this))
411{ 411{
412#ifndef DESKTOP_VERSION 412#ifndef DESKTOP_VERSION
413 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 413 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
414#endif 414#endif
415//US setDragAutoScroll(true); 415//US setDragAutoScroll(true);
416 416
417 connect( this, SIGNAL( onViewport() ), 417 connect( this, SIGNAL( onViewport() ),
418 this, SLOT( slotOnViewport() ) ); 418 this, SLOT( slotOnViewport() ) );
419 connect( this, SIGNAL( onItem( QListViewItem * ) ), 419 connect( this, SIGNAL( onItem( QListViewItem * ) ),
420 this, SLOT( slotOnItem( QListViewItem * ) ) ); 420 this, SLOT( slotOnItem( QListViewItem * ) ) );
421 421
422 connect (this, SIGNAL(contentsMoving(int,int)), 422 connect (this, SIGNAL(contentsMoving(int,int)),
423 this, SLOT(cleanDropVisualizer())); 423 this, SLOT(cleanDropVisualizer()));
424 connect (this, SIGNAL(contentsMoving(int,int)), 424 connect (this, SIGNAL(contentsMoving(int,int)),
425 this, SLOT(cleanItemHighlighter())); 425 this, SLOT(cleanItemHighlighter()));
426 426
427/*US 427/*US
428 slotSettingsChanged(KApplication::SETTINGS_MOUSE); 428 slotSettingsChanged(KApplication::SETTINGS_MOUSE);
429 429
430 if (kapp) 430 if (kapp)
431 { 431 {
432 connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); 432 connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) );
433 kapp->addKipcEventMask( KIPC::SettingsChanged ); 433 kapp->addKipcEventMask( KIPC::SettingsChanged );
434 } 434 }
435*/ 435*/
436 slotSettingsChanged(1); //US do this to initialize the connections 436 slotSettingsChanged(1); //US do this to initialize the connections
437 437
438 438
439 connect(&d->autoSelect, SIGNAL( timeout() ), 439 connect(&d->autoSelect, SIGNAL( timeout() ),
440 this, SLOT( slotAutoSelect() ) ); 440 this, SLOT( slotAutoSelect() ) );
441 connect(&d->dragExpand, SIGNAL( timeout() ), 441 connect(&d->dragExpand, SIGNAL( timeout() ),
442 this, SLOT( slotDragExpand() ) ); 442 this, SLOT( slotDragExpand() ) );
443 443
444 // context menu handling 444 // context menu handling
445 if (d->showContextMenusOnPress) 445 if (d->showContextMenusOnPress)
446 { 446 {
447 connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), 447 connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)),
448 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 448 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
449 } 449 }
450 else 450 else
451 { 451 {
452 connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), 452 connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
453 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 453 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
454 } 454 }
455 455
456 connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), 456 connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)),
457 this, SLOT (emitContextMenu (KListView*, QListViewItem*))); 457 this, SLOT (emitContextMenu (KListView*, QListViewItem*)));
458 458
459 459
460 //qDebug("KListView::KListView make alternate color configurable"); 460 //qDebug("KListView::KListView make alternate color configurable");
461//US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); 461//US d->alternateBackground = KGlobalSettings::alternateBackgroundColor();
462 d->alternateBackground = QColor(240, 240, 240); 462 d->alternateBackground = QColor(240, 240, 240);
463} 463}
464 464
465 465
466 466
467KListView::~KListView() 467KListView::~KListView()
468{ 468{
469 delete d; 469 delete d;
470} 470}
471 471
472bool KListView::isExecuteArea( const QPoint& point ) 472bool KListView::isExecuteArea( const QPoint& point )
473{ 473{
474 if ( itemAt( point ) ) 474 if ( itemAt( point ) )
475 return isExecuteArea( point.x() ); 475 return isExecuteArea( point.x() );
476 476
477 return false; 477 return false;
478} 478}
479 479
480bool KListView::isExecuteArea( int x ) 480bool KListView::isExecuteArea( int x )
481{ 481{
482 if( allColumnsShowFocus() ) 482 if( allColumnsShowFocus() )
483 return true; 483 return true;
484 else { 484 else {
485 int offset = 0; 485 int offset = 0;
486 int width = columnWidth( 0 ); 486 int width = columnWidth( 0 );
487 int pos = header()->mapToIndex( 0 ); 487 int pos = header()->mapToIndex( 0 );
488 488
489 for ( int index = 0; index < pos; index++ ) 489 for ( int index = 0; index < pos; index++ )
490 offset += columnWidth( header()->mapToSection( index ) ); 490 offset += columnWidth( header()->mapToSection( index ) );
491 491
492 x += contentsX(); // in case of a horizontal scrollbar 492 x += contentsX(); // in case of a horizontal scrollbar
493 return ( x > offset && x < ( offset + width ) ); 493 return ( x > offset && x < ( offset + width ) );
494 } 494 }
495} 495}
496 496
497void KListView::slotOnItem( QListViewItem *item ) 497void KListView::slotOnItem( QListViewItem *item )
498{ 498{
499 QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); 499 QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
500 if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { 500 if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) {
501 d->autoSelect.start( d->autoSelectDelay, true ); 501 d->autoSelect.start( d->autoSelectDelay, true );
502 d->pCurrentItem = item; 502 d->pCurrentItem = item;
503 } 503 }
504} 504}
505 505
506void KListView::slotOnViewport() 506void KListView::slotOnViewport()
507{ 507{
508 if ( d->bChangeCursorOverItem ) 508 if ( d->bChangeCursorOverItem )
509 viewport()->unsetCursor(); 509 viewport()->unsetCursor();
510 510
511 d->autoSelect.stop(); 511 d->autoSelect.stop();
512 d->pCurrentItem = 0L; 512 d->pCurrentItem = 0L;
513} 513}
514 514
515void KListView::slotSettingsChanged(int category) 515void KListView::slotSettingsChanged(int category)
516{ 516{
517 //qDebug("KListView::slotSettingsChanged has to be verified"); 517 //qDebug("KListView::slotSettingsChanged has to be verified");
518 518
519 519
520 switch (category) 520 switch (category)
521 { 521 {
522 //US I create my private category (=1) to set the settings 522 //US I create my private category (=1) to set the settings
523 case 1: 523 case 1:
524 d->dragDelay = 2; 524 d->dragDelay = 2;
525 //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); 525 //US set explicitly d->bUseSingle = KGlobalSettings::singleClick();
526 qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); 526 // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle);
527 527
528 disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), 528 disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
529 this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); 529 this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
530 530
531 if( d->bUseSingle ) 531 if( d->bUseSingle )
532 connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), 532 connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
533 this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); 533 this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
534 534
535 //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); 535 //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
536 //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); 536 //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
537 537
538 if( !d->bUseSingle || !d->bChangeCursorOverItem ) 538 if( !d->bUseSingle || !d->bChangeCursorOverItem )
539 viewport()->unsetCursor(); 539 viewport()->unsetCursor();
540 540
541 break; 541 break;
542 542
543 /*US 543 /*US
544 case KApplication::SETTINGS_MOUSE: 544 case KApplication::SETTINGS_MOUSE:
545 d->dragDelay = KGlobalSettings::dndEventDelay(); 545 d->dragDelay = KGlobalSettings::dndEventDelay();
546 d->bUseSingle = KGlobalSettings::singleClick(); 546 d->bUseSingle = KGlobalSettings::singleClick();
547 547
548 disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), 548 disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
549 this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); 549 this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
550 550
551 if( d->bUseSingle ) 551 if( d->bUseSingle )
552 connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), 552 connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
553 this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); 553 this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
554 554
555 d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); 555 d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
556 d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); 556 d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
557 557
558 if( !d->bUseSingle || !d->bChangeCursorOverItem ) 558 if( !d->bUseSingle || !d->bChangeCursorOverItem )
559 viewport()->unsetCursor(); 559 viewport()->unsetCursor();
560 560
561 break; 561 break;
562 case KApplication::SETTINGS_POPUPMENU: 562 case KApplication::SETTINGS_POPUPMENU:
563 d->contextMenuKey = KGlobalSettings::contextMenuKey (); 563 d->contextMenuKey = KGlobalSettings::contextMenuKey ();
564 d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); 564 d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress ();
565 565
566 if (d->showContextMenusOnPress) 566 if (d->showContextMenusOnPress)
567 { 567 {
568 disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 568 disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
569 569
570 connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), 570 connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)),
571 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 571 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
572 } 572 }
573 else 573 else
574 { 574 {
575 disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 575 disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
576 576
577 connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), 577 connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
578 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 578 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
579 } 579 }
580 break; 580 break;
581 */ 581 */
582 582
583 default: 583 default:
584 break; 584 break;
585 } 585 }
586 586
587} 587}
588 588
589void KListView::slotAutoSelect() 589void KListView::slotAutoSelect()
590{ 590{
591 // check that the item still exists 591 // check that the item still exists
592 if( itemIndex( d->pCurrentItem ) == -1 ) 592 if( itemIndex( d->pCurrentItem ) == -1 )
593 return; 593 return;
594 594
595 if (!isActiveWindow()) 595 if (!isActiveWindow())
596 { 596 {
597 d->autoSelect.stop(); 597 d->autoSelect.stop();
598 return; 598 return;
599 } 599 }
600 600
601 //Give this widget the keyboard focus. 601 //Give this widget the keyboard focus.
602 if( !hasFocus() ) 602 if( !hasFocus() )
603 setFocus(); 603 setFocus();
604 604
605 QListViewItem* previousItem = currentItem(); 605 QListViewItem* previousItem = currentItem();
606 setCurrentItem( d->pCurrentItem ); 606 setCurrentItem( d->pCurrentItem );
607 607
608#if 0 608#if 0
609#ifndef Q_WS_QWS 609#ifndef Q_WS_QWS
610 // FIXME(E): Implement for Qt Embedded 610 // FIXME(E): Implement for Qt Embedded
611 if( d->pCurrentItem ) { 611 if( d->pCurrentItem ) {
612 //Shift pressed? 612 //Shift pressed?
613 if( (keybstate & ShiftMask) ) { 613 if( (keybstate & ShiftMask) ) {
614 bool block = signalsBlocked(); 614 bool block = signalsBlocked();
615 blockSignals( true ); 615 blockSignals( true );
616 616
617 //No Ctrl? Then clear before! 617 //No Ctrl? Then clear before!
618 if( !(keybstate & ControlMask) ) 618 if( !(keybstate & ControlMask) )
619 clearSelection(); 619 clearSelection();
620 620
621 bool select = !d->pCurrentItem->isSelected(); 621 bool select = !d->pCurrentItem->isSelected();
622 bool update = viewport()->isUpdatesEnabled(); 622 bool update = viewport()->isUpdatesEnabled();
623 viewport()->setUpdatesEnabled( false ); 623 viewport()->setUpdatesEnabled( false );
624 624
625 bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); 625 bool down = previousItem->itemPos() < d->pCurrentItem->itemPos();
626 QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); 626 QListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
627 for ( ; lit.current(); ++lit ) { 627 for ( ; lit.current(); ++lit ) {
628 if ( down && lit.current() == d->pCurrentItem ) { 628 if ( down && lit.current() == d->pCurrentItem ) {
629 d->pCurrentItem->setSelected( select ); 629 d->pCurrentItem->setSelected( select );
630 break; 630 break;
631 } 631 }
632 if ( !down && lit.current() == previousItem ) { 632 if ( !down && lit.current() == previousItem ) {
633 previousItem->setSelected( select ); 633 previousItem->setSelected( select );
634 break; 634 break;
635 } 635 }
636 lit.current()->setSelected( select ); 636 lit.current()->setSelected( select );
637 } 637 }
638 638
639 blockSignals( block ); 639 blockSignals( block );
640 viewport()->setUpdatesEnabled( update ); 640 viewport()->setUpdatesEnabled( update );
641 triggerUpdate(); 641 triggerUpdate();
642 642
643 emit selectionChanged(); 643 emit selectionChanged();
644 644
645 if( selectionMode() == QListView::Single ) 645 if( selectionMode() == QListView::Single )
646 emit selectionChanged( d->pCurrentItem ); 646 emit selectionChanged( d->pCurrentItem );
647 } 647 }
648 else if( (keybstate & ControlMask) ) 648 else if( (keybstate & ControlMask) )
649 setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); 649 setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() );
650 else { 650 else {
651 bool block = signalsBlocked(); 651 bool block = signalsBlocked();
652 blockSignals( true ); 652 blockSignals( true );
653 653
654 if( !d->pCurrentItem->isSelected() ) 654 if( !d->pCurrentItem->isSelected() )
655 clearSelection(); 655 clearSelection();
656 656
657 blockSignals( block ); 657 blockSignals( block );
658 658
659 setSelected( d->pCurrentItem, true ); 659 setSelected( d->pCurrentItem, true );
660 } 660 }
661 } 661 }
662 else 662 else
663 kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl; 663 kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl;
664#endif 664#endif
665#endif 665#endif
666} 666}
667 667
668void KListView::slotHeaderChanged() 668void KListView::slotHeaderChanged()
669{ 669{
670 if (d->fullWidth && columns()) 670 if (d->fullWidth && columns())
671 { 671 {
672 int w = 0; 672 int w = 0;
673 for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); 673 for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i);
674 setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); 674 setColumnWidth( columns() - 1, viewport()->width() - w - 1 );
675 } 675 }
676} 676}
677 677
678void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) 678void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c)
679{ 679{
680 // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); 680 // qDebug("KListView::emitExecute buttonstate=%i", buttonstate);
681 if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { 681 if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) {
682 682
683 // Double click mode ? 683 // Double click mode ?
684 if ( !d->bUseSingle ) 684 if ( !d->bUseSingle )
685 { 685 {
686 emit executed( item ); 686 emit executed( item );
687 emit executed( item, pos, c ); 687 emit executed( item, pos, c );
688 } 688 }
689 else 689 else
690 { 690 {
691 //US special implementation for embedded systems 691 //US special implementation for embedded systems
692 d->autoSelect.stop(); 692 d->autoSelect.stop();
693 693
694 //Dont emit executed if in SC mode and Shift or Ctrl are pressed 694 //Dont emit executed if in SC mode and Shift or Ctrl are pressed
695 if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { 695 if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) {
696 // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { 696 // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) {
697 697
698 emit executed( item ); 698 emit executed( item );
699 emit executed( item, pos, c ); 699 emit executed( item, pos, c );
700 } 700 }
701 } 701 }
702 } 702 }
703} 703}
704 704
705void KListView::focusInEvent( QFocusEvent *fe ) 705void KListView::focusInEvent( QFocusEvent *fe )
706{ 706{
707 // kdDebug()<<"KListView::focusInEvent()"<<endl; 707 // kdDebug()<<"KListView::focusInEvent()"<<endl;
708 QListView::focusInEvent( fe ); 708 QListView::focusInEvent( fe );
709 if ((d->selectedBySimpleMove) 709 if ((d->selectedBySimpleMove)
710 && (d->selectionMode == FileManager) 710 && (d->selectionMode == FileManager)
711 && (fe->reason()!=QFocusEvent::Popup) 711 && (fe->reason()!=QFocusEvent::Popup)
712 && (fe->reason()!=QFocusEvent::ActiveWindow) 712 && (fe->reason()!=QFocusEvent::ActiveWindow)
713 && (currentItem()!=0)) 713 && (currentItem()!=0))
714 { 714 {
715 currentItem()->setSelected(true); 715 currentItem()->setSelected(true);
716 currentItem()->repaint(); 716 currentItem()->repaint();
717 emit selectionChanged(); 717 emit selectionChanged();
718 }; 718 };
719} 719}
720 720
721void KListView::focusOutEvent( QFocusEvent *fe ) 721void KListView::focusOutEvent( QFocusEvent *fe )
722{ 722{
723 cleanDropVisualizer(); 723 cleanDropVisualizer();
724 cleanItemHighlighter(); 724 cleanItemHighlighter();
725 725
726 d->autoSelect.stop(); 726 d->autoSelect.stop();
727 727
728 if ((d->selectedBySimpleMove) 728 if ((d->selectedBySimpleMove)
729 && (d->selectionMode == FileManager) 729 && (d->selectionMode == FileManager)
730 && (fe->reason()!=QFocusEvent::Popup) 730 && (fe->reason()!=QFocusEvent::Popup)
731 && (fe->reason()!=QFocusEvent::ActiveWindow) 731 && (fe->reason()!=QFocusEvent::ActiveWindow)
732 && (currentItem()!=0) 732 && (currentItem()!=0)
733/*US && (!d->editor->isVisible()) */ 733/*US && (!d->editor->isVisible()) */
734 ) 734 )
735 { 735 {
736 currentItem()->setSelected(false); 736 currentItem()->setSelected(false);
737 currentItem()->repaint(); 737 currentItem()->repaint();
738 emit selectionChanged(); 738 emit selectionChanged();
739 }; 739 };
740 740
741 QListView::focusOutEvent( fe ); 741 QListView::focusOutEvent( fe );
742} 742}
743 743
744void KListView::leaveEvent( QEvent *e ) 744void KListView::leaveEvent( QEvent *e )
745{ 745{
746 d->autoSelect.stop(); 746 d->autoSelect.stop();
747 747
748 QListView::leaveEvent( e ); 748 QListView::leaveEvent( e );
749} 749}
750 750
751bool KListView::event( QEvent *e ) 751bool KListView::event( QEvent *e )
752{ 752{
753 if (e->type() == QEvent::ApplicationPaletteChange) { 753 if (e->type() == QEvent::ApplicationPaletteChange) {
754 //qDebug("KListView::event make alternate color configurable"); 754 //qDebug("KListView::event make alternate color configurable");
755//US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); 755//US d->alternateBackground=KGlobalSettings::alternateBackgroundColor();
756 d->alternateBackground = QColor(240, 240, 240); 756 d->alternateBackground = QColor(240, 240, 240);
757 } 757 }
758 758
759 return QListView::event(e); 759 return QListView::event(e);
760} 760}
761 761
762void KListView::contentsMousePressEvent( QMouseEvent *e ) 762void KListView::contentsMousePressEvent( QMouseEvent *e )
763{ 763{
764 //qDebug("KListView::contentsMousePressEvent"); 764 //qDebug("KListView::contentsMousePressEvent");
765 if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) 765 if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) )
766 { 766 {
767 bool block = signalsBlocked(); 767 bool block = signalsBlocked();
768 blockSignals( true ); 768 blockSignals( true );
769 769
770 clearSelection(); 770 clearSelection();
771 771
772 blockSignals( block ); 772 blockSignals( block );
773 } 773 }
774 else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) 774 else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove))
775 { 775 {
776 d->selectedBySimpleMove=false; 776 d->selectedBySimpleMove=false;
777 d->selectedUsingMouse=true; 777 d->selectedUsingMouse=true;
778 if (currentItem()!=0) 778 if (currentItem()!=0)
779 { 779 {
780 currentItem()->setSelected(false); 780 currentItem()->setSelected(false);
781 currentItem()->repaint(); 781 currentItem()->repaint();
782// emit selectionChanged(); 782// emit selectionChanged();
783 }; 783 };
784 }; 784 };
785 785
786 QPoint p( contentsToViewport( e->pos() ) ); 786 QPoint p( contentsToViewport( e->pos() ) );
787 QListViewItem *at = itemAt (p); 787 QListViewItem *at = itemAt (p);
788 788
789 // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) 789 // true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
790 bool rootDecoClicked = at 790 bool rootDecoClicked = at
791 && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + 791 && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
792 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) 792 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
793 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); 793 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
794 794
795 if (e->button() == LeftButton && !rootDecoClicked) 795 if (e->button() == LeftButton && !rootDecoClicked)
796 { 796 {
797 //Start a drag 797 //Start a drag
798 d->startDragPos = e->pos(); 798 d->startDragPos = e->pos();
799 799
800 if (at) 800 if (at)
801 { 801 {
802 d->validDrag = true; 802 d->validDrag = true;
803 d->pressedOnSelected = at->isSelected(); 803 d->pressedOnSelected = at->isSelected();
804 } 804 }
805 } 805 }
806 806
807 QListView::contentsMousePressEvent( e ); 807 QListView::contentsMousePressEvent( e );
808} 808}
809 809
810void KListView::contentsMouseMoveEvent( QMouseEvent *e ) 810void KListView::contentsMouseMoveEvent( QMouseEvent *e )
811{ 811{
812 if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { 812 if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) {
813 QListView::contentsMouseMoveEvent (e); 813 QListView::contentsMouseMoveEvent (e);
814 return; 814 return;
815 } 815 }
816 816
817 QPoint vp = contentsToViewport(e->pos()); 817 QPoint vp = contentsToViewport(e->pos());
818 QListViewItem *item = itemAt( vp ); 818 QListViewItem *item = itemAt( vp );
819 819
820 //do we process cursor changes at all? 820 //do we process cursor changes at all?
821 if ( item && d->bChangeCursorOverItem && d->bUseSingle ) 821 if ( item && d->bChangeCursorOverItem && d->bUseSingle )
822 { 822 {
823 //Cursor moved on a new item or in/out the execute area 823 //Cursor moved on a new item or in/out the execute area
824 if( (item != d->pCurrentItem) || 824 if( (item != d->pCurrentItem) ||
825 (isExecuteArea(vp) != d->cursorInExecuteArea) ) 825 (isExecuteArea(vp) != d->cursorInExecuteArea) )
826 { 826 {
827 d->cursorInExecuteArea = isExecuteArea(vp); 827 d->cursorInExecuteArea = isExecuteArea(vp);
828 //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); 828 //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet");
829/*US 829/*US
830 if( d->cursorInExecuteArea ) //cursor moved in execute area 830 if( d->cursorInExecuteArea ) //cursor moved in execute area
831 viewport()->setCursor( KCursor::handCursor() ); 831 viewport()->setCursor( KCursor::handCursor() );
832 else //cursor moved out of execute area 832 else //cursor moved out of execute area
833 viewport()->unsetCursor(); 833 viewport()->unsetCursor();
834*/ 834*/
835 } 835 }
836 } 836 }
837 837
838 bool dragOn = dragEnabled(); 838 bool dragOn = dragEnabled();
839 QPoint newPos = e->pos(); 839 QPoint newPos = e->pos();
840 if (dragOn && d->validDrag && 840 if (dragOn && d->validDrag &&
841 (newPos.x() > d->startDragPos.x()+d->dragDelay || 841 (newPos.x() > d->startDragPos.x()+d->dragDelay ||
842 newPos.x() < d->startDragPos.x()-d->dragDelay || 842 newPos.x() < d->startDragPos.x()-d->dragDelay ||
843 newPos.y() > d->startDragPos.y()+d->dragDelay || 843 newPos.y() > d->startDragPos.y()+d->dragDelay ||
844 newPos.y() < d->startDragPos.y()-d->dragDelay)) 844 newPos.y() < d->startDragPos.y()-d->dragDelay))
845 //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) 845 //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
846 { 846 {
847 QListView::contentsMouseReleaseEvent( 0 ); 847 QListView::contentsMouseReleaseEvent( 0 );
848 startDrag(); 848 startDrag();
849 d->startDragPos = QPoint(); 849 d->startDragPos = QPoint();
850 d->validDrag = false; 850 d->validDrag = false;
851 } 851 }
852} 852}
853 853
854void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) 854void KListView::contentsMouseReleaseEvent( QMouseEvent *e )
855{ 855{
856 if (e->button() == LeftButton) 856 if (e->button() == LeftButton)
857 { 857 {
858 // If the row was already selected, maybe we want to start an in-place editing 858 // If the row was already selected, maybe we want to start an in-place editing
859 if ( d->pressedOnSelected && itemsRenameable() ) 859 if ( d->pressedOnSelected && itemsRenameable() )
860 { 860 {
861 QPoint p( contentsToViewport( e->pos() ) ); 861 QPoint p( contentsToViewport( e->pos() ) );
862 QListViewItem *at = itemAt (p); 862 QListViewItem *at = itemAt (p);
863 if ( at ) 863 if ( at )
864 { 864 {
865 // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) 865 // true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
866 bool rootDecoClicked = 866 bool rootDecoClicked =
867 ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + 867 ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
868 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) 868 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
869 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); 869 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
870 870
871 if (!rootDecoClicked) 871 if (!rootDecoClicked)
872 { 872 {
873 int col = header()->mapToLogical( header()->cellAt( p.x() ) ); 873 int col = header()->mapToLogical( header()->cellAt( p.x() ) );
874 if ( d->renameable.contains(col) ) 874 if ( d->renameable.contains(col) )
875 rename(at, col); 875 rename(at, col);
876 } 876 }
877 } 877 }
878 } 878 }
879 879
880 d->pressedOnSelected = false; 880 d->pressedOnSelected = false;
881 d->validDrag = false; 881 d->validDrag = false;
882 d->startDragPos = QPoint(); 882 d->startDragPos = QPoint();
883 } 883 }
884 QListView::contentsMouseReleaseEvent( e ); 884 QListView::contentsMouseReleaseEvent( e );
885} 885}
886 886
887void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) 887void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e )
888{ 888{
889 //qDebug("KListView::contentsMouseDoubleClickEvent"); 889 //qDebug("KListView::contentsMouseDoubleClickEvent");
890 // We don't want to call the parent method because it does setOpen, 890 // We don't want to call the parent method because it does setOpen,
891 // whereas we don't do it in single click mode... (David) 891 // whereas we don't do it in single click mode... (David)
892 //QListView::contentsMouseDoubleClickEvent( e ); 892 //QListView::contentsMouseDoubleClickEvent( e );
893 893
894 QPoint vp = contentsToViewport(e->pos()); 894 QPoint vp = contentsToViewport(e->pos());
895 QListViewItem *item = itemAt( vp ); 895 QListViewItem *item = itemAt( vp );
896 emit QListView::doubleClicked( item ); // we do it now 896 emit QListView::doubleClicked( item ); // we do it now
897 897
898 int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; 898 int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1;
899 899
900 if( item ) { 900 if( item ) {
901 //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); 901 //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked");
902 902
903 emit doubleClicked( item, e->globalPos(), col ); 903 emit doubleClicked( item, e->globalPos(), col );
904 904
905 if( (e->button() == LeftButton) && !d->bUseSingle ) { 905 if( (e->button() == LeftButton) && !d->bUseSingle ) {
906 //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); 906 //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute");
907 907
908 emitExecute( e->button(), item, e->globalPos(), col); 908 emitExecute( e->button(), item, e->globalPos(), col);
909 } 909 }
910 } 910 }