Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index e506a96..d67ad52 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -110,55 +110,56 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
110 | 110 | ||
111 | bool ok; | 111 | bool ok; |
112 | QDate start = QDate::currentDate(); | 112 | QDate start = QDate::currentDate(); |
113 | QDateTime next; | 113 | QDateTime next; |
114 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 114 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
115 | if ( ok ) { | 115 | if ( ok ) { |
116 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 116 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
117 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 117 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
118 | 118 | ||
119 | } else { | 119 | } else { |
120 | bool last; | 120 | bool last; |
121 | QDate nextd; | 121 | QDate nextd; |
122 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 122 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
123 | if ( last ) { | 123 | if ( last ) { |
124 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 124 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
125 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 125 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | if (event->isAlarmEnabled()) { | 131 | if (event->isAlarmEnabled()) { |
132 | Alarm *alarm =event->alarms().first() ; | 132 | Alarm *alarm =event->alarms().first() ; |
133 | QDateTime t = alarm->time(); | 133 | QDateTime t = alarm->time(); |
134 | int min = t.secsTo( event->dtStart() )/60; | 134 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
135 | QString s =i18n("(%1 min before)").arg( min ); | ||
136 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); | 135 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); |
137 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 136 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
138 | //addTag("p",s); | 137 | //addTag("p",s); |
139 | } | 138 | } |
140 | 139 | ||
140 | |||
141 | |||
141 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
142 | // mText.append(event->secrecyStr()+"<br>"); | 143 | // mText.append(event->secrecyStr()+"<br>"); |
143 | formatCategories(event); | 144 | formatCategories(event); |
144 | if ( mDetails ) { | 145 | if ( mDetails ) { |
145 | if (!event->description().isEmpty()) { | 146 | if (!event->description().isEmpty()) { |
146 | addTag("p",i18n("<b>Details: </b>")); | 147 | addTag("p",i18n("<b>Details: </b>")); |
147 | addTag("p",deTag(event->description())); | 148 | addTag("p",deTag(event->description())); |
148 | } | 149 | } |
149 | } | 150 | } |
150 | 151 | ||
151 | formatReadOnly(event); | 152 | formatReadOnly(event); |
152 | formatAttendees(event); | 153 | formatAttendees(event); |
153 | 154 | ||
154 | if ( mCreated ) { | 155 | if ( mCreated ) { |
155 | addTag("p",i18n("<b>Created: ") +" </b>"); | 156 | addTag("p",i18n("<b>Created: ") +" </b>"); |
156 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 157 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
157 | 158 | ||
158 | } | 159 | } |
159 | if ( mModified ) { | 160 | if ( mModified ) { |
160 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 161 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
161 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 162 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
162 | 163 | ||
163 | } | 164 | } |
164 | 165 | ||
@@ -203,48 +204,57 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
203 | } | 204 | } |
204 | 205 | ||
205 | if (!event->location().isEmpty()) { | 206 | if (!event->location().isEmpty()) { |
206 | addTag("b",i18n("Location: ")); | 207 | addTag("b",i18n("Location: ")); |
207 | mText.append(deTag(event->location())+"<br>"); | 208 | mText.append(deTag(event->location())+"<br>"); |
208 | } | 209 | } |
209 | 210 | ||
210 | if (event->recurrence()->doesRecur()) { | 211 | if (event->recurrence()->doesRecur()) { |
211 | 212 | ||
212 | QString recurText = event->recurrence()->recurrenceText(); | 213 | QString recurText = event->recurrence()->recurrenceText(); |
213 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 214 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
214 | } | 215 | } |
215 | 216 | ||
216 | if (event->hasStartDate()) { | 217 | if (event->hasStartDate()) { |
217 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); | 218 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); |
218 | } | 219 | } |
219 | 220 | ||
220 | 221 | ||
221 | if (event->hasDueDate()) { | 222 | if (event->hasDueDate()) { |
222 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 223 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
223 | } | 224 | } |
224 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 225 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
225 | .arg(QString::number(event->priority()))); | 226 | .arg(QString::number(event->priority()))); |
226 | 227 | ||
228 | if (event->isAlarmEnabled()) { | ||
229 | Alarm *alarm =event->alarms().first() ; | ||
230 | QDateTime t = alarm->time(); | ||
231 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | ||
232 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
233 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
234 | //addTag("p",s); | ||
235 | } | ||
236 | |||
227 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 237 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
228 | formatCategories(event); | 238 | formatCategories(event); |
229 | if ( mDetails ) { | 239 | if ( mDetails ) { |
230 | if (!event->description().isEmpty()) { | 240 | if (!event->description().isEmpty()) { |
231 | addTag("p",i18n("<b>Details: </b>")); | 241 | addTag("p",i18n("<b>Details: </b>")); |
232 | addTag("p",deTag(event->description())); | 242 | addTag("p",deTag(event->description())); |
233 | } | 243 | } |
234 | } | 244 | } |
235 | formatReadOnly(event); | 245 | formatReadOnly(event); |
236 | formatAttendees(event); | 246 | formatAttendees(event); |
237 | if ( mCreated ) { | 247 | if ( mCreated ) { |
238 | addTag("p",i18n("<b>Created: ") +" </b>"); | 248 | addTag("p",i18n("<b>Created: ") +" </b>"); |
239 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 249 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
240 | 250 | ||
241 | } | 251 | } |
242 | if ( mModified ) { | 252 | if ( mModified ) { |
243 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 253 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
244 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 254 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
245 | 255 | ||
246 | } | 256 | } |
247 | } | 257 | } |
248 | 258 | ||
249 | void KIncidenceFormatter::setJournal(Journal* ) | 259 | void KIncidenceFormatter::setJournal(Journal* ) |
250 | { | 260 | { |