-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 32483bb..6859d36 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -430,193 +430,193 @@ KListView::KListView( QWidget *parent, const char *name ) | |||
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 | ||
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 | 479 | ||
480 | bool KListView::isExecuteArea( int x ) | 480 | bool 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 | ||
497 | void KListView::slotOnItem( QListViewItem *item ) | 497 | void 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 | ||
506 | void KListView::slotOnViewport() | 506 | void 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 | ||
515 | void KListView::slotSettingsChanged(int category) | 515 | void 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 | ||
589 | void KListView::slotAutoSelect() | 589 | void 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(); |