summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp8
-rw-r--r--korganizer/koagendaitem.h2
-rw-r--r--korganizer/koagendaview.cpp1
4 files changed, 8 insertions, 7 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 796d633..d9d1283 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1791,102 +1791,102 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1791 globalFlagBlockAgendaItemUpdate = 0; 1791 globalFlagBlockAgendaItemUpdate = 0;
1792 item->repaintMe(); 1792 item->repaintMe();
1793 globalFlagBlockAgendaItemUpdate = 1; 1793 globalFlagBlockAgendaItemUpdate = 1;
1794 item->repaint(); 1794 item->repaint();
1795} 1795}
1796/* 1796/*
1797 Insert KOAgendaItem into agenda. 1797 Insert KOAgendaItem into agenda.
1798*/ 1798*/
1799KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) 1799KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
1800{ 1800{
1801 if (mAllDayMode) { 1801 if (mAllDayMode) {
1802 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); 1802 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. ");
1803 return 0; 1803 return 0;
1804 } 1804 }
1805 1805
1806 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1806 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1807 //agendaItem->setFrameStyle(WinPanel|Raised); 1807 //agendaItem->setFrameStyle(WinPanel|Raised);
1808 1808
1809 int YSize = YBottom - YTop + 1; 1809 int YSize = YBottom - YTop + 1;
1810 if (YSize < 0) { 1810 if (YSize < 0) {
1811 YSize = 1; 1811 YSize = 1;
1812 } 1812 }
1813 int iheight = mGridSpacingY * YSize; 1813 int iheight = mGridSpacingY * YSize;
1814 1814
1815 agendaItem->resize(mGridSpacingX,iheight ); 1815 agendaItem->resize(mGridSpacingX,iheight );
1816 agendaItem->setCellXY(X,YTop,YBottom); 1816 agendaItem->setCellXY(X,YTop,YBottom);
1817 agendaItem->setCellXWidth(X); 1817 agendaItem->setCellXWidth(X);
1818 1818
1819 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1819 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1820 mItems.append(agendaItem); 1820 mItems.append(agendaItem);
1821 1821
1822 placeSubCells(agendaItem); 1822 placeSubCells(agendaItem);
1823 1823
1824 //agendaItem->show(); 1824 //agendaItem->show();
1825 1825
1826 1826
1827 return agendaItem; 1827 return agendaItem;
1828} 1828}
1829 1829
1830 1830
1831/* 1831/*
1832 Insert all-day KOAgendaItem into agenda. 1832 Insert all-day KOAgendaItem into agenda.
1833*/ 1833*/
1834KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1834KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1835{ 1835{
1836 if (!mAllDayMode) { 1836 if (!mAllDayMode) {
1837 return 0; 1837 return 0;
1838 } 1838 }
1839 1839 //qDebug("insertallday %s -- %d - %d ",qd.toString().latin1(), XBegin, XEnd );
1840 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1840 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1841 1841
1842 agendaItem->setCellXY(XBegin,0,0); 1842 agendaItem->setCellXY(XBegin,0,0);
1843 agendaItem->setCellXWidth(XEnd); 1843 agendaItem->setCellXWidth(XEnd);
1844 agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); 1844 agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY, true );
1845 1845
1846 //addChild(agendaItem,XBegin*mGridSpacingX,0); 1846 //addChild(agendaItem,XBegin*mGridSpacingX,0);
1847 mItems.append(agendaItem); 1847 mItems.append(agendaItem);
1848 1848
1849 placeSubCells(agendaItem); 1849 placeSubCells(agendaItem);
1850 1850
1851 //agendaItem->show(); 1851 //agendaItem->show();
1852 1852
1853 return agendaItem; 1853 return agendaItem;
1854} 1854}
1855 1855
1856 1856
1857void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1857void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1858 int YTop,int YBottom) 1858 int YTop,int YBottom)
1859{ 1859{
1860 if (mAllDayMode) { 1860 if (mAllDayMode) {
1861 ; 1861 ;
1862 return; 1862 return;
1863 } 1863 }
1864 1864
1865 int cellX,cellYTop,cellYBottom; 1865 int cellX,cellYTop,cellYBottom;
1866 QString newtext; 1866 QString newtext;
1867 int width = XEnd - XBegin + 1; 1867 int width = XEnd - XBegin + 1;
1868 int count = 0; 1868 int count = 0;
1869 KOAgendaItem *current = 0; 1869 KOAgendaItem *current = 0;
1870 QPtrList<KOAgendaItem> multiItems; 1870 QPtrList<KOAgendaItem> multiItems;
1871 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1871 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1872 if (cellX == XBegin) cellYTop = YTop; 1872 if (cellX == XBegin) cellYTop = YTop;
1873 else cellYTop = 0; 1873 else cellYTop = 0;
1874 if (cellX == XEnd) cellYBottom = YBottom; 1874 if (cellX == XEnd) cellYBottom = YBottom;
1875 else cellYBottom = rows() - 1; 1875 else cellYBottom = rows() - 1;
1876 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1876 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1877 newtext.append(event->summary()); 1877 newtext.append(event->summary());
1878 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1878 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1879 current->setText(newtext); 1879 current->setText(newtext);
1880 multiItems.append(current); 1880 multiItems.append(current);
1881 } 1881 }
1882 1882
1883 KOAgendaItem *next = 0; 1883 KOAgendaItem *next = 0;
1884 KOAgendaItem *last = multiItems.last(); 1884 KOAgendaItem *last = multiItems.last();
1885 KOAgendaItem *first = multiItems.first(); 1885 KOAgendaItem *first = multiItems.first();
1886 KOAgendaItem *setFirst,*setLast; 1886 KOAgendaItem *setFirst,*setLast;
1887 current = first; 1887 current = first;
1888 while (current) { 1888 while (current) {
1889 next = multiItems.next(); 1889 next = multiItems.next();
1890 if (current == first) setFirst = 0; 1890 if (current == first) setFirst = 0;
1891 else setFirst = first; 1891 else setFirst = first;
1892 if (current == last) setLast = 0; 1892 if (current == last) setLast = 0;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 7a685d8..81681df 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -537,187 +537,189 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
537 paintMe( mSelected ); 537 paintMe( mSelected );
538 return; 538 return;
539 } else { 539 } else {
540 if ( mAllDay ) 540 if ( mAllDay )
541 paintFrom = paintPixAllday(); 541 paintFrom = paintPixAllday();
542 else 542 else
543 paintFrom = paintPix(); 543 paintFrom = paintPix();
544 } 544 }
545 xx += rx; 545 xx += rx;
546 546
547 if ( xx < 0 ) { 547 if ( xx < 0 ) {
548 rw = rw + xx; 548 rw = rw + xx;
549 rx -= xx; 549 rx -= xx;
550 xx = 0; 550 xx = 0;
551 if ( rw <= 1 ) { 551 if ( rw <= 1 ) {
552 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 552 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
553 return; 553 return;
554 } 554 }
555 } 555 }
556 if ( paintFrom->width() < xx+rw ) { 556 if ( paintFrom->width() < xx+rw ) {
557 rw = paintFrom->width() - xx; 557 rw = paintFrom->width() - xx;
558 if ( rw <= 1 ) { 558 if ( rw <= 1 ) {
559 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 559 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
560 return; 560 return;
561 } 561 }
562 } 562 }
563 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 563 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
564 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 564 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
565} 565}
566void KOAgendaItem::computeText() 566void KOAgendaItem::computeText()
567{ 567{
568 mDisplayedText = mIncidence->summary(); 568 mDisplayedText = mIncidence->summary();
569 if ( (mIncidence->typeID() == todoID ) ) { 569 if ( (mIncidence->typeID() == todoID ) ) {
570 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 570 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
571 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 571 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
572 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 572 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
573 else if ( !(mIncidence->doesFloat())) 573 else if ( !(mIncidence->doesFloat()))
574 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 574 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
575 } 575 }
576 } else { 576 } else {
577 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 577 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
578 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 578 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
579 579
580 if ( mAllDay ) { 580 if ( mAllDay ) {
581 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 581 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
582 if ( mIncidence->doesRecur() ) { 582 if ( mIncidence->doesRecur() ) {
583 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; 583 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
584 } else { 584 } else {
585 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 585 int dur = 1+ (static_cast<Event*>(mIncidence))->dtStart().date().daysTo( (static_cast<Event*>(mIncidence))->dtEnd().date() );
586 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) + " ("+QString::number( dur )+i18n(" days") +")" ;
586 } 587 }
587 } 588 }
588 } 589 }
589 } 590 }
590 591
591 if ( !mIncidence->location().isEmpty() ) { 592 if ( !mIncidence->location().isEmpty() ) {
592 if ( mAllDay ) 593 if ( mAllDay )
593 mDisplayedText += " ("; 594 mDisplayedText += " (";
594 else 595 else
595 mDisplayedText += "\n("; 596 mDisplayedText += "\n(";
596 mDisplayedText += mIncidence->location() +")"; 597 mDisplayedText += mIncidence->location() +")";
597 } 598 }
598#ifdef DESKTOP_VERSION 599#ifdef DESKTOP_VERSION
599 QString tipText = mIncidence->summary(); 600 QString tipText = mIncidence->summary();
600 if ( !mIncidence->doesFloat() ) { 601 if ( !mIncidence->doesFloat() ) {
601 if ( mIncidence->typeID() == eventID ) { 602 if ( mIncidence->typeID() == eventID ) {
602 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 603 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
603 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 604 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
604 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 605 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
605 } 606 }
606 else { 607 else {
607 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 608 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
608 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 609 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
609 } 610 }
610 } 611 }
611 else if ( mIncidence->typeID() == todoID ) { 612 else if ( mIncidence->typeID() == todoID ) {
612 if (mIncidence->hasStartDate()) 613 if (mIncidence->hasStartDate())
613 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 614 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
614 if (((Todo*)mIncidence)->hasDueDate()) 615 if (((Todo*)mIncidence)->hasDueDate())
615 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 616 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
616 } 617 }
617 } else if ( mIncidence->typeID() == todoID ) { 618 } else if ( mIncidence->typeID() == todoID ) {
618 if (mIncidence->hasStartDate()) 619 if (mIncidence->hasStartDate())
619 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 620 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
620 if (((Todo*)mIncidence)->hasDueDate()) 621 if (((Todo*)mIncidence)->hasDueDate())
621 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 622 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
622 } 623 }
623 624
624 if (!mIncidence->location().isEmpty()) { 625 if (!mIncidence->location().isEmpty()) {
625 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 626 tipText += "\n"+i18n("Location: ")+mIncidence->location();
626 } 627 }
627 QToolTip::add(this,tipText,toolTipGroup(),""); 628 QToolTip::add(this,tipText,toolTipGroup(),"");
628#endif 629#endif
629} 630}
630void KOAgendaItem::updateItem() 631void KOAgendaItem::updateItem()
631{ 632{
632 computeText(); 633 computeText();
633 634
634 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 635 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
635 paintMe( mSelected ); 636 paintMe( mSelected );
636 repaint( false); 637 repaint( false);
637} 638}
638 639
639void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 640void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
640{ 641{
641 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 642 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
642 paintMe( mSelected ); 643 paintMe( mSelected );
643 repaint( false ); 644 repaint( false );
644} 645}
645 646
646/* 647/*
647 Return height of item in units of agenda cells 648 Return height of item in units of agenda cells
648*/ 649*/
649int KOAgendaItem::cellHeight() 650int KOAgendaItem::cellHeight()
650{ 651{
651 int ret = mCellYBottom - mCellYTop + 1; 652 int ret = mCellYBottom - mCellYTop + 1;
652 if ( ret <= 0 ) { 653 if ( ret <= 0 ) {
653 ret = 1; 654 ret = 1;
654 mCellYBottom = 0; 655 mCellYBottom = 0;
655 mCellYTop = 0; 656 mCellYTop = 0;
656 } 657 }
657 return ret; 658 return ret;
658} 659}
659// it may be that allday agenda items have a needed width > 32000 660// it may be that allday agenda items have a needed width > 32000
660// this code is to fix this problem 661// this code is to fix this problem
661int KOAgendaItem::resizeMe( int grid, int wid, int hei ) 662int KOAgendaItem::resizeMe( int grid, int wid, int hei, bool invalidWidth )
662{ 663{
663 int diff = 0; 664 int diff = 0;
664 if ( mCellX < -3 && mAllDay ) { 665 if ( mCellX < -3 && mAllDay ) {
665 diff = (mCellX + 3) * -grid; 666 diff = (mCellX + 3) * -grid;
666 //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid); 667 //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid);
667 if ( diff >= wid ) { 668 if ( diff >= wid ) {
668 // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid); 669 // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid);
669 //diff = 0; 670 //diff = 0;
670 } 671 }
671 } 672 }
672 if ( wid == width() || diff >= wid ) 673 if ( (!invalidWidth && wid == width() ) || diff >= wid )
673 resize( wid, hei ); 674 resize( wid, hei );
674 else 675 else
675 resize( wid - diff, hei ); 676 resize( wid - diff, hei );
677 //qDebug("wid %d x %d ", width(), x());
676 return diff; 678 return diff;
677} 679}
678/* 680/*
679 Return height of item in units of agenda cells 681 Return height of item in units of agenda cells
680*/ 682*/
681int KOAgendaItem::cellWidth() 683int KOAgendaItem::cellWidth()
682{ 684{
683 return mCellXWidth - mCellX + 1; 685 return mCellXWidth - mCellX + 1;
684} 686}
685 687
686void KOAgendaItem::setItemDate(QDate qd) 688void KOAgendaItem::setItemDate(QDate qd)
687{ 689{
688 mDate = qd; 690 mDate = qd;
689} 691}
690 692
691void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) 693void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
692{ 694{
693 mCellX = X; 695 mCellX = X;
694 mCellYTop = YTop; 696 mCellYTop = YTop;
695 mCellYBottom = YBottom; 697 mCellYBottom = YBottom;
696} 698}
697 699
698void KOAgendaItem::setCellXWidth(int xwidth) 700void KOAgendaItem::setCellXWidth(int xwidth)
699{ 701{
700 mCellXWidth = xwidth; 702 mCellXWidth = xwidth;
701} 703}
702 704
703void KOAgendaItem::setCellX(int XLeft, int XRight) 705void KOAgendaItem::setCellX(int XLeft, int XRight)
704{ 706{
705 mCellX = XLeft; 707 mCellX = XLeft;
706 mCellXWidth = XRight; 708 mCellXWidth = XRight;
707} 709}
708 710
709void KOAgendaItem::setCellY(int YTop, int YBottom) 711void KOAgendaItem::setCellY(int YTop, int YBottom)
710{ 712{
711 mCellYTop = YTop; 713 mCellYTop = YTop;
712 mCellYBottom = YBottom; 714 mCellYBottom = YBottom;
713} 715}
714 716
715void KOAgendaItem::setSubCell(int subCell) 717void KOAgendaItem::setSubCell(int subCell)
716{ 718{
717 mSubCell = subCell; 719 mSubCell = subCell;
718} 720}
719 721
720void KOAgendaItem::setSubCells(int subCells) 722void KOAgendaItem::setSubCells(int subCells)
721{ 723{
722 mSubCells = subCells; 724 mSubCells = subCells;
723} 725}
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 97acd4c..37d89a6 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -64,97 +64,97 @@ class KOAgendaItem : public QWidget
64 void setCellXWidth(int xwidth); 64 void setCellXWidth(int xwidth);
65 void setSubCell(int subCell); 65 void setSubCell(int subCell);
66 void setSubCells(int subCells); 66 void setSubCells(int subCells);
67 67
68 /** Start movement */ 68 /** Start movement */
69 void startMove(); 69 void startMove();
70 /** Reset to original values */ 70 /** Reset to original values */
71 void resetMove(); 71 void resetMove();
72 72
73 void moveRelative(int dx,int dy); 73 void moveRelative(int dx,int dy);
74 void expandTop(int dy); 74 void expandTop(int dy);
75 void expandBottom(int dy); 75 void expandBottom(int dy);
76 void expandLeft(int dx); 76 void expandLeft(int dx);
77 void expandRight(int dx); 77 void expandRight(int dx);
78 int mLastMoveXPos; 78 int mLastMoveXPos;
79 79
80 void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 80 void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
81 KOAgendaItem *last); 81 KOAgendaItem *last);
82 KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } 82 KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
83 KOAgendaItem *nextMultiItem() { return mNextMultiItem; } 83 KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
84 KOAgendaItem *lastMultiItem() { return mLastMultiItem; } 84 KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
85 85
86 Incidence *incidence() const { return mIncidence; } 86 Incidence *incidence() const { return mIncidence; }
87 QDate itemDate() { return mDate; } 87 QDate itemDate() { return mDate; }
88 88
89 /** Update the date of this item's occurence (not in the event) */ 89 /** Update the date of this item's occurence (not in the event) */
90 void setItemDate(QDate qd); 90 void setItemDate(QDate qd);
91 91
92 void setText ( const QString & text ) { mDisplayedText = text; } 92 void setText ( const QString & text ) { mDisplayedText = text; }
93 QString text () { return mDisplayedText; } 93 QString text () { return mDisplayedText; }
94 94
95 virtual bool eventFilter ( QObject *, QEvent * ); 95 virtual bool eventFilter ( QObject *, QEvent * );
96 96
97 static QToolTipGroup *toolTipGroup(); 97 static QToolTipGroup *toolTipGroup();
98 98
99 QPtrList<KOAgendaItem> conflictItems(); 99 QPtrList<KOAgendaItem> conflictItems();
100 void setConflictItems(QPtrList<KOAgendaItem>); 100 void setConflictItems(QPtrList<KOAgendaItem>);
101 void addConflictItem(KOAgendaItem *ci); 101 void addConflictItem(KOAgendaItem *ci);
102 void paintMe( bool, QPainter* painter = 0 ); 102 void paintMe( bool, QPainter* painter = 0 );
103 void repaintMe(); 103 void repaintMe();
104 static QPixmap * paintPix(); 104 static QPixmap * paintPix();
105 static QPixmap * paintPixAllday(); 105 static QPixmap * paintPixAllday();
106 void updateItem(); 106 void updateItem();
107 void computeText(); 107 void computeText();
108 void recreateIncidence(); 108 void recreateIncidence();
109 bool checkLayout(); 109 bool checkLayout();
110 void initColor (); 110 void initColor ();
111 bool isAllDay() { return mAllDay; } 111 bool isAllDay() { return mAllDay; }
112 int resizeMe( int grid, int wid, int hei ); 112 int resizeMe( int grid, int wid, int hei, bool invalidHei = false );
113 public slots: 113 public slots:
114 bool updateIcons( QPainter *, bool ); 114 bool updateIcons( QPainter *, bool );
115 void select(bool=true); 115 void select(bool=true);
116 void repaintItem(); 116 void repaintItem();
117 117
118 protected: 118 protected:
119 void dragEnterEvent(QDragEnterEvent *e); 119 void dragEnterEvent(QDragEnterEvent *e);
120 void dropEvent(QDropEvent *e); 120 void dropEvent(QDropEvent *e);
121 void paintEvent ( QPaintEvent * ); 121 void paintEvent ( QPaintEvent * );
122 void resizeEvent ( QResizeEvent *ev ); 122 void resizeEvent ( QResizeEvent *ev );
123 123
124 private: 124 private:
125 KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis; 125 KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis;
126 bool mAllDay; 126 bool mAllDay;
127 bool mWhiteText; 127 bool mWhiteText;
128 int mCellX; 128 int mCellX;
129 int mCellXWidth; 129 int mCellXWidth;
130 int mCellYTop,mCellYBottom; 130 int mCellYTop,mCellYBottom;
131 int mSubCell; // subcell number of this item 131 int mSubCell; // subcell number of this item
132 int mSubCells; // Total number of subcells in cell of this item 132 int mSubCells; // Total number of subcells in cell of this item
133 int xPaintCoord; 133 int xPaintCoord;
134 int yPaintCoord; 134 int yPaintCoord;
135 int wPaintCoord; 135 int wPaintCoord;
136 int hPaintCoord; 136 int hPaintCoord;
137 // Variables to remember start position 137 // Variables to remember start position
138 int mStartCellX; 138 int mStartCellX;
139 int mStartCellXWidth; 139 int mStartCellXWidth;
140 int mStartCellYTop,mStartCellYBottom; 140 int mStartCellYTop,mStartCellYBottom;
141 int mLastMovePos; 141 int mLastMovePos;
142 142
143 // Multi item pointers 143 // Multi item pointers
144 KOAgendaItem *mFirstMultiItem; 144 KOAgendaItem *mFirstMultiItem;
145 KOAgendaItem *mNextMultiItem; 145 KOAgendaItem *mNextMultiItem;
146 KOAgendaItem *mLastMultiItem; 146 KOAgendaItem *mLastMultiItem;
147 147
148 int mFontPixelSize; 148 int mFontPixelSize;
149 Incidence *mIncidence; // corresponding event or todo 149 Incidence *mIncidence; // corresponding event or todo
150 QDate mDate; //date this events occurs (for recurrence) 150 QDate mDate; //date this events occurs (for recurrence)
151 //void showIcon( QLabel*, int ); 151 //void showIcon( QLabel*, int );
152 //QLabel *mTodoIconLabel; 152 //QLabel *mTodoIconLabel;
153 //QLabel *mItemLabel; 153 //QLabel *mItemLabel;
154 //QWidget *mIconBox; 154 //QWidget *mIconBox;
155 //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; 155 //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
156 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; 156 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
157 //QLabel *mIconMoreInfo; 157 //QLabel *mIconMoreInfo;
158 static QToolTipGroup *mToolTipGroup; 158 static QToolTipGroup *mToolTipGroup;
159 159
160 QColor mBackgroundColor; 160 QColor mBackgroundColor;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1cf03a0..d8a2134 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1190,97 +1190,96 @@ void KOAgendaView::fillAgenda()
1190 unsigned int numEvent; 1190 unsigned int numEvent;
1191 //qDebug("+++++NUMEVENT %d", dayEvents.count()); 1191 //qDebug("+++++NUMEVENT %d", dayEvents.count());
1192 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1192 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1193 Event *event = dayEvents.at(numEvent); 1193 Event *event = dayEvents.at(numEvent);
1194 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1194 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1195 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1195 if ( event->uid().left(15) == QString("last-syncEvent-") )
1196 continue; 1196 continue;
1197 // kdDebug() << " Event: " << event->summary() << endl; 1197 // kdDebug() << " Event: " << event->summary() << endl;
1198 1198
1199 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1199 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1200 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1200 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1201 1201
1202 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1202 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1203 1203
1204 if (event->doesFloat()) { 1204 if (event->doesFloat()) {
1205 if (event->doesRecur()) { 1205 if (event->doesRecur()) {
1206 if (event->isMultiDay() ) { 1206 if (event->isMultiDay() ) {
1207 endX = endX - beginX;// endX is now number of days 1207 endX = endX - beginX;// endX is now number of days
1208 if ( event->recursOn( currentDate ) ) { 1208 if ( event->recursOn( currentDate ) ) {
1209 endX += curCol; 1209 endX += curCol;
1210 beginX = curCol; 1210 beginX = curCol;
1211 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1211 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1212 } else { 1212 } else {
1213 //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); 1213 //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1());
1214 if ( curCol == maxCol && maxCol+1 < endX ) { 1214 if ( curCol == maxCol && maxCol+1 < endX ) {
1215 int i; 1215 int i;
1216 for ( i = 1; i< endX; ++i ) { 1216 for ( i = 1; i< endX; ++i ) {
1217 if ( event->recursOn( currentDate.addDays( -i ) ) ) 1217 if ( event->recursOn( currentDate.addDays( -i ) ) )
1218 break; 1218 break;
1219 } 1219 }
1220 if ( i > maxCol ) { 1220 if ( i > maxCol ) {
1221 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1221 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1222 //qDebug("BINGO "); 1222 //qDebug("BINGO ");
1223 } 1223 }
1224 1224
1225 } else { 1225 } else {
1226 QDate dateit = currentDate.addDays( -endX ); 1226 QDate dateit = currentDate.addDays( -endX );
1227 if ( event->recursOn( dateit ) ) { 1227 if ( event->recursOn( dateit ) ) {
1228 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); 1228 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
1229 if ( curCol-endX < 0 ) { 1229 if ( curCol-endX < 0 ) {
1230 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1230 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1231 } 1231 }
1232 } 1232 }
1233 } 1233 }
1234 } 1234 }
1235 } else { 1235 } else {
1236 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1236 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1237 } 1237 }
1238
1239 } else { 1238 } else {
1240 if (beginX <= 0 && curCol == 0) { 1239 if (beginX <= 0 && curCol == 0) {
1241 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1240 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1242 } else if (beginX == curCol) { 1241 } else if (beginX == curCol) {
1243 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1242 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1244 } 1243 }
1245 } 1244 }
1246 } else if (event->isMultiDay()) { 1245 } else if (event->isMultiDay()) {
1247 if ( event->doesRecur () ) { 1246 if ( event->doesRecur () ) {
1248 QDate dateit = currentDate; 1247 QDate dateit = currentDate;
1249 int count = 0; 1248 int count = 0;
1250 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1249 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1251 while (! event->recursOn( dateit ) && count <= max ) { 1250 while (! event->recursOn( dateit ) && count <= max ) {
1252 ++count; 1251 ++count;
1253 dateit = dateit.addDays( -1 ); 1252 dateit = dateit.addDays( -1 );
1254 } 1253 }
1255 bool ok; 1254 bool ok;
1256 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1255 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1257 if ( ok ) 1256 if ( ok )
1258 { 1257 {
1259 int secs = event->dtStart().secsTo( event->dtEnd() ); 1258 int secs = event->dtStart().secsTo( event->dtEnd() );
1260 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1259 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1261 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1260 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1262 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1261 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1263 1262
1264 } 1263 }
1265 } 1264 }
1266 int startY = mAgenda->timeToY(event->dtStart().time()); 1265 int startY = mAgenda->timeToY(event->dtStart().time());
1267 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1266 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1268 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1267 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1269 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1268 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1270 //qDebug("insert!!! "); 1269 //qDebug("insert!!! ");
1271 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1270 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1272 } 1271 }
1273 if (beginX == curCol) { 1272 if (beginX == curCol) {
1274 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1273 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1275 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1274 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1276 } else if (endX == curCol) { 1275 } else if (endX == curCol) {
1277 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1276 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1278 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1277 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1279 } else { 1278 } else {
1280 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1279 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1281 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1280 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1282 } 1281 }
1283 } else { 1282 } else {
1284 int startY = mAgenda->timeToY(event->dtStart().time()); 1283 int startY = mAgenda->timeToY(event->dtStart().time());
1285 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1284 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1286 if (endY < startY) endY = startY; 1285 if (endY < startY) endY = startY;