summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index d0a7b07..38bd93a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -90,96 +90,97 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
90QString KOAgendaItem::getWhatsThisText() 90QString KOAgendaItem::getWhatsThisText()
91{ 91{
92 if ( mIncidence ) 92 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 94 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 95 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 96 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 97 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 98}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 99void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 100{
101 mIncidence = incidence; 101 mIncidence = incidence;
102 mDate = qd; 102 mDate = qd;
103 mFirstMultiItem = 0; 103 mFirstMultiItem = 0;
104 mNextMultiItem = 0; 104 mNextMultiItem = 0;
105 mLastMultiItem = 0; 105 mLastMultiItem = 0;
106 computeText(); 106 computeText();
107 107
108 if ( (incidence->type() == "Todo") && 108 if ( (incidence->type() == "Todo") &&
109 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 109 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
113 else 113 else
114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
115 } 115 }
116 else { 116 else {
117 QStringList categories = mIncidence->categories(); 117 QStringList categories = mIncidence->categories();
118 QString cat = categories.first(); 118 QString cat = categories.first();
119 if (cat.isEmpty()) { 119 if (cat.isEmpty()) {
120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
122 else 122 else
123 mBackgroundColor =KOPrefs::instance()->mEventColor; 123 mBackgroundColor =KOPrefs::instance()->mEventColor;
124 } else { 124 } else {
125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
129 } 129 }
130 } 130 }
131 131
132 } 132 }
133 mColorGroup = QColorGroup( mBackgroundColor.light(), 133 mColorGroup = QColorGroup( mBackgroundColor.light(),
134 mBackgroundColor.dark(),mBackgroundColor.light(), 134 mBackgroundColor.dark(),mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 136 setBackgroundColor( mBackgroundColor );
137 137
138 mConflictItems.clear();
138 setCellXY(0,0,1); 139 setCellXY(0,0,1);
139 setCellXWidth(0); 140 setCellXWidth(0);
140 setSubCell(0); 141 setSubCell(0);
141 setSubCells(1); 142 setSubCells(1);
142 setMultiItem(0,0,0); 143 setMultiItem(0,0,0);
143 startMove(); 144 startMove();
144 mSelected = true; 145 mSelected = true;
145 select(false); 146 select(false);
146 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 147 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
147 mFontPixelSize = fontinf.height();; 148 mFontPixelSize = fontinf.height();;
148 hide(); 149 hide();
149 xPaintCoord = -1; 150 xPaintCoord = -1;
150 yPaintCoord = -1; 151 yPaintCoord = -1;
151} 152}
152 153
153 154
154KOAgendaItem::~KOAgendaItem() 155KOAgendaItem::~KOAgendaItem()
155{ 156{
156 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 157 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
157 158
158} 159}
159 160
160void KOAgendaItem::recreateIncidence() 161void KOAgendaItem::recreateIncidence()
161{ 162{
162#if 0 163#if 0
163 Incidence* newInc = mIncidence->clone(); 164 Incidence* newInc = mIncidence->clone();
164 newInc->recreate(); 165 newInc->recreate();
165 if ( mIncidence->doesRecur() ) { 166 if ( mIncidence->doesRecur() ) {
166 mIncidence->addExDate( mDate ); 167 mIncidence->addExDate( mDate );
167 newInc->recurrence()->unsetRecurs(); 168 newInc->recurrence()->unsetRecurs();
168 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 169 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
169 QTime tim = mIncidence->dtStart().time(); 170 QTime tim = mIncidence->dtStart().time();
170 newInc->setDtStart( QDateTime(mDate, tim) ); 171 newInc->setDtStart( QDateTime(mDate, tim) );
171 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 172 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
172 } 173 }
173#endif 174#endif
174 mIncidence = mIncidence->recreateCloneException( mDate ); 175 mIncidence = mIncidence->recreateCloneException( mDate );
175} 176}
176bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 177bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
177{ 178{
178 int size = AGENDA_ICON_SIZE; 179 int size = AGENDA_ICON_SIZE;
179 180
180 int yOff = 0; 181 int yOff = 0;
181 int xOff = 0; 182 int xOff = 0;
182 int x = pos().x() +3; 183 int x = pos().x() +3;
183 int y; 184 int y;
184 if ( mAllDay ) 185 if ( mAllDay )
185 y = pos().y()+3; 186 y = pos().y()+3;