author | zautrix <zautrix> | 2005-04-15 09:18:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-15 09:18:49 (UTC) |
commit | ab47475f1b03a8c82f9b0388549a2618743f2a69 (patch) (unidiff) | |
tree | 381622b3ceb94daf771a2697ee10f0cd6572e947 /libkcal | |
parent | acb5803cdda97ef1369388eb15eb669e2835c06a (diff) | |
download | kdepimpi-ab47475f1b03a8c82f9b0388549a2618743f2a69.zip kdepimpi-ab47475f1b03a8c82f9b0388549a2618743f2a69.tar.gz kdepimpi-ab47475f1b03a8c82f9b0388549a2618743f2a69.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index d67ad52..8ae5b46 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -1,352 +1,371 @@ | |||
1 | #include "kincidenceformatter.h" | 1 | #include "kincidenceformatter.h" |
2 | #include <kstaticdeleter.h> | 2 | #include <kstaticdeleter.h> |
3 | #include <kglobal.h> | 3 | #include <kglobal.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | #ifdef DEKTOP_VERSION | 5 | #ifdef DEKTOP_VERSION |
6 | #include <kabc/stdaddressbook.h> | 6 | #include <kabc/stdaddressbook.h> |
7 | #define size count | 7 | #define size count |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; | 10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; |
11 | static KStaticDeleter<KIncidenceFormatter> insd; | 11 | 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->type() == "Event" ) | 24 | if ( inc->type() == "Event" ) |
25 | setEvent((Event *) inc ); | 25 | setEvent((Event *) inc ); |
26 | else if ( inc->type() == "Todo" ) | 26 | else if ( inc->type() == "Todo" ) |
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 | } | 55 | } |
56 | else { | 56 | else { |
57 | if ( mColorMode == 1 ) { | 57 | if ( mColorMode == 1 ) { |
58 | mText +="<font color=\"#00A000\">"; | 58 | mText +="<font color=\"#00A000\">"; |
59 | } | 59 | } |
60 | if ( mColorMode == 2 ) { | 60 | if ( mColorMode == 2 ) { |
61 | mText +="<font color=\"#C00000\">"; | 61 | mText +="<font color=\"#C00000\">"; |
62 | } | 62 | } |
63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
64 | if ( mode == 1 ) { | 64 | if ( mode == 1 ) { |
65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
66 | } else { | 66 | } else { |
67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
68 | } | 68 | } |
69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
70 | if ( mColorMode ) | 70 | if ( mColorMode ) |
71 | mText += "</font>"; | 71 | mText += "</font>"; |
72 | } | 72 | } |
73 | if (event->cancelled ()) { | 73 | if (event->cancelled ()) { |
74 | mText +="<font color=\"#B00000\">"; | 74 | mText +="<font color=\"#B00000\">"; |
75 | addTag("i",i18n("This event has been cancelled!")); | 75 | addTag("i",i18n("This event has been cancelled!")); |
76 | mText.append("<br>"); | 76 | mText.append("<br>"); |
77 | mText += "</font>"; | 77 | mText += "</font>"; |
78 | } | 78 | } |
79 | if (!event->location().isEmpty()) { | ||
80 | addTag("b",i18n("Location: ")); | ||
81 | mText.append(deTag(event->location())+"<br>"); | ||
82 | } | ||
83 | if (event->doesFloat()) { | 79 | if (event->doesFloat()) { |
84 | if (event->isMultiDay()) { | 80 | if (event->isMultiDay()) { |
85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 81 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
86 | .arg(event->dtStartDateStr(shortDate)) | 82 | .arg(event->dtStartDateStr(shortDate)) |
87 | .arg(event->dtEndDateStr(shortDate))); | 83 | .arg(event->dtEndDateStr(shortDate))); |
88 | } else { | 84 | } else { |
89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 85 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
90 | } | 86 | } |
91 | } else { | 87 | } else { |
92 | if (event->isMultiDay()) { | 88 | if (event->isMultiDay()) { |
93 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 89 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
94 | .arg(event->dtStartStr( shortDate))); | 90 | .arg(event->dtStartStr( shortDate))); |
95 | mText.append(i18n("<p><b>To:</b> %1</p>") | 91 | mText.append(i18n("<p><b>To:</b> %1</p>") |
96 | .arg(event->dtEndStr(shortDate))); | 92 | .arg(event->dtEndStr(shortDate))); |
97 | } else { | 93 | } else { |
98 | mText.append(i18n("<p><b>On:</b> %1</p> ") | ||
99 | .arg(event->dtStartDateStr( shortDate ))); | ||
100 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 94 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
101 | .arg(event->dtStartTimeStr()) | 95 | .arg(event->dtStartTimeStr()) |
102 | .arg(event->dtEndTimeStr())); | 96 | .arg(event->dtEndTimeStr())); |
97 | mText.append(i18n("<p><b>On:</b> %1</p> ") | ||
98 | .arg(event->dtStartDateStr( shortDate ))); | ||
103 | } | 99 | } |
104 | } | 100 | } |
101 | if (!event->location().isEmpty()) { | ||
102 | addTag("b",i18n("Location: ")); | ||
103 | mText.append(deTag(event->location())+"<br>"); | ||
104 | } | ||
105 | 105 | ||
106 | if (event->recurrence()->doesRecur()) { | 106 | if (event->recurrence()->doesRecur()) { |
107 | 107 | ||
108 | QString recurText = event->recurrence()->recurrenceText(); | 108 | QString recurText = event->recurrence()->recurrenceText(); |
109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
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 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 134 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
135 | 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 )); |
136 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 136 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
137 | //addTag("p",s); | 137 | //addTag("p",s); |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
143 | // mText.append(event->secrecyStr()+"<br>"); | 143 | // mText.append(event->secrecyStr()+"<br>"); |
144 | formatCategories(event); | 144 | formatCategories(event); |
145 | if ( mDetails ) { | ||
146 | if (!event->description().isEmpty()) { | ||
147 | addTag("p",i18n("<b>Details: </b>")); | ||
148 | addTag("p",deTag(event->description())); | ||
149 | } | ||
150 | } | ||
151 | 145 | ||
152 | formatReadOnly(event); | 146 | formatReadOnly(event); |
153 | formatAttendees(event); | 147 | formatAttendees(event); |
154 | 148 | ||
155 | if ( mCreated ) { | 149 | if ( mCreated ) { |
150 | #ifdef DESKTOP_VERSION | ||
151 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
152 | #else | ||
156 | addTag("p",i18n("<b>Created: ") +" </b>"); | 153 | addTag("p",i18n("<b>Created: ") +" </b>"); |
157 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 154 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
155 | #endif | ||
158 | 156 | ||
159 | } | 157 | } |
160 | if ( mModified ) { | 158 | if ( mModified ) { |
159 | #ifdef DESKTOP_VERSION | ||
160 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
161 | #else | ||
161 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 162 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
162 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 163 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
164 | #endif | ||
163 | 165 | ||
164 | } | 166 | } |
167 | if ( mDetails ) { | ||
168 | if (!event->description().isEmpty()) { | ||
169 | addTag("p",i18n("<b>Details: </b>")); | ||
170 | addTag("p",deTag(event->description())); | ||
171 | } | ||
172 | } | ||
165 | 173 | ||
166 | } | 174 | } |
167 | 175 | ||
168 | void KIncidenceFormatter::setTodo(Todo *event ) | 176 | void KIncidenceFormatter::setTodo(Todo *event ) |
169 | { | 177 | { |
170 | int mode = 0; | 178 | int mode = 0; |
171 | mCurrentIncidence = event; | 179 | mCurrentIncidence = event; |
172 | bool shortDate = true; | 180 | bool shortDate = true; |
173 | if (mode == 0 ) | 181 | if (mode == 0 ) |
174 | addTag("h3",deTag(event->summary())); | 182 | addTag("h3",deTag(event->summary())); |
175 | else { | 183 | else { |
176 | if ( mColorMode == 1 ) { | 184 | if ( mColorMode == 1 ) { |
177 | mText +="<font color=\"#00A000\">"; | 185 | mText +="<font color=\"#00A000\">"; |
178 | } | 186 | } |
179 | if ( mColorMode == 2 ) { | 187 | if ( mColorMode == 2 ) { |
180 | mText +="<font color=\"#B00000\">"; | 188 | mText +="<font color=\"#B00000\">"; |
181 | } | 189 | } |
182 | if ( mode == 1 ) { | 190 | if ( mode == 1 ) { |
183 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 191 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
184 | } else { | 192 | } else { |
185 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 193 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
186 | } | 194 | } |
187 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 195 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
188 | if ( mColorMode ) | 196 | if ( mColorMode ) |
189 | mText += "</font>"; | 197 | mText += "</font>"; |
190 | } | 198 | } |
191 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 199 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
192 | mText +="<font color=\"#B00000\">"; | 200 | mText +="<font color=\"#B00000\">"; |
193 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 201 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
194 | mText += "</font>"; | 202 | mText += "</font>"; |
195 | } else { | 203 | } else { |
196 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 204 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
197 | .arg(event->percentComplete())); | 205 | .arg(event->percentComplete())); |
198 | } | 206 | } |
199 | if (event->cancelled ()) { | 207 | if (event->cancelled ()) { |
200 | mText +="<font color=\"#B00000\">"; | 208 | mText +="<font color=\"#B00000\">"; |
201 | addTag("i",i18n("This todo has been cancelled!")); | 209 | addTag("i",i18n("This todo has been cancelled!")); |
202 | mText.append("<br>"); | 210 | mText.append("<br>"); |
203 | mText += "</font>"; | 211 | mText += "</font>"; |
204 | } | 212 | } |
205 | 213 | ||
206 | if (!event->location().isEmpty()) { | 214 | |
207 | addTag("b",i18n("Location: ")); | ||
208 | mText.append(deTag(event->location())+"<br>"); | ||
209 | } | ||
210 | |||
211 | if (event->recurrence()->doesRecur()) { | 215 | if (event->recurrence()->doesRecur()) { |
212 | 216 | ||
213 | QString recurText = event->recurrence()->recurrenceText(); | 217 | QString recurText = event->recurrence()->recurrenceText(); |
214 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 218 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
215 | } | 219 | } |
216 | 220 | ||
217 | if (event->hasStartDate()) { | 221 | if (event->hasStartDate()) { |
218 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); | 222 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); |
219 | } | 223 | } |
220 | 224 | ||
221 | 225 | ||
222 | if (event->hasDueDate()) { | 226 | if (event->hasDueDate()) { |
223 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 227 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
224 | } | 228 | } |
229 | |||
230 | if (!event->location().isEmpty()) { | ||
231 | addTag("b",i18n("Location: ")); | ||
232 | mText.append(deTag(event->location())+"<br>"); | ||
233 | } | ||
234 | |||
225 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 235 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
226 | .arg(QString::number(event->priority()))); | 236 | .arg(QString::number(event->priority()))); |
227 | 237 | ||
228 | if (event->isAlarmEnabled()) { | 238 | if (event->isAlarmEnabled()) { |
229 | Alarm *alarm =event->alarms().first() ; | 239 | Alarm *alarm =event->alarms().first() ; |
230 | QDateTime t = alarm->time(); | 240 | QDateTime t = alarm->time(); |
231 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 241 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
232 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 242 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
233 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 243 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
234 | //addTag("p",s); | 244 | //addTag("p",s); |
235 | } | 245 | } |
236 | 246 | ||
237 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 247 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
238 | formatCategories(event); | 248 | formatCategories(event); |
239 | if ( mDetails ) { | 249 | |
240 | if (!event->description().isEmpty()) { | ||
241 | addTag("p",i18n("<b>Details: </b>")); | ||
242 | addTag("p",deTag(event->description())); | ||
243 | } | ||
244 | } | ||
245 | formatReadOnly(event); | 250 | formatReadOnly(event); |
246 | formatAttendees(event); | 251 | formatAttendees(event); |
247 | if ( mCreated ) { | 252 | if ( mCreated ) { |
253 | #ifdef DESKTOP_VERSION | ||
254 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
255 | #else | ||
248 | addTag("p",i18n("<b>Created: ") +" </b>"); | 256 | addTag("p",i18n("<b>Created: ") +" </b>"); |
249 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 257 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
258 | #endif | ||
250 | 259 | ||
251 | } | 260 | } |
252 | if ( mModified ) { | 261 | if ( mModified ) { |
262 | #ifdef DESKTOP_VERSION | ||
263 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
264 | #else | ||
253 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 265 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
254 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 266 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
267 | #endif | ||
255 | 268 | ||
256 | } | 269 | } |
270 | if ( mDetails ) { | ||
271 | if (!event->description().isEmpty()) { | ||
272 | addTag("p",i18n("<b>Details: </b>")); | ||
273 | addTag("p",deTag(event->description())); | ||
274 | } | ||
275 | } | ||
257 | } | 276 | } |
258 | 277 | ||
259 | void KIncidenceFormatter::setJournal(Journal* ) | 278 | void KIncidenceFormatter::setJournal(Journal* ) |
260 | { | 279 | { |
261 | 280 | ||
262 | } | 281 | } |
263 | 282 | ||
264 | void KIncidenceFormatter::formatCategories(Incidence *event) | 283 | void KIncidenceFormatter::formatCategories(Incidence *event) |
265 | { | 284 | { |
266 | if (!event->categoriesStr().isEmpty()) { | 285 | if (!event->categoriesStr().isEmpty()) { |
267 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); | 286 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); |
268 | //mText.append(event->categoriesStr()); | 287 | //mText.append(event->categoriesStr()); |
269 | } | 288 | } |
270 | } | 289 | } |
271 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 290 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
272 | { | 291 | { |
273 | int number=text.contains("\n"); | 292 | int number=text.contains("\n"); |
274 | QString str = "<" + tag + ">"; | 293 | QString str = "<" + tag + ">"; |
275 | QString tmpText=text; | 294 | QString tmpText=text; |
276 | QString tmpStr=str; | 295 | QString tmpStr=str; |
277 | if(number !=-1) | 296 | if(number !=-1) |
278 | { | 297 | { |
279 | if (number > 0) { | 298 | if (number > 0) { |
280 | int pos=0; | 299 | int pos=0; |
281 | QString tmp; | 300 | QString tmp; |
282 | for(int i=0;i<=number;i++) { | 301 | for(int i=0;i<=number;i++) { |
283 | pos=tmpText.find("\n"); | 302 | pos=tmpText.find("\n"); |
284 | tmp=tmpText.left(pos); | 303 | tmp=tmpText.left(pos); |
285 | tmpText=tmpText.right(tmpText.length()-pos-1); | 304 | tmpText=tmpText.right(tmpText.length()-pos-1); |
286 | tmpStr+=tmp+"<br>"; | 305 | tmpStr+=tmp+"<br>"; |
287 | } | 306 | } |
288 | } | 307 | } |
289 | else tmpStr += tmpText; | 308 | else tmpStr += tmpText; |
290 | tmpStr+="</" + tag + ">"; | 309 | tmpStr+="</" + tag + ">"; |
291 | mText.append(tmpStr); | 310 | mText.append(tmpStr); |
292 | } | 311 | } |
293 | else | 312 | else |
294 | { | 313 | { |
295 | str += text + "</" + tag + ">"; | 314 | str += text + "</" + tag + ">"; |
296 | mText.append(str); | 315 | mText.append(str); |
297 | } | 316 | } |
298 | } | 317 | } |
299 | 318 | ||
300 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 319 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
301 | { | 320 | { |
302 | QPtrList<Attendee> attendees = event->attendees(); | 321 | QPtrList<Attendee> attendees = event->attendees(); |
303 | if (attendees.count()) { | 322 | if (attendees.count()) { |
304 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 323 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
305 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 324 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
306 | addTag("h3",i18n("Organizer")); | 325 | addTag("h3",i18n("Organizer")); |
307 | mText.append("<ul><li>"); | 326 | mText.append("<ul><li>"); |
308 | #if 0 | 327 | #if 0 |
309 | //ndef KORG_NOKABC | 328 | //ndef KORG_NOKABC |
310 | 329 | ||
311 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 330 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
312 | KABC::Addressee::List addressList; | 331 | KABC::Addressee::List addressList; |
313 | addressList = add_book->findByEmail(event->organizer()); | 332 | addressList = add_book->findByEmail(event->organizer()); |
314 | KABC::Addressee o = addressList.first(); | 333 | KABC::Addressee o = addressList.first(); |
315 | if (!o.isEmpty() && addressList.size()<2) { | 334 | if (!o.isEmpty() && addressList.size()<2) { |
316 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 335 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
317 | mText += o.formattedName(); | 336 | mText += o.formattedName(); |
318 | mText += "</a>\n"; | 337 | mText += "</a>\n"; |
319 | } else { | 338 | } else { |
320 | mText.append(event->organizer()); | 339 | mText.append(event->organizer()); |
321 | } | 340 | } |
322 | #else | 341 | #else |
323 | mText.append(event->organizer()); | 342 | mText.append(event->organizer()); |
324 | #endif | 343 | #endif |
325 | if (iconPath) { | 344 | if (iconPath) { |
326 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 345 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
327 | mText += "<IMG src=\"" + iconPath + "\">"; | 346 | mText += "<IMG src=\"" + iconPath + "\">"; |
328 | mText += "</a>\n"; | 347 | mText += "</a>\n"; |
329 | } | 348 | } |
330 | mText.append("</li></ul>"); | 349 | mText.append("</li></ul>"); |
331 | 350 | ||
332 | addTag("h3",i18n("Attendees")); | 351 | addTag("h3",i18n("Attendees")); |
333 | Attendee *a; | 352 | Attendee *a; |
334 | mText.append("<ul>"); | 353 | mText.append("<ul>"); |
335 | for(a=attendees.first();a;a=attendees.next()) { | 354 | for(a=attendees.first();a;a=attendees.next()) { |
336 | #if 0 | 355 | #if 0 |
337 | //ndef KORG_NOKABC | 356 | //ndef KORG_NOKABC |
338 | if (a->name().isEmpty()) { | 357 | if (a->name().isEmpty()) { |
339 | addressList = add_book->findByEmail(a->email()); | 358 | addressList = add_book->findByEmail(a->email()); |
340 | KABC::Addressee o = addressList.first(); | 359 | KABC::Addressee o = addressList.first(); |
341 | if (!o.isEmpty() && addressList.size()<2) { | 360 | if (!o.isEmpty() && addressList.size()<2) { |
342 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 361 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
343 | mText += o.formattedName(); | 362 | mText += o.formattedName(); |
344 | mText += "</a>\n"; | 363 | mText += "</a>\n"; |
345 | } else { | 364 | } else { |
346 | mText += "<li>"; | 365 | mText += "<li>"; |
347 | mText.append(a->email()); | 366 | mText.append(a->email()); |
348 | mText += "\n"; | 367 | mText += "\n"; |
349 | } | 368 | } |
350 | } else { | 369 | } else { |
351 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 370 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
352 | if (!a->name().isEmpty()) mText += a->name(); | 371 | if (!a->name().isEmpty()) mText += a->name(); |