summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (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
@@ -1827,30 +1827,30 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int
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
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 7a685d8..81681df 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -573,25 +573,26 @@ void KOAgendaItem::computeText()
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 }
@@ -649,39 +650,40 @@ void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
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{
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 97acd4c..37d89a6 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -100,25 +100,25 @@ class KOAgendaItem : public QWidget
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:
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1cf03a0..d8a2134 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1226,25 +1226,24 @@ void KOAgendaView::fillAgenda()
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;