author | zautrix <zautrix> | 2005-02-13 19:07:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-13 19:07:45 (UTC) |
commit | 7bd83e913399b8be68a7d37e8f02118ec9eab90e (patch) (unidiff) | |
tree | 284d1592687ea4d3e0c220fafd289a702718dee4 /korganizer/koeventviewer.cpp | |
parent | 293271fe9e6a9061da329183f8f488d79580f7da (diff) | |
download | kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.zip kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.gz kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.bz2 |
todo fixi
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 39921a0..f6c9624 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -149,512 +149,519 @@ void KOEventViewer::setSource(const QString& n) | |||
149 | //emit showIncidence(n); | 149 | //emit showIncidence(n); |
150 | return; | 150 | return; |
151 | } else if (n.startsWith("uid:")) { | 151 | } else if (n.startsWith("uid:")) { |
152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
153 | const QByteArray noParamData; | 153 | const QByteArray noParamData; |
154 | const QByteArray paramData; | 154 | const QByteArray paramData; |
155 | QByteArray replyData; | 155 | QByteArray replyData; |
156 | QCString replyTypeStr; | 156 | QCString replyTypeStr; |
157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
158 | bool foundAbbrowser = PING_ABBROWSER; | 158 | bool foundAbbrowser = PING_ABBROWSER; |
159 | 159 | ||
160 | if (foundAbbrowser) { | 160 | if (foundAbbrowser) { |
161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
162 | //client->send("kaddressbook","KAddressBookIface", | 162 | //client->send("kaddressbook","KAddressBookIface", |
163 | QDataStream arg(paramData, IO_WriteOnly); | 163 | QDataStream arg(paramData, IO_WriteOnly); |
164 | arg << n.mid(6); | 164 | arg << n.mid(6); |
165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
166 | return; | 166 | return; |
167 | } else { | 167 | } else { |
168 | /* | 168 | /* |
169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
170 | We start it without its main interface | 170 | We start it without its main interface |
171 | */ | 171 | */ |
172 | KIconLoader* iconLoader = new KIconLoader(); | 172 | KIconLoader* iconLoader = new KIconLoader(); |
173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
174 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
175 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
176 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | 185 | void KOEventViewer::mailToAttendees( bool all ) |
186 | { | 186 | { |
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
188 | if (attendees.count() == 0) return; | 188 | if (attendees.count() == 0) return; |
189 | QStringList nameList; | 189 | QStringList nameList; |
190 | QStringList emailList; | 190 | QStringList emailList; |
191 | QStringList uidList; | 191 | QStringList uidList; |
192 | Attendee* a; | 192 | Attendee* a; |
193 | for(a=attendees.first();a;a=attendees.next()) { | 193 | for(a=attendees.first();a;a=attendees.next()) { |
194 | if ( !all && !a->RSVP() ) continue; | 194 | if ( !all && !a->RSVP() ) continue; |
195 | if (!a->email().isEmpty()) { | 195 | if (!a->email().isEmpty()) { |
196 | nameList.append (a->name() ); | 196 | nameList.append (a->name() ); |
197 | emailList.append (a->email() ); | 197 | emailList.append (a->email() ); |
198 | uidList.append (a->uid() ); | 198 | uidList.append (a->uid() ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 201 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
202 | #ifndef DESKTOP_VERSION | 202 | #ifndef DESKTOP_VERSION |
203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | } | 206 | } |
207 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 207 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
208 | { | 208 | { |
209 | int number=text.contains("\n"); | 209 | int number=text.contains("\n"); |
210 | QString str = "<" + tag + ">"; | 210 | QString str = "<" + tag + ">"; |
211 | QString tmpText=text; | 211 | QString tmpText=text; |
212 | QString tmpStr=str; | 212 | QString tmpStr=str; |
213 | if(number !=-1) | 213 | if(number !=-1) |
214 | { | 214 | { |
215 | if (number > 0) { | 215 | if (number > 0) { |
216 | int pos=0; | 216 | int pos=0; |
217 | QString tmp; | 217 | QString tmp; |
218 | for(int i=0;i<=number;i++) { | 218 | for(int i=0;i<=number;i++) { |
219 | pos=tmpText.find("\n"); | 219 | pos=tmpText.find("\n"); |
220 | tmp=tmpText.left(pos); | 220 | tmp=tmpText.left(pos); |
221 | tmpText=tmpText.right(tmpText.length()-pos-1); | 221 | tmpText=tmpText.right(tmpText.length()-pos-1); |
222 | tmpStr+=tmp+"<br>"; | 222 | tmpStr+=tmp+"<br>"; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | else tmpStr += tmpText; | 225 | else tmpStr += tmpText; |
226 | tmpStr+="</" + tag + ">"; | 226 | tmpStr+="</" + tag + ">"; |
227 | mText.append(tmpStr); | 227 | mText.append(tmpStr); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | { | 230 | { |
231 | str += text + "</" + tag + ">"; | 231 | str += text + "</" + tag + ">"; |
232 | mText.append(str); | 232 | mText.append(str); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | void KOEventViewer::setColorMode( int m ) | 236 | void KOEventViewer::setColorMode( int m ) |
237 | { | 237 | { |
238 | mColorMode = m; | 238 | mColorMode = m; |
239 | } | 239 | } |
240 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
241 | { | 241 | { |
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
245 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
246 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
247 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
248 | } | 248 | } |
249 | else { | 249 | else { |
250 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
255 | } | 255 | } |
256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
257 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
258 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
259 | } else { | 259 | } else { |
260 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
261 | } | 261 | } |
262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
263 | if ( mColorMode ) | 263 | if ( mColorMode ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
273 | } | 273 | } |
274 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
275 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
276 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool ok; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDateTime next; | 308 | QDateTime next; |
309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
314 | 314 | ||
315 | } else { | 315 | } else { |
316 | bool last; | 316 | bool last; |
317 | QDate nextd; | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
319 | if ( last ) { | 319 | if ( last ) { |
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
326 | 326 | ||
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
331 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
332 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
333 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
334 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
337 | //addTag("p",s); | 337 | //addTag("p",s); |
338 | } | 338 | } |
339 | 339 | ||
340 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
341 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
342 | if (!event->description().isEmpty()) { | 342 | if (!event->description().isEmpty()) { |
343 | addTag("p",i18n("<b>Details: </b>")); | 343 | addTag("p",i18n("<b>Details: </b>")); |
344 | addTag("p",event->description()); | 344 | addTag("p",event->description()); |
345 | } | 345 | } |
346 | 346 | ||
347 | formatCategories(event); | 347 | formatCategories(event); |
348 | 348 | ||
349 | formatReadOnly(event); | 349 | formatReadOnly(event); |
350 | formatAttendees(event); | 350 | formatAttendees(event); |
351 | 351 | ||
352 | setText(mText); | 352 | setText(mText); |
353 | //QWhatsThis::add(this,mText); | 353 | //QWhatsThis::add(this,mText); |
354 | 354 | ||
355 | } | 355 | } |
356 | 356 | ||
357 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 357 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
358 | { | 358 | { |
359 | mMailSubject = ""; | 359 | mMailSubject = ""; |
360 | mCurrentIncidence = event; | 360 | mCurrentIncidence = event; |
361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
363 | if (mode == 0 ) | 363 | if (mode == 0 ) |
364 | addTag("h2",event->summary()); | 364 | addTag("h2",event->summary()); |
365 | else { | 365 | else { |
366 | if ( mColorMode == 1 ) { | 366 | if ( mColorMode == 1 ) { |
367 | mText +="<font color=\"#00A000\">"; | 367 | mText +="<font color=\"#00A000\">"; |
368 | } | 368 | } |
369 | if ( mColorMode == 2 ) { | 369 | if ( mColorMode == 2 ) { |
370 | mText +="<font color=\"#B00000\">"; | 370 | mText +="<font color=\"#B00000\">"; |
371 | } | 371 | } |
372 | if ( mode == 1 ) { | 372 | if ( mode == 1 ) { |
373 | addTag("h2",i18n( "Local: " ) +event->summary()); | 373 | addTag("h2",i18n( "Local: " ) +event->summary()); |
374 | } else { | 374 | } else { |
375 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 375 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
376 | } | 376 | } |
377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
378 | if ( mColorMode ) | 378 | if ( mColorMode ) |
379 | mText += "</font>"; | 379 | mText += "</font>"; |
380 | } | 380 | } |
381 | mMailSubject += i18n( "Todo " )+ event->summary(); | 381 | mMailSubject += i18n( "Todo " )+ event->summary(); |
382 | 382 | ||
383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
384 | mText +="<font color=\"#B00000\">"; | 384 | mText +="<font color=\"#B00000\">"; |
385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
386 | mText += "</font>"; | 386 | mText += "</font>"; |
387 | } else { | 387 | } else { |
388 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 388 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
389 | .arg(event->percentComplete())); | 389 | .arg(event->percentComplete())); |
390 | } | 390 | } |
391 | 391 | ||
392 | if (event->cancelled ()) { | 392 | if (event->cancelled ()) { |
393 | mText +="<font color=\"#B00000\">"; | 393 | mText +="<font color=\"#B00000\">"; |
394 | addTag("i",i18n("This todo has been cancelled!")); | 394 | addTag("i",i18n("This todo has been cancelled!")); |
395 | mText.append("<br>"); | 395 | mText.append("<br>"); |
396 | mText += "</font>"; | 396 | mText += "</font>"; |
397 | mMailSubject += i18n("(cancelled)"); | 397 | mMailSubject += i18n("(cancelled)"); |
398 | } | 398 | } |
399 | 399 | ||
400 | if (!event->location().isEmpty()) { | 400 | if (!event->location().isEmpty()) { |
401 | addTag("b",i18n("Location: ")); | 401 | addTag("b",i18n("Location: ")); |
402 | mText.append(event->location()+"<br>"); | 402 | mText.append(event->location()+"<br>"); |
403 | mMailSubject += i18n(" at ") + event->location(); | 403 | mMailSubject += i18n(" at ") + event->location(); |
404 | } | 404 | } |
405 | |||
406 | if (event->recurrence()->doesRecur()) { | ||
407 | |||
408 | QString recurText = event->recurrence()->recurrenceText(); | ||
409 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | ||
410 | |||
411 | } | ||
405 | if (event->hasStartDate()) { | 412 | if (event->hasStartDate()) { |
406 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 413 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
407 | } | 414 | } |
408 | if (event->hasDueDate()) { | 415 | if (event->hasDueDate()) { |
409 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 416 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
410 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 417 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
411 | } | 418 | } |
412 | addTag("b",i18n("Access: ")); | 419 | addTag("b",i18n("Access: ")); |
413 | mText.append(event->secrecyStr()+"<br>"); | 420 | mText.append(event->secrecyStr()+"<br>"); |
414 | if (!event->description().isEmpty()) { | 421 | if (!event->description().isEmpty()) { |
415 | addTag("p",i18n("<b>Details: </b>")); | 422 | addTag("p",i18n("<b>Details: </b>")); |
416 | addTag("p",event->description()); | 423 | addTag("p",event->description()); |
417 | } | 424 | } |
418 | 425 | ||
419 | formatCategories(event); | 426 | formatCategories(event); |
420 | 427 | ||
421 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 428 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
422 | .arg(QString::number(event->priority()))); | 429 | .arg(QString::number(event->priority()))); |
423 | 430 | ||
424 | formatReadOnly(event); | 431 | formatReadOnly(event); |
425 | formatAttendees(event); | 432 | formatAttendees(event); |
426 | if ( event->relatedTo() ) { | 433 | if ( event->relatedTo() ) { |
427 | addTag("b",i18n("Parent todo:<br>")); | 434 | addTag("b",i18n("Parent todo:<br>")); |
428 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 435 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
429 | } | 436 | } |
430 | QPtrList<Incidence> Relations = event->relations(); | 437 | QPtrList<Incidence> Relations = event->relations(); |
431 | Incidence *to; | 438 | Incidence *to; |
432 | if ( Relations.first() ) | 439 | if ( Relations.first() ) |
433 | addTag("b",i18n("Sub todos:<br>")); | 440 | addTag("b",i18n("Sub todos:<br>")); |
434 | for (to=Relations.first();to;to=Relations.next()) { | 441 | for (to=Relations.first();to;to=Relations.next()) { |
435 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 442 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
436 | 443 | ||
437 | } | 444 | } |
438 | setText(mText); | 445 | setText(mText); |
439 | } | 446 | } |
440 | 447 | ||
441 | void KOEventViewer::formatCategories(Incidence *event) | 448 | void KOEventViewer::formatCategories(Incidence *event) |
442 | { | 449 | { |
443 | if (!event->categoriesStr().isEmpty()) { | 450 | if (!event->categoriesStr().isEmpty()) { |
444 | if (event->categories().count() == 1) { | 451 | if (event->categories().count() == 1) { |
445 | addTag("h3",i18n("Category")); | 452 | addTag("h3",i18n("Category")); |
446 | } else { | 453 | } else { |
447 | addTag("h3",i18n("Categories")); | 454 | addTag("h3",i18n("Categories")); |
448 | } | 455 | } |
449 | addTag("p",event->categoriesStr()); | 456 | addTag("p",event->categoriesStr()); |
450 | } | 457 | } |
451 | } | 458 | } |
452 | void KOEventViewer::formatAttendees(Incidence *event) | 459 | void KOEventViewer::formatAttendees(Incidence *event) |
453 | { | 460 | { |
454 | QPtrList<Attendee> attendees = event->attendees(); | 461 | QPtrList<Attendee> attendees = event->attendees(); |
455 | if (attendees.count()) { | 462 | if (attendees.count()) { |
456 | 463 | ||
457 | 464 | ||
458 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 465 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
459 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 466 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
460 | addTag("h3",i18n("Organizer")); | 467 | addTag("h3",i18n("Organizer")); |
461 | mText.append("<ul><li>"); | 468 | mText.append("<ul><li>"); |
462 | #ifndef KORG_NOKABC | 469 | #ifndef KORG_NOKABC |
463 | 470 | ||
464 | #ifdef DESKTOP_VERSION | 471 | #ifdef DESKTOP_VERSION |
465 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 472 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
466 | KABC::Addressee::List addressList; | 473 | KABC::Addressee::List addressList; |
467 | addressList = add_book->findByEmail(event->organizer()); | 474 | addressList = add_book->findByEmail(event->organizer()); |
468 | KABC::Addressee o = addressList.first(); | 475 | KABC::Addressee o = addressList.first(); |
469 | if (!o.isEmpty() && addressList.size()<2) { | 476 | if (!o.isEmpty() && addressList.size()<2) { |
470 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 477 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
471 | mText += o.formattedName(); | 478 | mText += o.formattedName(); |
472 | mText += "</a>\n"; | 479 | mText += "</a>\n"; |
473 | } else { | 480 | } else { |
474 | mText.append(event->organizer()); | 481 | mText.append(event->organizer()); |
475 | } | 482 | } |
476 | #else //DESKTOP_VERSION | 483 | #else //DESKTOP_VERSION |
477 | mText += "<a href=\"uid:organizer\">"; | 484 | mText += "<a href=\"uid:organizer\">"; |
478 | mText += event->organizer(); | 485 | mText += event->organizer(); |
479 | mText += "</a>\n"; | 486 | mText += "</a>\n"; |
480 | #endif //DESKTOP_VERSION | 487 | #endif //DESKTOP_VERSION |
481 | 488 | ||
482 | 489 | ||
483 | #else | 490 | #else |
484 | mText.append(event->organizer()); | 491 | mText.append(event->organizer()); |
485 | #endif | 492 | #endif |
486 | 493 | ||
487 | if (iconPath) { | 494 | if (iconPath) { |
488 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 495 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
489 | mText += "<IMG src=\"" + iconPath + "\">"; | 496 | mText += "<IMG src=\"" + iconPath + "\">"; |
490 | mText += "</a>\n"; | 497 | mText += "</a>\n"; |
491 | } | 498 | } |
492 | mText.append("</li></ul>"); | 499 | mText.append("</li></ul>"); |
493 | 500 | ||
494 | addTag("h3",i18n("Attendees")); | 501 | addTag("h3",i18n("Attendees")); |
495 | Attendee *a; | 502 | Attendee *a; |
496 | mText.append("<ul>"); | 503 | mText.append("<ul>"); |
497 | int a_count = 0; | 504 | int a_count = 0; |
498 | int a_count_nr = 0; | 505 | int a_count_nr = 0; |
499 | 506 | ||
500 | for(a=attendees.first();a;a=attendees.next()) { | 507 | for(a=attendees.first();a;a=attendees.next()) { |
501 | #ifndef KORG_NOKABC | 508 | #ifndef KORG_NOKABC |
502 | #ifdef DESKTOP_VERSION | 509 | #ifdef DESKTOP_VERSION |
503 | if (a->name().isEmpty()) { | 510 | if (a->name().isEmpty()) { |
504 | addressList = add_book->findByEmail(a->email()); | 511 | addressList = add_book->findByEmail(a->email()); |
505 | KABC::Addressee o = addressList.first(); | 512 | KABC::Addressee o = addressList.first(); |
506 | if (!o.isEmpty() && addressList.size()<2) { | 513 | if (!o.isEmpty() && addressList.size()<2) { |
507 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 514 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
508 | mText += o.formattedName(); | 515 | mText += o.formattedName(); |
509 | mText += "</a>\n"; | 516 | mText += "</a>\n"; |
510 | } else { | 517 | } else { |
511 | mText += "<li>"; | 518 | mText += "<li>"; |
512 | mText.append(a->email()); | 519 | mText.append(a->email()); |
513 | mText += "\n"; | 520 | mText += "\n"; |
514 | } | 521 | } |
515 | } else { | 522 | } else { |
516 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 523 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
517 | if (!a->name().isEmpty()) mText += a->name(); | 524 | if (!a->name().isEmpty()) mText += a->name(); |
518 | else mText += a->email(); | 525 | else mText += a->email(); |
519 | mText += "</a>\n"; | 526 | mText += "</a>\n"; |
520 | } | 527 | } |
521 | #else //DESKTOP_VERSION | 528 | #else //DESKTOP_VERSION |
522 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
523 | if (!a->name().isEmpty()) mText += a->name(); | 530 | if (!a->name().isEmpty()) mText += a->name(); |
524 | else mText += a->email(); | 531 | else mText += a->email(); |
525 | mText += "</a>\n"; | 532 | mText += "</a>\n"; |
526 | #endif //DESKTOP_VERSION | 533 | #endif //DESKTOP_VERSION |
527 | #else | 534 | #else |
528 | //qDebug("nokabc "); | 535 | //qDebug("nokabc "); |
529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 536 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
530 | if (!a->name().isEmpty()) mText += a->name(); | 537 | if (!a->name().isEmpty()) mText += a->name(); |
531 | else mText += a->email(); | 538 | else mText += a->email(); |
532 | mText += "</a>\n"; | 539 | mText += "</a>\n"; |
533 | #endif | 540 | #endif |
534 | 541 | ||
535 | 542 | ||
536 | if (!a->email().isEmpty()) { | 543 | if (!a->email().isEmpty()) { |
537 | if (iconPath) { | 544 | if (iconPath) { |
538 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 545 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
539 | if ( a->RSVP() ) { | 546 | if ( a->RSVP() ) { |
540 | ++a_count_nr; | 547 | ++a_count_nr; |
541 | mText += "<IMG src=\"" + iconPath + "\">"; | 548 | mText += "<IMG src=\"" + iconPath + "\">"; |
542 | } | 549 | } |
543 | else { | 550 | else { |
544 | ++a_count; | 551 | ++a_count; |
545 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 552 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
546 | } | 553 | } |
547 | mText += "</a>\n"; | 554 | mText += "</a>\n"; |
548 | } | 555 | } |
549 | } | 556 | } |
550 | if (a->status() != Attendee::NeedsAction ) | 557 | if (a->status() != Attendee::NeedsAction ) |
551 | mText +="[" + a->statusStr() + "] "; | 558 | mText +="[" + a->statusStr() + "] "; |
552 | if (a->role() == Attendee::Chair ) | 559 | if (a->role() == Attendee::Chair ) |
553 | mText +="(" + a->roleStr().left(1) + ".)"; | 560 | mText +="(" + a->roleStr().left(1) + ".)"; |
554 | } | 561 | } |
555 | mText.append("</li></ul>"); | 562 | mText.append("</li></ul>"); |
556 | if ( (a_count+a_count_nr) > 1 ) { | 563 | if ( (a_count+a_count_nr) > 1 ) { |
557 | mText += "<a href=\"mailto:ALL\">"; | 564 | mText += "<a href=\"mailto:ALL\">"; |
558 | mText += i18n( "Mail to all" ); | 565 | mText += i18n( "Mail to all" ); |
559 | mText += "</a> ( "; | 566 | mText += "</a> ( "; |
560 | mText += "<IMG src=\"" + iconPath + "\">"; | 567 | mText += "<IMG src=\"" + iconPath + "\">"; |
561 | mText += i18n( " and " ); | 568 | mText += i18n( " and " ); |
562 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 569 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
563 | mText += "<br>\n"; | 570 | mText += "<br>\n"; |
564 | 571 | ||
565 | 572 | ||
566 | } | 573 | } |
567 | if ( a_count_nr > 1 ) { | 574 | if ( a_count_nr > 1 ) { |
568 | mText += "<a href=\"mailto:RSVP\">"; | 575 | mText += "<a href=\"mailto:RSVP\">"; |
569 | mText += i18n( "Mail to selected" ); | 576 | mText += i18n( "Mail to selected" ); |
570 | mText += "</a> ( "; | 577 | mText += "</a> ( "; |
571 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 578 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
572 | mText += "<br>\n"; | 579 | mText += "<br>\n"; |
573 | } | 580 | } |
574 | } | 581 | } |
575 | 582 | ||
576 | } | 583 | } |
577 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 584 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
578 | { | 585 | { |
579 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 586 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
580 | if (mode == 0 ) { | 587 | if (mode == 0 ) { |
581 | addTag("h2",i18n("Journal from: ")); | 588 | addTag("h2",i18n("Journal from: ")); |
582 | } | 589 | } |
583 | else { | 590 | else { |
584 | if ( mode == 1 ) { | 591 | if ( mode == 1 ) { |
585 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 592 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
586 | } else { | 593 | } else { |
587 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 594 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
588 | } | 595 | } |
589 | } | 596 | } |
590 | topLevelWidget()->setCaption("Journal Viewer"); | 597 | topLevelWidget()->setCaption("Journal Viewer"); |
591 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 598 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
592 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 599 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
593 | if (!jour->description().isEmpty()) { | 600 | if (!jour->description().isEmpty()) { |
594 | addTag("p",jour->description()); | 601 | addTag("p",jour->description()); |
595 | } | 602 | } |
596 | setText(mText); | 603 | setText(mText); |
597 | } | 604 | } |
598 | 605 | ||
599 | void KOEventViewer::formatReadOnly(Incidence *event) | 606 | void KOEventViewer::formatReadOnly(Incidence *event) |
600 | { | 607 | { |
601 | if (event->isReadOnly()) { | 608 | if (event->isReadOnly()) { |
602 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 609 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
603 | } | 610 | } |
604 | } | 611 | } |
605 | void KOEventViewer::setSyncMode( bool b ) | 612 | void KOEventViewer::setSyncMode( bool b ) |
606 | { | 613 | { |
607 | mSyncMode = b; | 614 | mSyncMode = b; |
608 | } | 615 | } |
609 | 616 | ||
610 | 617 | ||
611 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 618 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
612 | { | 619 | { |
613 | if ( clearV ) | 620 | if ( clearV ) |
614 | clearEvents(); | 621 | clearEvents(); |
615 | if ( mSyncMode ) { | 622 | if ( mSyncMode ) { |
616 | if ( clearV ) | 623 | if ( clearV ) |
617 | appendTodo(event,1 ); | 624 | appendTodo(event,1 ); |
618 | else | 625 | else |
619 | appendTodo(event,2); | 626 | appendTodo(event,2); |
620 | } else | 627 | } else |
621 | appendTodo(event); | 628 | appendTodo(event); |
622 | } | 629 | } |
623 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 630 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
624 | { | 631 | { |
625 | if ( clearV ) | 632 | if ( clearV ) |
626 | clearEvents(); | 633 | clearEvents(); |
627 | if ( mSyncMode ) { | 634 | if ( mSyncMode ) { |
628 | if ( clearV ) | 635 | if ( clearV ) |
629 | appendJournal(event, 1); | 636 | appendJournal(event, 1); |
630 | else | 637 | else |
631 | appendJournal(event, 2); | 638 | appendJournal(event, 2); |
632 | } else | 639 | } else |
633 | appendJournal(event); | 640 | appendJournal(event); |
634 | } | 641 | } |
635 | 642 | ||
636 | void KOEventViewer::setEvent(Event *event) | 643 | void KOEventViewer::setEvent(Event *event) |
637 | { | 644 | { |
638 | clearEvents(); | 645 | clearEvents(); |
639 | if ( mSyncMode ) | 646 | if ( mSyncMode ) |
640 | appendEvent(event, 1); | 647 | appendEvent(event, 1); |
641 | else | 648 | else |
642 | appendEvent(event); | 649 | appendEvent(event); |
643 | } | 650 | } |
644 | 651 | ||
645 | void KOEventViewer::addEvent(Event *event) | 652 | void KOEventViewer::addEvent(Event *event) |
646 | { | 653 | { |
647 | if ( mSyncMode ) | 654 | if ( mSyncMode ) |
648 | appendEvent(event, 2); | 655 | appendEvent(event, 2); |
649 | else | 656 | else |
650 | appendEvent(event); | 657 | appendEvent(event); |
651 | } | 658 | } |
652 | 659 | ||
653 | void KOEventViewer::clearEvents(bool now) | 660 | void KOEventViewer::clearEvents(bool now) |
654 | { | 661 | { |
655 | mText = ""; | 662 | mText = ""; |
656 | if (now) setText(mText); | 663 | if (now) setText(mText); |
657 | } | 664 | } |
658 | 665 | ||
659 | void KOEventViewer::addText(QString text) | 666 | void KOEventViewer::addText(QString text) |
660 | { | 667 | { |