-rw-r--r-- | microkde/kdeui/klistview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index f7d2187..60f3084 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -387,193 +387,193 @@ void 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". |
400 | void KListViewLineEdit::slotSelectionChanged() | 400 | void 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 | ||
408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) | 408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
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 | if ( emulateRightMouse ) | 413 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
415 | #endif | 415 | #endif |
416 | //US setDragAutoScroll(true); | 416 | //US setDragAutoScroll(true); |
417 | 417 | ||
418 | connect( this, SIGNAL( onViewport() ), | 418 | connect( this, SIGNAL( onViewport() ), |
419 | this, SLOT( slotOnViewport() ) ); | 419 | this, SLOT( slotOnViewport() ) ); |
420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), |
421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); |
422 | 422 | ||
423 | connect (this, SIGNAL(contentsMoving(int,int)), | 423 | connect (this, SIGNAL(contentsMoving(int,int)), |
424 | this, SLOT(cleanDropVisualizer())); | 424 | this, SLOT(cleanDropVisualizer())); |
425 | connect (this, SIGNAL(contentsMoving(int,int)), | 425 | connect (this, SIGNAL(contentsMoving(int,int)), |
426 | this, SLOT(cleanItemHighlighter())); | 426 | this, SLOT(cleanItemHighlighter())); |
427 | 427 | ||
428 | /*US | 428 | /*US |
429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
430 | 430 | ||
431 | if (kapp) | 431 | if (kapp) |
432 | { | 432 | { |
433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
435 | } | 435 | } |
436 | */ | 436 | */ |
437 | slotSettingsChanged(1); //US do this to initialize the connections | 437 | slotSettingsChanged(1); //US do this to initialize the connections |
438 | 438 | ||
439 | 439 | ||
440 | connect(&d->autoSelect, SIGNAL( timeout() ), | 440 | connect(&d->autoSelect, SIGNAL( timeout() ), |
441 | this, SLOT( slotAutoSelect() ) ); | 441 | this, SLOT( slotAutoSelect() ) ); |
442 | connect(&d->dragExpand, SIGNAL( timeout() ), | 442 | connect(&d->dragExpand, SIGNAL( timeout() ), |
443 | this, SLOT( slotDragExpand() ) ); | 443 | this, SLOT( slotDragExpand() ) ); |
444 | 444 | ||
445 | // context menu handling | 445 | // context menu handling |
446 | if (d->showContextMenusOnPress) | 446 | if (d->showContextMenusOnPress) |
447 | { | 447 | { |
448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
450 | } | 450 | } |
451 | else | 451 | else |
452 | { | 452 | { |
453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
455 | } | 455 | } |
456 | 456 | ||
457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), |
458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); |
459 | 459 | ||
460 | 460 | ||
461 | //qDebug("KListView::KListView make alternate color configurable"); | 461 | //qDebug("KListView::KListView make alternate color configurable"); |
462 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 462 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
463 | } | 463 | } |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | KListView::~KListView() | 467 | KListView::~KListView() |
468 | { | 468 | { |
469 | delete d; | 469 | delete d; |
470 | } | 470 | } |
471 | 471 | ||
472 | bool KListView::isExecuteArea( const QPoint& point ) | 472 | bool 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 | QSize KListView::sizeHint() const | 479 | QSize KListView::sizeHint() const |
480 | { | 480 | { |
481 | //qDebug("KListView::QSize sizeHint() "); | 481 | //qDebug("KListView::QSize sizeHint() "); |
482 | #ifdef DESKTOP_VERSION | 482 | #ifdef DESKTOP_VERSION |
483 | QListView::sizeHint(); | 483 | return QListView::sizeHint(); |
484 | #else | 484 | #else |
485 | return QSize ( 40, 40 ); | 485 | return QSize ( 40, 40 ); |
486 | #endif | 486 | #endif |
487 | 487 | ||
488 | } | 488 | } |
489 | bool KListView::isExecuteArea( int x ) | 489 | bool KListView::isExecuteArea( int x ) |
490 | { | 490 | { |
491 | if( allColumnsShowFocus() ) | 491 | if( allColumnsShowFocus() ) |
492 | return true; | 492 | return true; |
493 | else { | 493 | else { |
494 | int offset = 0; | 494 | int offset = 0; |
495 | int width = columnWidth( 0 ); | 495 | int width = columnWidth( 0 ); |
496 | int pos = header()->mapToIndex( 0 ); | 496 | int pos = header()->mapToIndex( 0 ); |
497 | 497 | ||
498 | for ( int index = 0; index < pos; index++ ) | 498 | for ( int index = 0; index < pos; index++ ) |
499 | offset += columnWidth( header()->mapToSection( index ) ); | 499 | offset += columnWidth( header()->mapToSection( index ) ); |
500 | 500 | ||
501 | x += contentsX(); // in case of a horizontal scrollbar | 501 | x += contentsX(); // in case of a horizontal scrollbar |
502 | return ( x > offset && x < ( offset + width ) ); | 502 | return ( x > offset && x < ( offset + width ) ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void KListView::slotOnItem( QListViewItem *item ) | 506 | void KListView::slotOnItem( QListViewItem *item ) |
507 | { | 507 | { |
508 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 508 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
509 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 509 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
510 | d->autoSelect.start( d->autoSelectDelay, true ); | 510 | d->autoSelect.start( d->autoSelectDelay, true ); |
511 | d->pCurrentItem = item; | 511 | d->pCurrentItem = item; |
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | void KListView::slotOnViewport() | 515 | void KListView::slotOnViewport() |
516 | { | 516 | { |
517 | if ( d->bChangeCursorOverItem ) | 517 | if ( d->bChangeCursorOverItem ) |
518 | viewport()->unsetCursor(); | 518 | viewport()->unsetCursor(); |
519 | 519 | ||
520 | d->autoSelect.stop(); | 520 | d->autoSelect.stop(); |
521 | d->pCurrentItem = 0L; | 521 | d->pCurrentItem = 0L; |
522 | } | 522 | } |
523 | 523 | ||
524 | void KListView::slotSettingsChanged(int category) | 524 | void KListView::slotSettingsChanged(int category) |
525 | { | 525 | { |
526 | //qDebug("KListView::slotSettingsChanged has to be verified"); | 526 | //qDebug("KListView::slotSettingsChanged has to be verified"); |
527 | 527 | ||
528 | 528 | ||
529 | switch (category) | 529 | switch (category) |
530 | { | 530 | { |
531 | //US I create my private category (=1) to set the settings | 531 | //US I create my private category (=1) to set the settings |
532 | case 1: | 532 | case 1: |
533 | d->dragDelay = 2; | 533 | d->dragDelay = 2; |
534 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); | 534 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); |
535 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); | 535 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); |
536 | 536 | ||
537 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 537 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
538 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 538 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
539 | 539 | ||
540 | if( d->bUseSingle ) | 540 | if( d->bUseSingle ) |
541 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 541 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
542 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 542 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
543 | 543 | ||
544 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 544 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
545 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 545 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
546 | 546 | ||
547 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 547 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
548 | viewport()->unsetCursor(); | 548 | viewport()->unsetCursor(); |
549 | 549 | ||
550 | break; | 550 | break; |
551 | 551 | ||
552 | /*US | 552 | /*US |
553 | case KApplication::SETTINGS_MOUSE: | 553 | case KApplication::SETTINGS_MOUSE: |
554 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 554 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
555 | d->bUseSingle = KGlobalSettings::singleClick(); | 555 | d->bUseSingle = KGlobalSettings::singleClick(); |
556 | 556 | ||
557 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 557 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
558 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 558 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
559 | 559 | ||
560 | if( d->bUseSingle ) | 560 | if( d->bUseSingle ) |
561 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 561 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
562 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 562 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
563 | 563 | ||
564 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 564 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
565 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 565 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
566 | 566 | ||
567 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 567 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
568 | viewport()->unsetCursor(); | 568 | viewport()->unsetCursor(); |
569 | 569 | ||
570 | break; | 570 | break; |
571 | case KApplication::SETTINGS_POPUPMENU: | 571 | case KApplication::SETTINGS_POPUPMENU: |
572 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); | 572 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); |
573 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); | 573 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); |
574 | 574 | ||
575 | if (d->showContextMenusOnPress) | 575 | if (d->showContextMenusOnPress) |
576 | { | 576 | { |
577 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 577 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
578 | 578 | ||
579 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 579 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |