Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 |
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 | |||
@@ -12,304 +12,304 @@ static KStaticDeleter<KIncidenceFormatter> insd; | |||
12 | 12 | ||
13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) | 13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) |
14 | { | 14 | { |
15 | // #ifndef QT_NO_INPUTDIALOG | 15 | // #ifndef QT_NO_INPUTDIALOG |
16 | // return QInputDialog::getItem( caption, label, items, current, editable ); | 16 | // return QInputDialog::getItem( caption, label, items, current, editable ); |
17 | // #else | 17 | // #else |
18 | // return QString::null; | 18 | // return QString::null; |
19 | // #endif | 19 | // #endif |
20 | mDetails = details; | 20 | mDetails = details; |
21 | mCreated = created ; | 21 | mCreated = created ; |
22 | mModified = modified; | 22 | mModified = modified; |
23 | mText = ""; | 23 | mText = ""; |
24 | if ( inc->typeID() == eventID ) | 24 | if ( inc->typeID() == eventID ) |
25 | setEvent((Event *) inc ); | 25 | setEvent((Event *) inc ); |
26 | else if ( inc->typeID() == todoID ) | 26 | else if ( inc->typeID() == todoID ) |
27 | setTodo((Todo *) inc ); | 27 | setTodo((Todo *) inc ); |
28 | return mText; | 28 | return mText; |
29 | } | 29 | } |
30 | 30 | ||
31 | KIncidenceFormatter* KIncidenceFormatter::instance() | 31 | KIncidenceFormatter* KIncidenceFormatter::instance() |
32 | { | 32 | { |
33 | if (!mInstance) { | 33 | if (!mInstance) { |
34 | mInstance = insd.setObject(new KIncidenceFormatter()); | 34 | mInstance = insd.setObject(new KIncidenceFormatter()); |
35 | } | 35 | } |
36 | return mInstance; | 36 | return mInstance; |
37 | } | 37 | } |
38 | KIncidenceFormatter::~KIncidenceFormatter() | 38 | KIncidenceFormatter::~KIncidenceFormatter() |
39 | { | 39 | { |
40 | if (mInstance == this) | 40 | if (mInstance == this) |
41 | mInstance = insd.setObject(0); | 41 | mInstance = insd.setObject(0); |
42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); | 42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); |
43 | } | 43 | } |
44 | KIncidenceFormatter::KIncidenceFormatter() | 44 | KIncidenceFormatter::KIncidenceFormatter() |
45 | { | 45 | { |
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
51 | mCurrentIncidence = event; | 51 | mCurrentIncidence = event; |
52 | bool shortDate = true; | 52 | bool shortDate = true; |
53 | if ( mode == 0 ) { | 53 | if ( mode == 0 ) { |
54 | addTag("h3",deTag(event->summary())); | 54 | addTag("h3",deTag(event->summary())); |
55 | formatReadOnly(event); | 55 | formatReadOnly(event); |
56 | } | 56 | } |
57 | else { | 57 | else { |
58 | if ( mColorMode == 1 ) { | 58 | if ( mColorMode == 1 ) { |
59 | mText +="<font color=\"#00A000\">"; | 59 | mText +="<font color=\"#00A000\">"; |
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 |
157 | 157 | ||
158 | } | 158 | } |
159 | if ( mModified ) { | 159 | if ( mModified ) { |
160 | #ifdef DESKTOP_VERSION | 160 | #ifdef DESKTOP_VERSION |
161 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 161 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
162 | #else | 162 | #else |
163 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 163 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
164 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 164 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | } | 167 | } |
168 | if ( mDetails ) { | 168 | if ( mDetails ) { |
169 | if (!event->description().isEmpty()) { | 169 | if (!event->description().isEmpty()) { |
170 | addTag("p",i18n("<b>Details: </b>")); | 170 | addTag("p",i18n("<b>Details: </b>")); |
171 | addTag("p",deTag(event->description())); | 171 | addTag("p",deTag(event->description())); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | void KIncidenceFormatter::setTodo(Todo *event ) | 177 | void 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 |
268 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 268 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
269 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 269 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | } | 272 | } |
273 | if ( mDetails ) { | 273 | if ( mDetails ) { |
274 | if (!event->description().isEmpty()) { | 274 | if (!event->description().isEmpty()) { |
275 | addTag("p",i18n("<b>Details: </b>")); | 275 | addTag("p",i18n("<b>Details: </b>")); |
276 | addTag("p",deTag(event->description())); | 276 | addTag("p",deTag(event->description())); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void KIncidenceFormatter::setJournal(Journal* ) | 281 | void KIncidenceFormatter::setJournal(Journal* ) |
282 | { | 282 | { |
283 | 283 | ||
284 | } | 284 | } |
285 | 285 | ||
286 | void KIncidenceFormatter::formatCategories(Incidence *event) | 286 | void KIncidenceFormatter::formatCategories(Incidence *event) |
287 | { | 287 | { |
288 | if (!event->categoriesStr().isEmpty()) { | 288 | if (!event->categoriesStr().isEmpty()) { |
289 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); | 289 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); |
290 | //mText.append(event->categoriesStr()); | 290 | //mText.append(event->categoriesStr()); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 293 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
294 | { | 294 | { |
295 | int number=text.contains("\n"); | 295 | int number=text.contains("\n"); |
296 | QString str = "<" + tag + ">"; | 296 | QString str = "<" + tag + ">"; |
297 | QString tmpText=text; | 297 | QString tmpText=text; |
298 | QString tmpStr=str; | 298 | QString tmpStr=str; |
299 | if(number !=-1) | 299 | if(number !=-1) |
300 | { | 300 | { |
301 | if (number > 0) { | 301 | if (number > 0) { |
302 | int pos=0; | 302 | int pos=0; |
303 | QString tmp; | 303 | QString tmp; |
304 | for(int i=0;i<=number;i++) { | 304 | for(int i=0;i<=number;i++) { |
305 | pos=tmpText.find("\n"); | 305 | pos=tmpText.find("\n"); |
306 | tmp=tmpText.left(pos); | 306 | tmp=tmpText.left(pos); |
307 | tmpText=tmpText.right(tmpText.length()-pos-1); | 307 | tmpText=tmpText.right(tmpText.length()-pos-1); |
308 | tmpStr+=tmp+"<br>"; | 308 | tmpStr+=tmp+"<br>"; |
309 | } | 309 | } |
310 | } | 310 | } |
311 | else tmpStr += tmpText; | 311 | else tmpStr += tmpText; |
312 | tmpStr+="</" + tag + ">"; | 312 | tmpStr+="</" + tag + ">"; |
313 | mText.append(tmpStr); | 313 | mText.append(tmpStr); |
314 | } | 314 | } |
315 | else | 315 | else |