summaryrefslogtreecommitdiffabout
path: root/libkcal/kincidenceformatter.cpp
Unidiff
Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 9359fad..f8f40f1 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -60,97 +60,97 @@ void KIncidenceFormatter::setEvent(Event *event)
60 } 60 }
61 if ( mColorMode == 2 ) { 61 if ( mColorMode == 2 ) {
62 mText +="<font color=\"#C00000\">"; 62 mText +="<font color=\"#C00000\">";
63 } 63 }
64 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 64 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
65 if ( mode == 1 ) { 65 if ( mode == 1 ) {
66 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 66 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
67 } else { 67 } else {
68 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 68 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
69 } 69 }
70 formatReadOnly(event); 70 formatReadOnly(event);
71 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 71 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
72 if ( mColorMode ) 72 if ( mColorMode )
73 mText += "</font>"; 73 mText += "</font>";
74 } 74 }
75 if (event->cancelled ()) { 75 if (event->cancelled ()) {
76 mText +="<font color=\"#B00000\">"; 76 mText +="<font color=\"#B00000\">";
77 addTag("i",i18n("This event has been cancelled!")); 77 addTag("i",i18n("This event has been cancelled!"));
78 mText.append("<br>"); 78 mText.append("<br>");
79 mText += "</font>"; 79 mText += "</font>";
80 } 80 }
81 if (event->doesFloat()) { 81 if (event->doesFloat()) {
82 if (event->isMultiDay()) { 82 if (event->isMultiDay()) {
83 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 83 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
84 .arg(event->dtStartDateStr(shortDate)) 84 .arg(event->dtStartDateStr(shortDate))
85 .arg(event->dtEndDateStr(shortDate))); 85 .arg(event->dtEndDateStr(shortDate)));
86 } else { 86 } else {
87 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 87 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
88 } 88 }
89 } else { 89 } else {
90 if (event->isMultiDay()) { 90 if (event->isMultiDay()) {
91 mText.append(i18n("<p><b>From:</b> %1</p> ") 91 mText.append(i18n("<p><b>From:</b> %1</p> ")
92 .arg(event->dtStartStr( shortDate))); 92 .arg(event->dtStartStr( shortDate)));
93 mText.append(i18n("<p><b>To:</b> %1</p>") 93 mText.append(i18n("<p><b>To:</b> %1</p>")
94 .arg(event->dtEndStr(shortDate))); 94 .arg(event->dtEndStr(shortDate)));
95 } else { 95 } else {
96 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 96 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
97 .arg(event->dtStartTimeStr()) 97 .arg(event->dtStartTimeStr())
98 .arg(event->dtEndTimeStr())); 98 .arg(event->dtEndTimeStr()));
99 mText.append(i18n("<p><b>On:</b> %1</p> ") 99 mText.append(i18n("<p><b>On:</b> %1</p> ")
100 .arg(event->dtStartDateStr( shortDate ))); 100 .arg(event->dtStartDateStr( shortDate )));
101 } 101 }
102 } 102 }
103 if (!event->location().isEmpty()) { 103 if (!event->location().isEmpty()) {
104 addTag("b",i18n("Location: ")); 104 addTag("b",i18n("Location: "));
105 mText.append(deTag(event->location())+"<br>"); 105 mText.append(deTag(event->location())+"<br>");
106 } 106 }
107 107
108 if (event->recurrence()->doesRecur()) { 108 if (event->doesRecur()) {
109 109
110 QString recurText = event->recurrence()->recurrenceText(); 110 QString recurText = event->recurrence()->recurrenceText();
111 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 111 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
112 112
113 bool ok; 113 bool ok;
114 QDate start = QDate::currentDate(); 114 QDate start = QDate::currentDate();
115 QDateTime next; 115 QDateTime next;
116 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 116 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
117 if ( ok ) { 117 if ( ok ) {
118 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 118 addTag("p",i18n("<b>Next recurrence is on:</b>") );
119 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 119 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
120 120
121 } else { 121 } else {
122 bool last; 122 bool last;
123 QDate nextd; 123 QDate nextd;
124 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 124 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
125 if ( last ) { 125 if ( last ) {
126 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 126 addTag("p",i18n("<b>Last recurrence was on:</b>") );
127 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 127 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
128 } 128 }
129 } 129 }
130 } 130 }
131 131
132 132
133 if (event->isAlarmEnabled()) { 133 if (event->isAlarmEnabled()) {
134 Alarm *alarm =event->alarms().first() ; 134 Alarm *alarm =event->alarms().first() ;
135 QDateTime t = alarm->time(); 135 QDateTime t = alarm->time();
136 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 136 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
137 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 137 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
138 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 138 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
139 //addTag("p",s); 139 //addTag("p",s);
140 } 140 }
141 141
142 142
143 143
144 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 144 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
145 // mText.append(event->secrecyStr()+"<br>"); 145 // mText.append(event->secrecyStr()+"<br>");
146 formatCategories(event); 146 formatCategories(event);
147 147
148 formatAttendees(event); 148 formatAttendees(event);
149 149
150 if ( mCreated ) { 150 if ( mCreated ) {
151#ifdef DESKTOP_VERSION 151#ifdef DESKTOP_VERSION
152 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 152 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
153#else 153#else
154 addTag("p",i18n("<b>Created: ") +" </b>"); 154 addTag("p",i18n("<b>Created: ") +" </b>");
155 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 155 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
156#endif 156#endif
@@ -171,97 +171,97 @@ void KIncidenceFormatter::setEvent(Event *event)
171 addTag("p",deTag(event->description())); 171 addTag("p",deTag(event->description()));
172 } 172 }
173 } 173 }
174 174
175} 175}
176 176
177void KIncidenceFormatter::setTodo(Todo *event ) 177void KIncidenceFormatter::setTodo(Todo *event )
178{ 178{
179 int mode = 0; 179 int mode = 0;
180 mCurrentIncidence = event; 180 mCurrentIncidence = event;
181 bool shortDate = true; 181 bool shortDate = true;
182 if (mode == 0 ) { 182 if (mode == 0 ) {
183 addTag("h3",deTag(event->summary())); 183 addTag("h3",deTag(event->summary()));
184 formatReadOnly(event); 184 formatReadOnly(event);
185 } 185 }
186 else { 186 else {
187 if ( mColorMode == 1 ) { 187 if ( mColorMode == 1 ) {
188 mText +="<font color=\"#00A000\">"; 188 mText +="<font color=\"#00A000\">";
189 } 189 }
190 if ( mColorMode == 2 ) { 190 if ( mColorMode == 2 ) {
191 mText +="<font color=\"#B00000\">"; 191 mText +="<font color=\"#B00000\">";
192 } 192 }
193 if ( mode == 1 ) { 193 if ( mode == 1 ) {
194 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 194 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
195 } else { 195 } else {
196 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 196 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
197 } 197 }
198 formatReadOnly(event); 198 formatReadOnly(event);
199 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 199 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
200 if ( mColorMode ) 200 if ( mColorMode )
201 mText += "</font>"; 201 mText += "</font>";
202 } 202 }
203 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 203 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
204 mText +="<font color=\"#B00000\">"; 204 mText +="<font color=\"#B00000\">";
205 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 205 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
206 mText += "</font>"; 206 mText += "</font>";
207 } else { 207 } else {
208 mText.append(i18n("<p><i>%1 % completed</i></p>") 208 mText.append(i18n("<p><i>%1 % completed</i></p>")
209 .arg(event->percentComplete())); 209 .arg(event->percentComplete()));
210 } 210 }
211 if (event->cancelled ()) { 211 if (event->cancelled ()) {
212 mText +="<font color=\"#B00000\">"; 212 mText +="<font color=\"#B00000\">";
213 addTag("i",i18n("This todo has been cancelled!")); 213 addTag("i",i18n("This todo has been cancelled!"));
214 mText.append("<br>"); 214 mText.append("<br>");
215 mText += "</font>"; 215 mText += "</font>";
216 } 216 }
217 217
218 218
219 if (event->recurrence()->doesRecur()) { 219 if (event->doesRecur()) {
220 220
221 QString recurText = event->recurrence()->recurrenceText(); 221 QString recurText = event->recurrence()->recurrenceText();
222 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 222 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
223 } 223 }
224 224
225 if (event->hasStartDate()) { 225 if (event->hasStartDate()) {
226 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 226 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
227 } 227 }
228 228
229 229
230 if (event->hasDueDate()) { 230 if (event->hasDueDate()) {
231 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 231 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
232 } 232 }
233 233
234 if (!event->location().isEmpty()) { 234 if (!event->location().isEmpty()) {
235 addTag("b",i18n("Location: ")); 235 addTag("b",i18n("Location: "));
236 mText.append(deTag(event->location())+"<br>"); 236 mText.append(deTag(event->location())+"<br>");
237 } 237 }
238 238
239 mText.append(i18n("<p><b>Priority:</b> %2</p>") 239 mText.append(i18n("<p><b>Priority:</b> %2</p>")
240 .arg(QString::number(event->priority()))); 240 .arg(QString::number(event->priority())));
241 241
242 if (event->isAlarmEnabled()) { 242 if (event->isAlarmEnabled()) {
243 Alarm *alarm =event->alarms().first() ; 243 Alarm *alarm =event->alarms().first() ;
244 QDateTime t = alarm->time(); 244 QDateTime t = alarm->time();
245 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 245 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
246 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 246 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
247 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 247 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
248 //addTag("p",s); 248 //addTag("p",s);
249 } 249 }
250 250
251 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 251 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
252 formatCategories(event); 252 formatCategories(event);
253 253
254 formatAttendees(event); 254 formatAttendees(event);
255 if ( mCreated ) { 255 if ( mCreated ) {
256#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
257 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 257 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
258#else 258#else
259 addTag("p",i18n("<b>Created: ") +" </b>"); 259 addTag("p",i18n("<b>Created: ") +" </b>");
260 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 260 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
261#endif 261#endif
262 262
263 } 263 }
264 if ( mModified ) { 264 if ( mModified ) {
265#ifdef DESKTOP_VERSION 265#ifdef DESKTOP_VERSION
266 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 266 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#else 267#else