author | ulf69 <ulf69> | 2004-10-28 00:07:51 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-28 00:07:51 (UTC) |
commit | 0766b449ccdcc125c18c401d87cc51c277464728 (patch) (unidiff) | |
tree | 5279c7c3f441f448ecb82f1400439e4a7498dde3 | |
parent | 5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c (diff) | |
download | kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.zip kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.gz kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.bz2 |
bugfix: KListView did not recognize singleclicks
-rw-r--r-- | microkde/kdeui/klistview.cpp | 88 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 7 |
2 files changed, 65 insertions, 30 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 3c809b4..32483bb 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -506,76 +506,93 @@ void KListView::slotOnItem( QListViewItem *item ) | |||
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 | /*US | 518 | |
519 | 519 | ||
520 | switch (category) | 520 | switch (category) |
521 | { | 521 | { |
522 | //US I create my private category (=1) to set the settings | ||
523 | case 1: | ||
524 | d->dragDelay = 2; | ||
525 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); | ||
526 | qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); | ||
527 | |||
528 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | ||
529 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | ||
530 | |||
531 | if( d->bUseSingle ) | ||
532 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | ||
533 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | ||
534 | |||
535 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | ||
536 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | ||
537 | |||
538 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | ||
539 | viewport()->unsetCursor(); | ||
540 | |||
541 | break; | ||
542 | |||
543 | /*US | ||
522 | case KApplication::SETTINGS_MOUSE: | 544 | case KApplication::SETTINGS_MOUSE: |
523 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 545 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
524 | d->bUseSingle = KGlobalSettings::singleClick(); | 546 | d->bUseSingle = KGlobalSettings::singleClick(); |
525 | 547 | ||
526 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 548 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
527 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 549 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
528 | 550 | ||
529 | if( d->bUseSingle ) | 551 | if( d->bUseSingle ) |
530 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 552 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
531 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 553 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
532 | 554 | ||
533 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 555 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
534 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 556 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
535 | 557 | ||
536 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 558 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
537 | viewport()->unsetCursor(); | 559 | viewport()->unsetCursor(); |
538 | 560 | ||
539 | break; | 561 | break; |
540 | |||
541 | case KApplication::SETTINGS_POPUPMENU: | 562 | case KApplication::SETTINGS_POPUPMENU: |
542 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); | 563 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); |
543 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); | 564 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); |
544 | 565 | ||
545 | if (d->showContextMenusOnPress) | 566 | if (d->showContextMenusOnPress) |
546 | { | 567 | { |
547 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 568 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
548 | 569 | ||
549 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 570 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
550 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 571 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
551 | } | 572 | } |
552 | else | 573 | else |
553 | { | 574 | { |
554 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 575 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
555 | 576 | ||
556 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 577 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
557 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 578 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
558 | } | 579 | } |
559 | break; | 580 | break; |
581 | */ | ||
560 | 582 | ||
561 | default: | 583 | default: |
562 | break; | 584 | break; |
563 | } | 585 | } |
564 | */ | ||
565 | 586 | ||
566 | if( d->bUseSingle ) | ||
567 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | ||
568 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | ||
569 | |||
570 | } | 587 | } |
571 | 588 | ||
572 | void KListView::slotAutoSelect() | 589 | void KListView::slotAutoSelect() |
573 | { | 590 | { |
574 | // check that the item still exists | 591 | // check that the item still exists |
575 | if( itemIndex( d->pCurrentItem ) == -1 ) | 592 | if( itemIndex( d->pCurrentItem ) == -1 ) |
576 | return; | 593 | return; |
577 | 594 | ||
578 | if (!isActiveWindow()) | 595 | if (!isActiveWindow()) |
579 | { | 596 | { |
580 | d->autoSelect.stop(); | 597 | d->autoSelect.stop(); |
581 | return; | 598 | return; |
@@ -649,55 +666,47 @@ void KListView::slotAutoSelect() | |||
649 | } | 666 | } |
650 | 667 | ||
651 | void KListView::slotHeaderChanged() | 668 | void KListView::slotHeaderChanged() |
652 | { | 669 | { |
653 | if (d->fullWidth && columns()) | 670 | if (d->fullWidth && columns()) |
654 | { | 671 | { |
655 | int w = 0; | 672 | int w = 0; |
656 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); | 673 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); |
657 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); | 674 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); |
658 | } | 675 | } |
659 | } | 676 | } |
660 | 677 | ||
661 | void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) | 678 | void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) |
662 | { | 679 | { |
680 | // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); | ||
663 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { | 681 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { |
664 | 682 | ||
665 | // Double click mode ? | 683 | // Double click mode ? |
666 | if ( !d->bUseSingle ) | 684 | if ( !d->bUseSingle ) |
667 | { | 685 | { |
668 | emit executed( item ); | 686 | emit executed( item ); |
669 | emit executed( item, pos, c ); | 687 | emit executed( item, pos, c ); |
670 | } | 688 | } |
671 | else | 689 | else |
672 | { | 690 | { |
673 | #if 0 | 691 | //US special implementation for embedded systems |
674 | #ifndef Q_WS_QWS | ||
675 | // FIXME(E): Implement for Qt Embedded | ||
676 | Window root; | ||
677 | Window child; | ||
678 | int root_x, root_y, win_x, win_y; | ||
679 | uint keybstate; | ||
680 | XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, | ||
681 | &root_x, &root_y, &win_x, &win_y, &keybstate ); | ||
682 | |||
683 | d->autoSelect.stop(); | 692 | d->autoSelect.stop(); |
684 | 693 | ||
685 | //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 |
686 | if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { | 695 | if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { |
696 | // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { | ||
697 | |||
687 | emit executed( item ); | 698 | emit executed( item ); |
688 | emit executed( item, pos, c ); | 699 | emit executed( item, pos, c ); |
689 | } | 700 | } |
690 | #endif | ||
691 | #endif | ||
692 | } | 701 | } |
693 | } | 702 | } |
694 | } | 703 | } |
695 | 704 | ||
696 | void KListView::focusInEvent( QFocusEvent *fe ) | 705 | void KListView::focusInEvent( QFocusEvent *fe ) |
697 | { | 706 | { |
698 | // kdDebug()<<"KListView::focusInEvent()"<<endl; | 707 | // kdDebug()<<"KListView::focusInEvent()"<<endl; |
699 | QListView::focusInEvent( fe ); | 708 | QListView::focusInEvent( fe ); |
700 | if ((d->selectedBySimpleMove) | 709 | if ((d->selectedBySimpleMove) |
701 | && (d->selectionMode == FileManager) | 710 | && (d->selectionMode == FileManager) |
702 | && (fe->reason()!=QFocusEvent::Popup) | 711 | && (fe->reason()!=QFocusEvent::Popup) |
703 | && (fe->reason()!=QFocusEvent::ActiveWindow) | 712 | && (fe->reason()!=QFocusEvent::ActiveWindow) |
@@ -733,34 +742,35 @@ void KListView::focusOutEvent( QFocusEvent *fe ) | |||
733 | } | 742 | } |
734 | 743 | ||
735 | void KListView::leaveEvent( QEvent *e ) | 744 | void KListView::leaveEvent( QEvent *e ) |
736 | { | 745 | { |
737 | d->autoSelect.stop(); | 746 | d->autoSelect.stop(); |
738 | 747 | ||
739 | QListView::leaveEvent( e ); | 748 | QListView::leaveEvent( e ); |
740 | } | 749 | } |
741 | 750 | ||
742 | bool KListView::event( QEvent *e ) | 751 | bool KListView::event( QEvent *e ) |
743 | { | 752 | { |
744 | if (e->type() == QEvent::ApplicationPaletteChange) { | 753 | if (e->type() == QEvent::ApplicationPaletteChange) { |
745 | qDebug("KListView::event make alternate color configurable"); | 754 | //qDebug("KListView::event make alternate color configurable"); |
746 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); | 755 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); |
747 | d->alternateBackground = QColor(240, 240, 240); | 756 | d->alternateBackground = QColor(240, 240, 240); |
748 | } | 757 | } |
749 | 758 | ||
750 | return QListView::event(e); | 759 | return QListView::event(e); |
751 | } | 760 | } |
752 | 761 | ||
753 | void KListView::contentsMousePressEvent( QMouseEvent *e ) | 762 | void KListView::contentsMousePressEvent( QMouseEvent *e ) |
754 | { | 763 | { |
764 | //qDebug("KListView::contentsMousePressEvent"); | ||
755 | if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) | 765 | if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) |
756 | { | 766 | { |
757 | bool block = signalsBlocked(); | 767 | bool block = signalsBlocked(); |
758 | blockSignals( true ); | 768 | blockSignals( true ); |
759 | 769 | ||
760 | clearSelection(); | 770 | clearSelection(); |
761 | 771 | ||
762 | blockSignals( block ); | 772 | blockSignals( block ); |
763 | } | 773 | } |
764 | else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) | 774 | else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) |
765 | { | 775 | { |
766 | d->selectedBySimpleMove=false; | 776 | d->selectedBySimpleMove=false; |
@@ -806,25 +816,25 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) | |||
806 | 816 | ||
807 | QPoint vp = contentsToViewport(e->pos()); | 817 | QPoint vp = contentsToViewport(e->pos()); |
808 | QListViewItem *item = itemAt( vp ); | 818 | QListViewItem *item = itemAt( vp ); |
809 | 819 | ||
810 | //do we process cursor changes at all? | 820 | //do we process cursor changes at all? |
811 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) | 821 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) |
812 | { | 822 | { |
813 | //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 |
814 | if( (item != d->pCurrentItem) || | 824 | if( (item != d->pCurrentItem) || |
815 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) | 825 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) |
816 | { | 826 | { |
817 | d->cursorInExecuteArea = isExecuteArea(vp); | 827 | d->cursorInExecuteArea = isExecuteArea(vp); |
818 | qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); | 828 | //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); |
819 | /*US | 829 | /*US |
820 | if( d->cursorInExecuteArea ) //cursor moved in execute area | 830 | if( d->cursorInExecuteArea ) //cursor moved in execute area |
821 | viewport()->setCursor( KCursor::handCursor() ); | 831 | viewport()->setCursor( KCursor::handCursor() ); |
822 | else //cursor moved out of execute area | 832 | else //cursor moved out of execute area |
823 | viewport()->unsetCursor(); | 833 | viewport()->unsetCursor(); |
824 | */ | 834 | */ |
825 | } | 835 | } |
826 | } | 836 | } |
827 | 837 | ||
828 | bool dragOn = dragEnabled(); | 838 | bool dragOn = dragEnabled(); |
829 | QPoint newPos = e->pos(); | 839 | QPoint newPos = e->pos(); |
830 | if (dragOn && d->validDrag && | 840 | if (dragOn && d->validDrag && |
@@ -867,46 +877,57 @@ void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) | |||
867 | } | 877 | } |
868 | } | 878 | } |
869 | 879 | ||
870 | d->pressedOnSelected = false; | 880 | d->pressedOnSelected = false; |
871 | d->validDrag = false; | 881 | d->validDrag = false; |
872 | d->startDragPos = QPoint(); | 882 | d->startDragPos = QPoint(); |
873 | } | 883 | } |
874 | QListView::contentsMouseReleaseEvent( e ); | 884 | QListView::contentsMouseReleaseEvent( e ); |
875 | } | 885 | } |
876 | 886 | ||
877 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) | 887 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) |
878 | { | 888 | { |
889 | //qDebug("KListView::contentsMouseDoubleClickEvent"); | ||
879 | // 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, |
880 | // whereas we don't do it in single click mode... (David) | 891 | // whereas we don't do it in single click mode... (David) |
881 | //QListView::contentsMouseDoubleClickEvent( e ); | 892 | //QListView::contentsMouseDoubleClickEvent( e ); |
882 | 893 | ||
883 | QPoint vp = contentsToViewport(e->pos()); | 894 | QPoint vp = contentsToViewport(e->pos()); |
884 | QListViewItem *item = itemAt( vp ); | 895 | QListViewItem *item = itemAt( vp ); |
885 | emit QListView::doubleClicked( item ); // we do it now | 896 | emit QListView::doubleClicked( item ); // we do it now |
886 | 897 | ||
887 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; | 898 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; |
888 | 899 | ||
889 | if( item ) { | 900 | if( item ) { |
901 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); | ||
902 | |||
890 | emit doubleClicked( item, e->globalPos(), col ); | 903 | emit doubleClicked( item, e->globalPos(), col ); |
891 | 904 | ||
892 | if( (e->button() == LeftButton) && !d->bUseSingle ) | 905 | if( (e->button() == LeftButton) && !d->bUseSingle ) { |
893 | emitExecute( item, e->globalPos(), col ); | 906 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); |
907 | |||
908 | emitExecute( e->button(), item, e->globalPos(), col); | ||
909 | } | ||
894 | } | 910 | } |
895 | } | 911 | } |
896 | 912 | ||
897 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) | 913 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) |
898 | { | 914 | { |
899 | if( (btn == LeftButton) && item ) | 915 | //qDebug("KListView::slotMouseButtonClicked"); |
900 | emitExecute(item, pos, c); | 916 | |
917 | if( (btn == LeftButton) && item ) { | ||
918 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); | ||
919 | |||
920 | emitExecute(btn, item, pos, c); | ||
921 | } | ||
901 | } | 922 | } |
902 | 923 | ||
903 | void KListView::contentsDropEvent(QDropEvent* e) | 924 | void KListView::contentsDropEvent(QDropEvent* e) |
904 | { | 925 | { |
905 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 926 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
906 | /*US | 927 | /*US |
907 | cleanDropVisualizer(); | 928 | cleanDropVisualizer(); |
908 | cleanItemHighlighter(); | 929 | cleanItemHighlighter(); |
909 | d->dragExpand.stop(); | 930 | d->dragExpand.stop(); |
910 | 931 | ||
911 | if (acceptDrag (e)) | 932 | if (acceptDrag (e)) |
912 | { | 933 | { |
@@ -974,25 +995,25 @@ void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) | |||
974 | i->setSelected(true); | 995 | i->setSelected(true); |
975 | if (current) | 996 | if (current) |
976 | setCurrentItem(current); | 997 | setCurrentItem(current); |
977 | 998 | ||
978 | emit moved(items,afterFirsts,afterNows); | 999 | emit moved(items,afterFirsts,afterNows); |
979 | 1000 | ||
980 | if (firstChild()) | 1001 | if (firstChild()) |
981 | emit moved(); | 1002 | emit moved(); |
982 | } | 1003 | } |
983 | 1004 | ||
984 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) | 1005 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) |
985 | { | 1006 | { |
986 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 1007 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
987 | /*US | 1008 | /*US |
988 | if (acceptDrag(event)) | 1009 | if (acceptDrag(event)) |
989 | { | 1010 | { |
990 | event->acceptAction(); | 1011 | event->acceptAction(); |
991 | //Clean up the view | 1012 | //Clean up the view |
992 | 1013 | ||
993 | findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop); | 1014 | findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop); |
994 | QPoint vp = contentsToViewport( event->pos() ); | 1015 | QPoint vp = contentsToViewport( event->pos() ); |
995 | QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L; | 1016 | QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L; |
996 | 1017 | ||
997 | if ( item != d->dragOverItem ) | 1018 | if ( item != d->dragOverItem ) |
998 | { | 1019 | { |
@@ -1879,25 +1900,25 @@ void KListView::emitContextMenu (KListView*, QListViewItem* i) | |||
1879 | // qDebug("KListView::emitContextMenu "); | 1900 | // qDebug("KListView::emitContextMenu "); |
1880 | 1901 | ||
1881 | if (i) | 1902 | if (i) |
1882 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1903 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1883 | else | 1904 | else |
1884 | p = mapToGlobal(rect().center()); | 1905 | p = mapToGlobal(rect().center()); |
1885 | 1906 | ||
1886 | emit contextMenu (this, i, p); | 1907 | emit contextMenu (this, i, p); |
1887 | } | 1908 | } |
1888 | 1909 | ||
1889 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) | 1910 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) |
1890 | { | 1911 | { |
1891 | qDebug("KListView::emitContextMenu col"); | 1912 | // qDebug("KListView::emitContextMenu col"); |
1892 | emit contextRequest( i, p, col ); | 1913 | emit contextRequest( i, p, col ); |
1893 | emit contextMenu (this, i, p); | 1914 | emit contextMenu (this, i, p); |
1894 | } | 1915 | } |
1895 | 1916 | ||
1896 | void KListView::setAcceptDrops (bool val) | 1917 | void KListView::setAcceptDrops (bool val) |
1897 | { | 1918 | { |
1898 | QListView::setAcceptDrops (val); | 1919 | QListView::setAcceptDrops (val); |
1899 | viewport()->setAcceptDrops (val); | 1920 | viewport()->setAcceptDrops (val); |
1900 | } | 1921 | } |
1901 | 1922 | ||
1902 | int KListView::dropVisualizerWidth () const | 1923 | int KListView::dropVisualizerWidth () const |
1903 | { | 1924 | { |
@@ -2173,19 +2194,28 @@ void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
2173 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); | 2194 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); |
2174 | } | 2195 | } |
2175 | else if (isAlternate()) { | 2196 | else if (isAlternate()) { |
2176 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) | 2197 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) |
2177 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) | 2198 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) |
2178 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); | 2199 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); |
2179 | else | 2200 | else |
2180 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); | 2201 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); |
2181 | } | 2202 | } |
2182 | QListViewItem::paintCell(p, _cg, column, width, alignment); | 2203 | QListViewItem::paintCell(p, _cg, column, width, alignment); |
2183 | } | 2204 | } |
2184 | 2205 | ||
2206 | //US we do not have a "global KDE" variable to setup singleClick functionality | ||
2207 | void KListView::setSingleClick(bool s) | ||
2208 | { | ||
2209 | d->bUseSingle = s; | ||
2210 | slotSettingsChanged(1); | ||
2211 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); | ||
2212 | } | ||
2213 | |||
2214 | |||
2185 | void KListView::virtual_hook( int, void* ) | 2215 | void KListView::virtual_hook( int, void* ) |
2186 | { /*BASE::virtual_hook( id, data );*/ } | 2216 | { /*BASE::virtual_hook( id, data );*/ } |
2187 | 2217 | ||
2188 | //US #include "klistview.moc" | 2218 | //US #include "klistview.moc" |
2189 | //US #include "klistviewlineedit.moc" | 2219 | //US #include "klistviewlineedit.moc" |
2190 | 2220 | ||
2191 | // vim: ts=2 sw=2 et | 2221 | // vim: ts=2 sw=2 et |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index 8d933f6..d559ce7 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -363,24 +363,28 @@ public: | |||
363 | virtual void setSorting(int column, bool ascending = true); | 363 | virtual void setSorting(int column, bool ascending = true); |
364 | 364 | ||
365 | /** | 365 | /** |
366 | * @return the currently sorted column, or -1 if none is sorted | 366 | * @return the currently sorted column, or -1 if none is sorted |
367 | */ | 367 | */ |
368 | int columnSorted(void) const; | 368 | int columnSorted(void) const; |
369 | 369 | ||
370 | /** | 370 | /** |
371 | * @return whether the current sort is ascending (or descending) | 371 | * @return whether the current sort is ascending (or descending) |
372 | */ | 372 | */ |
373 | bool ascendingSort(void) const; | 373 | bool ascendingSort(void) const; |
374 | 374 | ||
375 | //US we do not have a "global KDE" variable to setup singleClick functionality | ||
376 | void setSingleClick(bool s); | ||
377 | |||
378 | |||
375 | signals: | 379 | signals: |
376 | 380 | ||
377 | /** | 381 | /** |
378 | * This signal is emitted whenever the user executes an listview item. | 382 | * This signal is emitted whenever the user executes an listview item. |
379 | * That means depending on the KDE wide Single Click/Double Click | 383 | * That means depending on the KDE wide Single Click/Double Click |
380 | * setting the user clicked or double clicked on that item. | 384 | * setting the user clicked or double clicked on that item. |
381 | * @param item is the pointer to the executed listview item. | 385 | * @param item is the pointer to the executed listview item. |
382 | * | 386 | * |
383 | * Note that you may not delete any @ref QListViewItem objects in slots | 387 | * Note that you may not delete any @ref QListViewItem objects in slots |
384 | * connected to this signal. | 388 | * connected to this signal. |
385 | */ | 389 | */ |
386 | void executed( QListViewItem *item ); | 390 | void executed( QListViewItem *item ); |
@@ -674,25 +678,26 @@ protected: | |||
674 | } | 678 | } |
675 | 679 | ||
676 | /** | 680 | /** |
677 | * Reimplemented to reload the alternate background in palette changes. | 681 | * Reimplemented to reload the alternate background in palette changes. |
678 | * @internal | 682 | * @internal |
679 | */ | 683 | */ |
680 | virtual bool event( QEvent * ); | 684 | virtual bool event( QEvent * ); |
681 | 685 | ||
682 | /** | 686 | /** |
683 | * Emit signal @ref #executed. | 687 | * Emit signal @ref #executed. |
684 | * @internal | 688 | * @internal |
685 | */ | 689 | */ |
686 | void emitExecute( QListViewItem *item, const QPoint &pos, int c ); | 690 | //US I added buttonstate to pass the current keyboard status |
691 | void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); | ||
687 | 692 | ||
688 | /** | 693 | /** |
689 | * Reimplemented for internal reasons. | 694 | * Reimplemented for internal reasons. |
690 | * Further reimplementations should call this function or else | 695 | * Further reimplementations should call this function or else |
691 | * some features may not work correctly. | 696 | * some features may not work correctly. |
692 | * | 697 | * |
693 | * The API is unaffected. | 698 | * The API is unaffected. |
694 | */ | 699 | */ |
695 | virtual void focusInEvent(QFocusEvent* fe); | 700 | virtual void focusInEvent(QFocusEvent* fe); |
696 | 701 | ||
697 | /** | 702 | /** |
698 | * Reimplemented for internal reasons. | 703 | * Reimplemented for internal reasons. |