summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-17 12:17:07 (UTC)
committer zautrix <zautrix>2005-04-17 12:17:07 (UTC)
commit2d81c75c4ffb8f144ae58e90e68496500d07a19e (patch) (unidiff)
tree1b27958fdc2948c1235579029188b1de78d7b820
parentf64384edcc1e3b3f7511480866b0900aa1ebdda6 (diff)
downloadkdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.zip
kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.gz
kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.bz2
fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/koagenda.cpp264
-rw-r--r--korganizer/koagenda.h2
-rw-r--r--korganizer/koagendaview.cpp22
4 files changed, 46 insertions, 246 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 44bf20b..03895fd 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -3,4 +3,8 @@ Info about the changes in new versions of KDE-Pim/Pi
3********** VERSION 2.0.28 ************ 3********** VERSION 2.0.28 ************
4 4
5KO/Pi:
6Fixed two problems in KO/Pi timetracking.
7Added context menu to month view for creating new events/todos.
8Fixed some other small bugs.
5 9
6 10
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 114ed75..355f4bb 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -475,13 +475,6 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
475 mActionItem = (KOAgendaItem *)object; 475 mActionItem = (KOAgendaItem *)object;
476 if (mActionItem) { 476 if (mActionItem) {
477 if ( mSelectionHeight > 0 ) { 477 emit signalClearSelection();
478 int selectionCellX = mSelectionCellX * mGridSpacingX; 478 slotClearSelection();
479 int selectionYTop = mSelectionYTop;
480 int gridSpacingX = mGridSpacingX;
481 int selectionHeight = mSelectionHeight;
482 clearSelection();
483 repaintContents( selectionCellX, selectionYTop,
484 gridSpacingX, selectionHeight,false );
485 }
486 selectItem(mActionItem); 479 selectItem(mActionItem);
487 Incidence *incidence = mActionItem->incidence(); 480 Incidence *incidence = mActionItem->incidence();
@@ -611,179 +604,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
611 } 604 }
612 return true; 605 return true;
613#if 0
614 //qDebug("KOAgenda::eventFilter_mous ");
615 QPoint viewportPos;
616 if (object != viewport()) {
617 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
618 } else {
619 viewportPos = me->pos();
620 }
621 static int startX = 0;
622 static int startY = 0;
623 static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
624 static bool blockMoving = true;
625 static bool leftMouseDown = false;
626 bool rightButtonPressed = false;
627 switch (me->type()) {
628 case QEvent::MouseButtonPress:
629 if (me->button() == LeftButton) {
630 leftMouseDown = true;
631 }
632 else if (me->button() == RightButton) {
633 leftMouseDown = false;
634 }
635 blockMoving = true;
636 startX = viewportPos.x();
637 startY = viewportPos.y();
638 if (object != viewport()) { // item clicked **************
639 if (me->button() == RightButton) {
640 leftMouseDown = false;
641 mClickedItem = (KOAgendaItem *)object;
642 if (mActionItem ) {
643 endItemAction();
644 }
645 if (mClickedItem) {
646 selectItem(mClickedItem);
647 emit showIncidencePopupSignal(mClickedItem->incidence());
648 }
649 return true;
650 } else if (me->button() == LeftButton) {
651 mActionItem = (KOAgendaItem *)object;
652 if (mActionItem) {
653 if ( mSelectionHeight > 0 ) {
654 int selectionCellX = mSelectionCellX * mGridSpacingX;
655 int selectionYTop = mSelectionYTop;
656 int gridSpacingX = mGridSpacingX;
657 int selectionHeight = mSelectionHeight;
658 clearSelection();
659 repaintContents( selectionCellX, selectionYTop,
660 gridSpacingX, selectionHeight,false );
661 }
662 selectItem(mActionItem);
663 Incidence *incidence = mActionItem->incidence();
664 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
665 mActionItem = 0;
666 } else {
667 startItemAction(viewportPos);
668 }
669 }
670 }
671 } else { // ---------- viewport()
672 selectItem(0);
673 mActionItem = 0;
674 if (me->button() == LeftButton ) {
675 setCursor(arrowCursor);
676 startSelectAction(viewportPos);
677 } else if (me->button() == RightButton ) {
678 setCursor(arrowCursor);
679 if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
680 endSelectAction( false ); // do not emit new event signal
681 leftMouseDown = false; // no more leftMouse computation
682 }
683 int x,y;
684 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
685 int gx,gy;
686 contentsToGrid(x,y,gx,gy);
687 mCurrentCellX = gx;
688 mCurrentCellY = gy;
689 mStartCellX = gx;
690 mStartCellY = gy;
691 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
692 }
693 }
694 break;
695
696 case QEvent::MouseButtonRelease:
697
698 if (object != viewport()) {
699 if (me->button() == LeftButton && leftMouseDown) {
700 if (mActionItem) {
701 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
702 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
703 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
704 mScrollUpTimer.stop();
705 mScrollDownTimer.stop();
706 mActionItem->resetMove();
707 placeSubCells( mActionItem );
708 // emit startDragSignal( mActionItem->incidence() );
709 setCursor( arrowCursor );
710 mActionItem = 0;
711 mActionType = NOP;
712 mItemMoved = 0;
713 leftMouseDown = false;
714 return true;
715 }
716 endItemAction();
717 }
718 }
719
720 } else { // ---------- viewport()
721 if (me->button() == LeftButton && leftMouseDown ) { //left click
722 endSelectAction( true ); // emit new event signal
723 }
724 }
725 if (me->button() == LeftButton)
726 leftMouseDown = false;
727
728 break;
729 606
730 case QEvent::MouseMove:
731 if ( !leftMouseDown )
732 return true;
733 if ( blockMoving ) {
734 int dX, dY;
735 dX = startX - viewportPos.x();
736 if ( dX < 0 )
737 dX = -dX;
738 dY = viewportPos.y() - startY;
739 if ( dY < 0 )
740 dY = -dY;
741 //qDebug("%d %d %d ", dX, dY , blockmoveDist );
742 if ( dX > blockmoveDist || dY > blockmoveDist ) {
743 blockMoving = false;
744 }
745 }
746 if (object != viewport()) {
747 KOAgendaItem *moveItem = (KOAgendaItem *)object;
748 if (!moveItem->incidence()->isReadOnly() ) {
749 if (!mActionItem)
750 setNoActionCursor(moveItem,viewportPos);
751 else {
752 if ( !blockMoving )
753 performItemAction(viewportPos);
754 }
755 }
756 } else { // ---------- viewport()
757 if ( mActionType == SELECT ) {
758 performSelectAction( viewportPos );
759 }
760 }
761 break;
762
763 case QEvent::MouseButtonDblClick:
764 blockMoving = false;
765 leftMouseDown = false;
766 if (object == viewport()) {
767 selectItem(0);
768 int x,y;
769 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
770 int gx,gy;
771 contentsToGrid(x,y,gx,gy);
772 emit newEventSignal(gx,gy);
773 } else {
774 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
775 selectItem(doubleClickedItem);
776 if ( KOPrefs::instance()->mEditOnDoubleClick )
777 emit editIncidenceSignal(doubleClickedItem->incidence());
778 else
779 emit showIncidenceSignal(doubleClickedItem->incidence());
780 }
781 break;
782
783 default:
784 break;
785 }
786 return true;
787#endif
788} 607}
789 608
@@ -804,37 +623,42 @@ void KOAgenda::newItem( int item )
804 } 623 }
805} 624}
625void KOAgenda::slotClearSelection()
626{
627 if (mSelectionHeight) {
628 int selectionX = mSelectionCellX * mGridSpacingX;
629 int top = mSelectionYTop - 2 *mGridSpacingY;
630 int hei = mSelectionHeight + 4 *mGridSpacingY;
631 clearSelection();
632 repaintContents( selectionX, top,
633 mGridSpacingX, hei ,false );
634 }
635
636}
806void KOAgenda::startSelectAction(QPoint viewportPos) 637void KOAgenda::startSelectAction(QPoint viewportPos)
807{ 638{
808 //emit newStartSelectSignal(); 639
640 emit signalClearSelection();
641 slotClearSelection();
809 642
810 mActionType = SELECT; 643 mActionType = SELECT;
811 644
812 int x,y; 645 int x,y;
813 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 646 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
814 int gx,gy; 647 int gx,gy;
815 contentsToGrid(x,y,gx,gy); 648 contentsToGrid(x,y,gx,gy);
816 649
817 mStartCellX = gx; 650 mStartCellX = gx;
818 mStartCellY = gy; 651 mStartCellY = gy;
819 mCurrentCellX = gx; 652 mCurrentCellX = gx;
820 mCurrentCellY = gy; 653 mCurrentCellY = gy;
821
822 // Store coordinates of old selection
823 int selectionX = mSelectionCellX * mGridSpacingX;
824 int selectionYTop = mSelectionYTop;
825 int selectionHeight = mSelectionHeight;
826 654
827 // Store new selection 655 // Store new selection
828 mSelectionCellX = gx; 656 mSelectionCellX = gx;
829 mSelectionYTop = gy * mGridSpacingY; 657 mSelectionYTop = gy * mGridSpacingY;
830 mSelectionHeight = mGridSpacingY; 658 mSelectionHeight = mGridSpacingY;
831 659
832 // Clear old selection 660 // Paint new selection
833 repaintContents( selectionX, selectionYTop, 661 repaintContents( mSelectionCellX * mGridSpacingX+1, mSelectionYTop,
834 mGridSpacingX, selectionHeight,false ); 662 mGridSpacingX-1, mSelectionHeight );
835
836 // Paint new selection
837 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
838 // mGridSpacingX, mSelectionHeight );
839} 663}
840 664
@@ -863,16 +687,9 @@ void KOAgenda::performSelectAction(QPoint viewportPos)
863 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; 687 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
864 688
865#if 0 689
866 // FIXME: Repaint only the newly selected region
867 repaintContents( mSelectionCellX * mGridSpacingX,
868 mCurrentCellY + mGridSpacingY,
869 mGridSpacingX,
870 mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY );
871#else
872 repaintContents( (KOGlobals::self()->reverseLayout() ? 690 repaintContents( (KOGlobals::self()->reverseLayout() ?
873 mColumns - 1 - mSelectionCellX : mSelectionCellX) * 691 mColumns - 1 - mSelectionCellX : mSelectionCellX) *
874 mGridSpacingX, mSelectionYTop, 692 mGridSpacingX, mSelectionYTop,
875 mGridSpacingX, mSelectionHeight , false); 693 mGridSpacingX, mSelectionHeight , false);
876#endif
877 694
878 mCurrentCellY = gy; 695 mCurrentCellY = gy;
@@ -901,5 +718,4 @@ void KOAgenda::endSelectAction( bool emitNewEvent )
901 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 718 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
902 if ( emitNewEvent && mStartCellY < mCurrentCellY ) { 719 if ( emitNewEvent && mStartCellY < mCurrentCellY ) {
903 qDebug("ew event signal ");
904 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 720 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
905 } 721 }
@@ -1101,15 +917,5 @@ void KOAgenda::endItemAction()
1101 } 917 }
1102 else { 918 else {
1103#if 0 919
1104 for ( item=oldconflictItems.first(); item != 0;
1105 item=oldconflictItems.next() ) {
1106 placeSubCells(item);
1107 }
1108 while ( placeItem ) {
1109 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
1110 placeSubCells( placeItem );
1111 placeItem = placeItem->nextMultiItem();
1112 }
1113#endif
1114 920
1115 globalFlagBlockAgendaItemPaint = 1; 921 globalFlagBlockAgendaItemPaint = 1;
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 4f1fdb9..fb9983e 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -128,4 +128,5 @@ class KOAgenda : public QScrollView
128 128
129 public slots: 129 public slots:
130 void slotClearSelection();
130 void popupMenu(); 131 void popupMenu();
131 void newItem( int ); 132 void newItem( int );
@@ -147,4 +148,5 @@ class KOAgenda : public QScrollView
147 148
148 signals: 149 signals:
150 void signalClearSelection();
149 void showDateView( int, int); 151 void showDateView( int, int);
150 void newEventSignal(); 152 void newEventSignal();
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 17f791d..b43c40e 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -435,5 +435,4 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
435 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 435 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
436#ifndef DESKTOP_VERSION 436#ifndef DESKTOP_VERSION
437 // FIX
438 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 437 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
439#endif 438#endif
@@ -568,4 +567,6 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
568 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 567 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
569 568
569 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
570 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
570 571
571} 572}
@@ -726,10 +727,6 @@ void KOAgendaView::createDayLabels()
726 dayLabel->setNum( -1 ); 727 dayLabel->setNum( -1 );
727 //dayLabel->setAlignment(QLabel::AlignHCenter); 728 //dayLabel->setAlignment(QLabel::AlignHCenter);
728#if 0 729
729 if ( QApplication::desktop()->width() <= 320 ) 730 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
730 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) );
731 else
732#endif
733 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
734 dayLabel->show(); 731 dayLabel->show();
735 DateList::ConstIterator dit; 732 DateList::ConstIterator dit;
@@ -1180,14 +1177,5 @@ void KOAgendaView::fillAgenda()
1180 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1181 } 1178 }
1182#if 0 1179
1183 if (beginX <= 0 && curCol == 0) {
1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1185 } else if (beginX == curCol) {
1186 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1187 } else {
1188 qDebug("skipped %d %d %d ",beginX , endX, curCol);
1189 }
1190#endif
1191 //mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1192 } else { 1180 } else {
1193 if (beginX <= 0 && curCol == 0) { 1181 if (beginX <= 0 && curCol == 0) {