summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2007-06-06 13:14:20 (UTC)
committer zautrix <zautrix>2007-06-06 13:14:20 (UTC)
commit623b4d4abe87789dacd4c14de88a63b44ca352b7 (patch) (unidiff)
treea6bcc1b9359bf904e08b508576c2d2e958cde55c /libkcal
parentd5c53970b9e12bfe774d1fecd603080aded24e09 (diff)
downloadkdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.zip
kdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.tar.gz
kdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.tar.bz2
display of next alarm of recurring events in event viewer fixed
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 4dfe16a..733b897 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -114,48 +114,56 @@ void KIncidenceFormatter::setEvent(Event *event)
114 114
115 bool ok; 115 bool ok;
116 QDate start = QDate::currentDate(); 116 QDate start = QDate::currentDate();
117 QDateTime next; 117 QDateTime next;
118 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 118 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
119 if ( ok ) { 119 if ( ok ) {
120 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 120 addTag("p",i18n("<b>Next recurrence is on:</b>") );
121 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 121 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
122 122
123 } else { 123 } else {
124 bool last; 124 bool last;
125 QDate nextd; 125 QDate nextd;
126 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 126 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
127 if ( last ) { 127 if ( last ) {
128 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 128 addTag("p",i18n("<b>Last recurrence was on:</b>") );
129 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 129 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 134
135 if (event->isAlarmEnabled()) { 135 if (event->isAlarmEnabled()) {
136 Alarm *alarm =event->alarms().first() ; 136 Alarm *alarm =event->alarms().first() ;
137 QDateTime t = alarm->time(); 137 QDateTime t = alarm->time();
138 if (event->doesRecur()) {
139 bool ok = false;
140 int offset = 0;
141 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
142 if ( ok ) {
143 t = next;
144 }
145 }
138 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 146 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
139 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 147 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
140 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 148 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
141 //addTag("p",s); 149 //addTag("p",s);
142 } 150 }
143 151
144 152
145 153
146 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 154 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
147 // mText.append(event->secrecyStr()+"<br>"); 155 // mText.append(event->secrecyStr()+"<br>");
148 formatCategories(event); 156 formatCategories(event);
149 157
150 formatAttendees(event); 158 formatAttendees(event);
151 159
152 if ( mCreated ) { 160 if ( mCreated ) {
153#ifdef DESKTOP_VERSION 161#ifdef DESKTOP_VERSION
154 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 162 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#else 163#else
156 addTag("p",i18n("<b>Created: ") +" </b>"); 164 addTag("p",i18n("<b>Created: ") +" </b>");
157 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 165 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
158#endif 166#endif
159 167
160 } 168 }
161 if ( mModified ) { 169 if ( mModified ) {
@@ -223,48 +231,56 @@ void KIncidenceFormatter::setTodo(Todo *event )
223 QString recurText = event->recurrence()->recurrenceText(); 231 QString recurText = event->recurrence()->recurrenceText();
224 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 232 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
225 } 233 }
226 234
227 if (event->hasStartDate()) { 235 if (event->hasStartDate()) {
228 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 236 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
229 } 237 }
230 238
231 239
232 if (event->hasDueDate()) { 240 if (event->hasDueDate()) {
233 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 241 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
234 } 242 }
235 243
236 if (!event->location().isEmpty()) { 244 if (!event->location().isEmpty()) {
237 addTag("b",i18n("Location: ")); 245 addTag("b",i18n("Location: "));
238 mText.append(deTag(event->location())+"<br>"); 246 mText.append(deTag(event->location())+"<br>");
239 } 247 }
240 248
241 mText.append(i18n("<p><b>Priority:</b> %2</p>") 249 mText.append(i18n("<p><b>Priority:</b> %2</p>")
242 .arg(QString::number(event->priority()))); 250 .arg(QString::number(event->priority())));
243 251
244 if (event->isAlarmEnabled()) { 252 if (event->isAlarmEnabled()) {
245 Alarm *alarm =event->alarms().first() ; 253 Alarm *alarm =event->alarms().first() ;
246 QDateTime t = alarm->time(); 254 QDateTime t = alarm->time();
255 if (event->doesRecur()) {
256 bool ok = false;
257 int offset = 0;
258 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
259 if ( ok ) {
260 t = next;
261 }
262 }
247 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 263 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
248 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 264 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
249 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 265 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
250 //addTag("p",s); 266 //addTag("p",s);
251 } 267 }
252 268
253 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 269 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
254 formatCategories(event); 270 formatCategories(event);
255 271
256 formatAttendees(event); 272 formatAttendees(event);
257 if ( mCreated ) { 273 if ( mCreated ) {
258#ifdef DESKTOP_VERSION 274#ifdef DESKTOP_VERSION
259 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 275 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
260#else 276#else
261 addTag("p",i18n("<b>Created: ") +" </b>"); 277 addTag("p",i18n("<b>Created: ") +" </b>");
262 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 278 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
263#endif 279#endif
264 280
265 } 281 }
266 if ( mModified ) { 282 if ( mModified ) {
267#ifdef DESKTOP_VERSION 283#ifdef DESKTOP_VERSION
268 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 284 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
269#else 285#else
270 addTag("p",i18n("<b>Last modified: ") +" </b>"); 286 addTag("p",i18n("<b>Last modified: ") +" </b>");