summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-15 16:20:26 (UTC)
committer zautrix <zautrix>2005-06-15 16:20:26 (UTC)
commitcba0ac17d3d505805be6aa4b4fea6f63473a1e00 (patch) (unidiff)
treeb7eceb0b3181cbb2c14b753692f135bc0cd5dd0e
parent2a788f41ebeb7d8edab7010fb1a00799cb9e036d (diff)
downloadkdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.zip
kdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.tar.gz
kdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.tar.bz2
fixi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp9
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--libkcal/kincidenceformatter.cpp9
3 files changed, 12 insertions, 10 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index c8c2f28..6315827 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -157,478 +157,481 @@ void KOEventViewer::setSource(const QString& n)
157 } 157 }
158 return; 158 return;
159 } 159 }
160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
161 // the result should now arrive through method insertAttendees 161 // the result should now arrive through method insertAttendees
162 //QString uid = "uid:"+(*it).uid(); 162 //QString uid = "uid:"+(*it).uid();
163#endif 163#endif
164 if ( n.left(6) == "mailto" ) { 164 if ( n.left(6) == "mailto" ) {
165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 if ( n.mid(7,3) == "ALL" ) { 167 if ( n.mid(7,3) == "ALL" ) {
168 mailToAttendees( true ); 168 mailToAttendees( true );
169 } else if ( n.mid(7,4) == "RSVP" ) { 169 } else if ( n.mid(7,4) == "RSVP" ) {
170 mailToAttendees( false ); 170 mailToAttendees( false );
171 } else { 171 } else {
172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
173 e << n.mid(7); 173 e << n.mid(7);
174 } 174 }
175#endif 175#endif
176 176
177 } 177 }
178 178
179 179
180#ifndef KORG_NODCOP 180#ifndef KORG_NODCOP
181 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 181 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
182 QString tmpStr; 182 QString tmpStr;
183 if (n.startsWith("mailto:")) { 183 if (n.startsWith("mailto:")) {
184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
185 //emit showIncidence(n); 185 //emit showIncidence(n);
186 return; 186 return;
187 } else if (n.startsWith("uid:")) { 187 } else if (n.startsWith("uid:")) {
188 DCOPClient *client = KApplication::kApplication()->dcopClient(); 188 DCOPClient *client = KApplication::kApplication()->dcopClient();
189 const QByteArray noParamData; 189 const QByteArray noParamData;
190 const QByteArray paramData; 190 const QByteArray paramData;
191 QByteArray replyData; 191 QByteArray replyData;
192 QCString replyTypeStr; 192 QCString replyTypeStr;
193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
194 bool foundAbbrowser = PING_ABBROWSER; 194 bool foundAbbrowser = PING_ABBROWSER;
195 195
196 if (foundAbbrowser) { 196 if (foundAbbrowser) {
197 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 197 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
198 //client->send("kaddressbook","KAddressBookIface", 198 //client->send("kaddressbook","KAddressBookIface",
199 QDataStream arg(paramData, IO_WriteOnly); 199 QDataStream arg(paramData, IO_WriteOnly);
200 arg << n.mid(6); 200 arg << n.mid(6);
201 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 201 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
202 return; 202 return;
203 } else { 203 } else {
204 /* 204 /*
205 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 205 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
206 We start it without its main interface 206 We start it without its main interface
207 */ 207 */
208 KIconLoader* iconLoader = new KIconLoader(); 208 KIconLoader* iconLoader = new KIconLoader();
209 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 209 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
210 ActionManager::setStartedKAddressBook(true); 210 ActionManager::setStartedKAddressBook(true);
211 tmpStr = "kaddressbook --editor-only --uid "; 211 tmpStr = "kaddressbook --editor-only --uid ";
212 tmpStr += KProcess::quote(n.mid(6)); 212 tmpStr += KProcess::quote(n.mid(6));
213 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 213 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
214 return; 214 return;
215 } 215 }
216 } else { 216 } else {
217 //QTextBrowser::setSource(n); 217 //QTextBrowser::setSource(n);
218 } 218 }
219#endif 219#endif
220} 220}
221void KOEventViewer::mailToAttendees( bool all ) 221void KOEventViewer::mailToAttendees( bool all )
222{ 222{
223 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 223 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
224 if (attendees.count() == 0) return; 224 if (attendees.count() == 0) return;
225 QStringList nameList; 225 QStringList nameList;
226 QStringList emailList; 226 QStringList emailList;
227 QStringList uidList; 227 QStringList uidList;
228 Attendee* a; 228 Attendee* a;
229 for(a=attendees.first();a;a=attendees.next()) { 229 for(a=attendees.first();a;a=attendees.next()) {
230 if ( !all && !a->RSVP() ) continue; 230 if ( !all && !a->RSVP() ) continue;
231 if (!a->email().isEmpty()) { 231 if (!a->email().isEmpty()) {
232 nameList.append (a->name() ); 232 nameList.append (a->name() );
233 emailList.append (a->email() ); 233 emailList.append (a->email() );
234 uidList.append (a->uid() ); 234 uidList.append (a->uid() );
235 } 235 }
236 } 236 }
237 QString uid = "ComposeMailUIpick2"+mMailSubject; 237 QString uid = "ComposeMailUIpick2"+mMailSubject;
238#ifndef DESKTOP_VERSION 238#ifndef DESKTOP_VERSION
239 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 239 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
240#endif 240#endif
241 241
242} 242}
243void KOEventViewer::addTag(const QString & tag,const QString & text) 243void KOEventViewer::addTag(const QString & tag,const QString & text)
244{ 244{
245 int number=text.contains("\n"); 245 int number=text.contains("\n");
246 QString str = "<" + tag + ">"; 246 QString str = "<" + tag + ">";
247 QString tmpText=text; 247 QString tmpText=text;
248 QString tmpStr=str; 248 QString tmpStr=str;
249 if(number !=-1) 249 if(number !=-1)
250 { 250 {
251 if (number > 0) { 251 if (number > 0) {
252 int pos=0; 252 int pos=0;
253 QString tmp; 253 QString tmp;
254 for(int i=0;i<=number;i++) { 254 for(int i=0;i<=number;i++) {
255 pos=tmpText.find("\n"); 255 pos=tmpText.find("\n");
256 tmp=tmpText.left(pos); 256 tmp=tmpText.left(pos);
257 tmpText=tmpText.right(tmpText.length()-pos-1); 257 tmpText=tmpText.right(tmpText.length()-pos-1);
258 tmpStr+=tmp+"<br>"; 258 tmpStr+=tmp+"<br>";
259 } 259 }
260 } 260 }
261 else tmpStr += tmpText; 261 else tmpStr += tmpText;
262 tmpStr+="</" + tag + ">"; 262 tmpStr+="</" + tag + ">";
263 mText.append(tmpStr); 263 mText.append(tmpStr);
264 } 264 }
265 else 265 else
266 { 266 {
267 str += text + "</" + tag + ">"; 267 str += text + "</" + tag + ">";
268 mText.append(str); 268 mText.append(str);
269 } 269 }
270} 270}
271 271
272void KOEventViewer::setColorMode( int m ) 272void KOEventViewer::setColorMode( int m )
273{ 273{
274 mColorMode = m; 274 mColorMode = m;
275} 275}
276void KOEventViewer::appendEvent(Event *event, int mode ) 276void KOEventViewer::appendEvent(Event *event, int mode )
277{ 277{
278 mMailSubject = ""; 278 mMailSubject = "";
279 mCurrentIncidence = event; 279 mCurrentIncidence = event;
280 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 280 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
281 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 281 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
282 topLevelWidget()->setCaption(i18n("Event Viewer")); 282 topLevelWidget()->setCaption(i18n("Event Viewer"));
283 if ( mode == 0 ) { 283 if ( mode == 0 ) {
284 addTag("h2",deTag(event->summary())); 284 addTag("h2",deTag(event->summary()));
285 formatReadOnly(event);
285 } 286 }
286 else { 287 else {
287 if ( mColorMode == 1 ) { 288 if ( mColorMode == 1 ) {
288 mText +="<font color=\"#00A000\">"; 289 mText +="<font color=\"#00A000\">";
289 } 290 }
290 if ( mColorMode == 2 ) { 291 if ( mColorMode == 2 ) {
291 mText +="<font color=\"#C00000\">"; 292 mText +="<font color=\"#C00000\">";
292 } 293 }
293 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 294 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
294 if ( mode == 1 ) { 295 if ( mode == 1 ) {
295 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 296 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
296 } else { 297 } else {
297 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 298 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
298 } 299 }
300 formatReadOnly(event);
299 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 301 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
300 if ( mColorMode ) 302 if ( mColorMode )
301 mText += "</font>"; 303 mText += "</font>";
302 } 304 }
303 mMailSubject += i18n( "Meeting " )+ event->summary(); 305 mMailSubject += i18n( "Meeting " )+ event->summary();
304 if (event->cancelled ()) { 306 if (event->cancelled ()) {
305 mText +="<font color=\"#B00000\">"; 307 mText +="<font color=\"#B00000\">";
306 addTag("i",i18n("This event has been cancelled!")); 308 addTag("i",i18n("This event has been cancelled!"));
307 mText.append("<br>"); 309 mText.append("<br>");
308 mText += "</font>"; 310 mText += "</font>";
309 mMailSubject += i18n("(cancelled)"); 311 mMailSubject += i18n("(cancelled)");
310 } 312 }
311 313
312 if (event->doesFloat()) { 314 if (event->doesFloat()) {
313 if (event->isMultiDay()) { 315 if (event->isMultiDay()) {
314 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 316 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
315 .arg(event->dtStartDateStr(shortDate)) 317 .arg(event->dtStartDateStr(shortDate))
316 .arg(event->dtEndDateStr(shortDate))); 318 .arg(event->dtEndDateStr(shortDate)));
317 } else { 319 } else {
318 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 320 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
319 } 321 }
320 } else { 322 } else {
321 if (event->isMultiDay()) { 323 if (event->isMultiDay()) {
322 mText.append(i18n("<p><b>From:</b> %1</p> ") 324 mText.append(i18n("<p><b>From:</b> %1</p> ")
323 .arg(event->dtStartStr( shortDate))); 325 .arg(event->dtStartStr( shortDate)));
324 mText.append(i18n("<p><b>To:</b> %1</p>") 326 mText.append(i18n("<p><b>To:</b> %1</p>")
325 .arg(event->dtEndStr(shortDate))); 327 .arg(event->dtEndStr(shortDate)));
326 } else { 328 } else {
327 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 329 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
328 .arg(event->dtStartTimeStr()) 330 .arg(event->dtStartTimeStr())
329 .arg(event->dtEndTimeStr())); 331 .arg(event->dtEndTimeStr()));
330 mText.append(i18n("<p><b>On:</b> %1</p> ") 332 mText.append(i18n("<p><b>On:</b> %1</p> ")
331 .arg(event->dtStartDateStr( shortDate ))); 333 .arg(event->dtStartDateStr( shortDate )));
332 } 334 }
333 } 335 }
334 if (!event->location().isEmpty()) { 336 if (!event->location().isEmpty()) {
335 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 337 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
336 mMailSubject += i18n(" at ") + event->location(); 338 mMailSubject += i18n(" at ") + event->location();
337 } 339 }
338 if (event->recurrence()->doesRecur()) { 340 if (event->recurrence()->doesRecur()) {
339 341
340 QString recurText = event->recurrence()->recurrenceText(); 342 QString recurText = event->recurrence()->recurrenceText();
341 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 343 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
342 bool ok; 344 bool ok;
343 QDate start = QDate::currentDate(); 345 QDate start = QDate::currentDate();
344 QDateTime next; 346 QDateTime next;
345 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 347 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
346 if ( ok ) { 348 if ( ok ) {
347 if ( wideScreen ){ 349 if ( wideScreen ){
348 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 350 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
349 } else { 351 } else {
350 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 352 addTag("p",i18n("<b>Next recurrence is on:</b>") );
351 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 353 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
352 } 354 }
353 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 355 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
354 356
355 } else { 357 } else {
356 bool last; 358 bool last;
357 QDate nextd; 359 QDate nextd;
358 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 360 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
359 if ( last ) { 361 if ( last ) {
360 if ( wideScreen ){ 362 if ( wideScreen ){
361 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 363 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
362 } else{ 364 } else{
363 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 365 addTag("p",i18n("<b>Last recurrence was on:</b>") );
364 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 366 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
365 } 367 }
366 } 368 }
367 } 369 }
368 } else { 370 } else {
369 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 371 mMailSubject += i18n(" - " )+event->dtStartStr( true );
370 372
371 } 373 }
372 374
373 375
374 if (event->isAlarmEnabled()) { 376 if (event->isAlarmEnabled()) {
375 Alarm *alarm =event->alarms().first() ; 377 Alarm *alarm =event->alarms().first() ;
376 QDateTime t = alarm->time(); 378 QDateTime t = alarm->time();
377 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 379 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
378 if(wideScreen ){ 380 if(wideScreen ){
379 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
380 }else{ 382 }else{
381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 383 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
382 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 384 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
383 } 385 }
384 //addTag("p",s); 386 //addTag("p",s);
385 } 387 }
386 388
387 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 389 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
388 390
389 formatCategories(event); 391 formatCategories(event);
390 392
391 formatReadOnly(event);
392 formatAttendees(event); 393 formatAttendees(event);
393 394
394 if ( KOPrefs::instance()->mEVshowCreated ) { 395 if ( KOPrefs::instance()->mEVshowCreated ) {
395 if(wideScreen ){ 396 if(wideScreen ){
396 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 397 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
397 }else{ 398 }else{
398 addTag("p",i18n("<b>Created: ") +" </b>"); 399 addTag("p",i18n("<b>Created: ") +" </b>");
399 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 400 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
400 } 401 }
401 402
402 403
403 } 404 }
404 if ( KOPrefs::instance()->mEVshowChanged ) { 405 if ( KOPrefs::instance()->mEVshowChanged ) {
405 if(wideScreen ){ 406 if(wideScreen ){
406 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 407 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
407 }else{ 408 }else{
408 addTag("p",i18n("<b>Last modified: ") +" </b>"); 409 addTag("p",i18n("<b>Last modified: ") +" </b>");
409 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 410 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
410 } 411 }
411 412
412 } 413 }
413 if ( KOPrefs::instance()->mEVshowDetails ) { 414 if ( KOPrefs::instance()->mEVshowDetails ) {
414 if (!event->description().isEmpty()) { 415 if (!event->description().isEmpty()) {
415 addTag("p",i18n("<b>Details: </b>")); 416 addTag("p",i18n("<b>Details: </b>"));
416 addTag("p",deTag(event->description())); 417 addTag("p",deTag(event->description()));
417 } 418 }
418 } 419 }
419 setText(mText); 420 setText(mText);
420 //QWhatsThis::add(this,mText); 421 //QWhatsThis::add(this,mText);
421 422
422} 423}
423 424
424void KOEventViewer::appendTodo(Todo *event, int mode ) 425void KOEventViewer::appendTodo(Todo *event, int mode )
425{ 426{
426 mMailSubject = ""; 427 mMailSubject = "";
427 mCurrentIncidence = event; 428 mCurrentIncidence = event;
428 topLevelWidget()->setCaption(i18n("Todo Viewer")); 429 topLevelWidget()->setCaption(i18n("Todo Viewer"));
429 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 430 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
430 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 431 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
431 if (mode == 0 ) 432 if (mode == 0 ) {
432 addTag("h2",deTag(event->summary())); 433 addTag("h2",deTag(event->summary()));
434 formatReadOnly(event);
435 }
433 else { 436 else {
434 if ( mColorMode == 1 ) { 437 if ( mColorMode == 1 ) {
435 mText +="<font color=\"#00A000\">"; 438 mText +="<font color=\"#00A000\">";
436 } 439 }
437 if ( mColorMode == 2 ) { 440 if ( mColorMode == 2 ) {
438 mText +="<font color=\"#B00000\">"; 441 mText +="<font color=\"#B00000\">";
439 } 442 }
440 if ( mode == 1 ) { 443 if ( mode == 1 ) {
441 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 444 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
442 } else { 445 } else {
443 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 446 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
444 } 447 }
448 formatReadOnly(event);
445 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 449 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
446 if ( mColorMode ) 450 if ( mColorMode )
447 mText += "</font>"; 451 mText += "</font>";
448 } 452 }
449 mMailSubject += i18n( "Todo " )+ event->summary(); 453 mMailSubject += i18n( "Todo " )+ event->summary();
450 454
451 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 455 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
452 mText +="<font color=\"#B00000\">"; 456 mText +="<font color=\"#B00000\">";
453 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 457 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
454 mText += "</font>"; 458 mText += "</font>";
455 } else { 459 } else {
456 mText.append(i18n("<p><i>%1 % completed</i></p>") 460 mText.append(i18n("<p><i>%1 % completed</i></p>")
457 .arg(event->percentComplete())); 461 .arg(event->percentComplete()));
458 } 462 }
459 463
460 if (event->cancelled ()) { 464 if (event->cancelled ()) {
461 mText +="<font color=\"#B00000\">"; 465 mText +="<font color=\"#B00000\">";
462 addTag("i",i18n("This todo has been cancelled!")); 466 addTag("i",i18n("This todo has been cancelled!"));
463 mText.append("<br>"); 467 mText.append("<br>");
464 mText += "</font>"; 468 mText += "</font>";
465 mMailSubject += i18n("(cancelled)"); 469 mMailSubject += i18n("(cancelled)");
466 } 470 }
467 471
468 472
469 473
470 if (event->recurrence()->doesRecur()) { 474 if (event->recurrence()->doesRecur()) {
471 475
472 QString recurText = event->recurrence()->recurrenceText(); 476 QString recurText = event->recurrence()->recurrenceText();
473 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 477 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
474 478
475 } 479 }
476 if (event->hasStartDate()) { 480 if (event->hasStartDate()) {
477 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 481 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
478 } 482 }
479 if (event->hasDueDate()) { 483 if (event->hasDueDate()) {
480 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 484 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
481 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 485 mMailSubject += i18n(" - " )+event->dtDueStr( true );
482 } 486 }
483 if (!event->location().isEmpty()) { 487 if (!event->location().isEmpty()) {
484 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 488 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
485 mMailSubject += i18n(" at ") + event->location(); 489 mMailSubject += i18n(" at ") + event->location();
486 } 490 }
487 mText.append(i18n("<p><b>Priority:</b> %2</p>") 491 mText.append(i18n("<p><b>Priority:</b> %2</p>")
488 .arg(QString::number(event->priority()))); 492 .arg(QString::number(event->priority())));
489 493
490 if (event->isAlarmEnabled()) { 494 if (event->isAlarmEnabled()) {
491 Alarm *alarm =event->alarms().first() ; 495 Alarm *alarm =event->alarms().first() ;
492 QDateTime t = alarm->time(); 496 QDateTime t = alarm->time();
493 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 497 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
494 if ( wideScreen ) { 498 if ( wideScreen ) {
495 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 499 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
496 } else { 500 } else {
497 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 501 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
498 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 502 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
499 } 503 }
500 } 504 }
501 505
502 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 506 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
503 507
504 formatCategories(event); 508 formatCategories(event);
505 509
506 formatReadOnly(event);
507 formatAttendees(event); 510 formatAttendees(event);
508 511
509 if ( KOPrefs::instance()->mEVshowCreated ) { 512 if ( KOPrefs::instance()->mEVshowCreated ) {
510 if(wideScreen ){ 513 if(wideScreen ){
511 514
512 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 515 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
513 516
514 } else { 517 } else {
515 addTag("p",i18n("<b>Created: ") +" </b>"); 518 addTag("p",i18n("<b>Created: ") +" </b>");
516 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 519 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
517 } 520 }
518 } 521 }
519 if ( KOPrefs::instance()->mEVshowChanged ) { 522 if ( KOPrefs::instance()->mEVshowChanged ) {
520 if(wideScreen ){ 523 if(wideScreen ){
521 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 524 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
522 525
523 } else { 526 } else {
524 addTag("p",i18n("<b>Last modified: ") +" </b>"); 527 addTag("p",i18n("<b>Last modified: ") +" </b>");
525 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 528 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
526 } 529 }
527 } 530 }
528 if ( event->relatedTo() ) { 531 if ( event->relatedTo() ) {
529 addTag("b",i18n("Parent todo:<br>")); 532 addTag("b",i18n("Parent todo:<br>"));
530 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 533 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
531 } 534 }
532 QPtrList<Incidence> Relations = event->relations(); 535 QPtrList<Incidence> Relations = event->relations();
533 Incidence *to; 536 Incidence *to;
534 if ( Relations.first() ) 537 if ( Relations.first() )
535 addTag("b",i18n("Sub todos:<br>")); 538 addTag("b",i18n("Sub todos:<br>"));
536 for (to=Relations.first();to;to=Relations.next()) { 539 for (to=Relations.first();to;to=Relations.next()) {
537 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 540 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
538 541
539 } 542 }
540 543
541 if ( KOPrefs::instance()->mEVshowDetails ) { 544 if ( KOPrefs::instance()->mEVshowDetails ) {
542 if (!event->description().isEmpty()) { 545 if (!event->description().isEmpty()) {
543 addTag("p",i18n("<b>Details: </b>")); 546 addTag("p",i18n("<b>Details: </b>"));
544 addTag("p",deTag(event->description())); 547 addTag("p",deTag(event->description()));
545 } 548 }
546 } 549 }
547 setText(mText); 550 setText(mText);
548} 551}
549 552
550void KOEventViewer::formatCategories(Incidence *event) 553void KOEventViewer::formatCategories(Incidence *event)
551{ 554{
552 if (!event->categoriesStr().isEmpty()) { 555 if (!event->categoriesStr().isEmpty()) {
553 if (event->categories().count() == 1) { 556 if (event->categories().count() == 1) {
554 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 557 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
555 } else { 558 } else {
556 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 559 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
557 } 560 }
558 } 561 }
559} 562}
560void KOEventViewer::formatAttendees(Incidence *event) 563void KOEventViewer::formatAttendees(Incidence *event)
561{ 564{
562 QPtrList<Attendee> attendees = event->attendees(); 565 QPtrList<Attendee> attendees = event->attendees();
563 if (attendees.count()) { 566 if (attendees.count()) {
564 567
565 568
566 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 569 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
567 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 570 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
568 addTag("h3",i18n("Organizer")); 571 addTag("h3",i18n("Organizer"));
569 mText.append("<ul><li>"); 572 mText.append("<ul><li>");
570#ifndef KORG_NOKABC 573#ifndef KORG_NOKABC
571 574
572#ifdef DESKTOP_VERSION 575#ifdef DESKTOP_VERSION
573 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 576 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
574 KABC::Addressee::List addressList; 577 KABC::Addressee::List addressList;
575 addressList = add_book->findByEmail(event->organizer()); 578 addressList = add_book->findByEmail(event->organizer());
576 KABC::Addressee o = addressList.first(); 579 KABC::Addressee o = addressList.first();
577 if (!o.isEmpty() && addressList.size()<2) { 580 if (!o.isEmpty() && addressList.size()<2) {
578 mText += "<a href=\"uid:" + o.uid() + "\">"; 581 mText += "<a href=\"uid:" + o.uid() + "\">";
579 mText += o.formattedName(); 582 mText += o.formattedName();
580 mText += "</a>\n"; 583 mText += "</a>\n";
581 } else { 584 } else {
582 mText.append(event->organizer()); 585 mText.append(event->organizer());
583 } 586 }
584#else //DESKTOP_VERSION 587#else //DESKTOP_VERSION
585 mText += "<a href=\"uid:organizer\">"; 588 mText += "<a href=\"uid:organizer\">";
586 mText += event->organizer(); 589 mText += event->organizer();
587 mText += "</a>\n"; 590 mText += "</a>\n";
588#endif //DESKTOP_VERSION 591#endif //DESKTOP_VERSION
589 592
590 593
591#else 594#else
592 mText.append(event->organizer()); 595 mText.append(event->organizer());
593#endif 596#endif
594 597
595 if (iconPath) { 598 if (iconPath) {
596 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 599 mText += " <a href=\"mailto:" + event->organizer() + "\">";
597 mText += "<IMG src=\"" + iconPath + "\">"; 600 mText += "<IMG src=\"" + iconPath + "\">";
598 mText += "</a>\n"; 601 mText += "</a>\n";
599 } 602 }
600 mText.append("</li></ul>"); 603 mText.append("</li></ul>");
601 604
602 addTag("h3",i18n("Attendees")); 605 addTag("h3",i18n("Attendees"));
603 Attendee *a; 606 Attendee *a;
604 mText.append("<ul>"); 607 mText.append("<ul>");
605 int a_count = 0; 608 int a_count = 0;
606 int a_count_nr = 0; 609 int a_count_nr = 0;
607 610
608 for(a=attendees.first();a;a=attendees.next()) { 611 for(a=attendees.first();a;a=attendees.next()) {
609#ifndef KORG_NOKABC 612#ifndef KORG_NOKABC
610#ifdef DESKTOP_VERSION 613#ifdef DESKTOP_VERSION
611 if (a->name().isEmpty()) { 614 if (a->name().isEmpty()) {
612 addressList = add_book->findByEmail(a->email()); 615 addressList = add_book->findByEmail(a->email());
613 KABC::Addressee o = addressList.first(); 616 KABC::Addressee o = addressList.first();
614 if (!o.isEmpty() && addressList.size()<2) { 617 if (!o.isEmpty() && addressList.size()<2) {
615 mText += "<a href=\"uid:" + o.uid() + "\">"; 618 mText += "<a href=\"uid:" + o.uid() + "\">";
616 mText += o.formattedName(); 619 mText += o.formattedName();
617 mText += "</a>\n"; 620 mText += "</a>\n";
618 } else { 621 } else {
619 mText += "<li>"; 622 mText += "<li>";
620 mText.append(a->email()); 623 mText.append(a->email());
621 mText += "\n"; 624 mText += "\n";
622 } 625 }
623 } else { 626 } else {
624 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 627 mText += "<li><a href=\"uid:" + a->uid() + "\">";
625 if (!a->name().isEmpty()) mText += a->name(); 628 if (!a->name().isEmpty()) mText += a->name();
626 else mText += a->email(); 629 else mText += a->email();
627 mText += "</a>\n"; 630 mText += "</a>\n";
628 } 631 }
629#else //DESKTOP_VERSION 632#else //DESKTOP_VERSION
630 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 633 mText += "<li><a href=\"uid:" + a->uid() + "\">";
631 if (!a->name().isEmpty()) mText += a->name(); 634 if (!a->name().isEmpty()) mText += a->name();
632 else mText += a->email(); 635 else mText += a->email();
633 mText += "</a>\n"; 636 mText += "</a>\n";
634#endif //DESKTOP_VERSION 637#endif //DESKTOP_VERSION
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 475bb4a..cba85fa 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -190,319 +190,315 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
190 setTopItem(currentItem()-numItemsVisible()+1); 190 setTopItem(currentItem()-numItemsVisible()+1);
191 } else { 191 } else {
192 setTopItem(topItem()-1); 192 setTopItem(topItem()-1);
193 } 193 }
194 } 194 }
195 } 195 }
196 } 196 }
197 break; 197 break;
198 case Key_Down: 198 case Key_Down:
199 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 199 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
200 e->ignore(); 200 e->ignore();
201 break; 201 break;
202 } 202 }
203 if ( count () ) { 203 if ( count () ) {
204 if ( currentItem()+1 == count () ) { 204 if ( currentItem()+1 == count () ) {
205 emit nextCell(); 205 emit nextCell();
206 } else { 206 } else {
207 setCurrentItem((currentItem()+1)%count()); 207 setCurrentItem((currentItem()+1)%count());
208 if(!itemVisible(currentItem())) { 208 if(!itemVisible(currentItem())) {
209 if(currentItem() == 0) { 209 if(currentItem() == 0) {
210 setTopItem(0); 210 setTopItem(0);
211 } else { 211 } else {
212 setTopItem(topItem()+1); 212 setTopItem(topItem()+1);
213 } 213 }
214 } 214 }
215 } 215 }
216 } 216 }
217 break; 217 break;
218 case Key_I: 218 case Key_I:
219 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 219 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
220 e->ignore(); 220 e->ignore();
221 break; 221 break;
222 case Key_Return: 222 case Key_Return:
223 case Key_Enter: 223 case Key_Enter:
224 { 224 {
225 if ( currentItem() >= 0 ) { 225 if ( currentItem() >= 0 ) {
226 emit doubleClicked( item( currentItem() ) ); 226 emit doubleClicked( item( currentItem() ) );
227 e->accept(); 227 e->accept();
228 } else { 228 } else {
229 e->ignore(); 229 e->ignore();
230 } 230 }
231 } 231 }
232 break; 232 break;
233 case Key_Shift: 233 case Key_Shift:
234 emit shiftDown(); 234 emit shiftDown();
235 break; 235 break;
236 default: 236 default:
237 e->ignore(); 237 e->ignore();
238 break; 238 break;
239 } 239 }
240} 240}
241 241
242void KNoScrollListBox::oneDown() 242void KNoScrollListBox::oneDown()
243{ 243{
244 if ( count () ) { 244 if ( count () ) {
245 if ( currentItem()+1 == count () ) { 245 if ( currentItem()+1 == count () ) {
246 emit nextCell(); 246 emit nextCell();
247 } else { 247 } else {
248 resetOnFocusIn = false; 248 resetOnFocusIn = false;
249 setCurrentItem((currentItem()+1)%count()); 249 setCurrentItem((currentItem()+1)%count());
250 if(!itemVisible(currentItem())) { 250 if(!itemVisible(currentItem())) {
251 if(currentItem() == 0) { 251 if(currentItem() == 0) {
252 setTopItem(0); 252 setTopItem(0);
253 } else { 253 } else {
254 setTopItem(topItem()+1); 254 setTopItem(topItem()+1);
255 } 255 }
256 } 256 }
257 } 257 }
258 } 258 }
259} 259}
260void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 260void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
261{ 261{
262 switch(e->key()) { 262 switch(e->key()) {
263 case Key_Shift: 263 case Key_Shift:
264 emit shiftUp(); 264 emit shiftUp();
265 break; 265 break;
266 default: 266 default:
267 break; 267 break;
268 } 268 }
269} 269}
270 270
271void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 271void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
272{ 272{
273 QListBox::mousePressEvent(e); 273 QListBox::mousePressEvent(e);
274 274
275 if(e->button() == RightButton) { 275 if(e->button() == RightButton) {
276 emit rightClick(); 276 emit rightClick();
277 } 277 }
278} 278}
279 279
280MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 280MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
281 : QListBoxItem() 281 : QListBoxItem()
282{ 282{
283 mblockRepaint = true; 283 mblockRepaint = true;
284 setText( s ); 284 setText( s );
285 mMultiday = 0; 285 mMultiday = 0;
286 mIncidence = incidence; 286 mIncidence = incidence;
287 mDate = qd; 287 mDate = qd;
288 mRecur = false; 288 mRecur = false;
289 mAlarm = false; 289 mAlarm = false;
290 mReply = false; 290 mReply = false;
291 mInfo = false; 291 mInfo = false;
292 mdayPos = 0; 292 mdayPos = 0;
293 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 293 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
294} 294}
295void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 295void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
296{ 296{
297 setText( s ); 297 setText( s );
298 mMultiday = 0; 298 mMultiday = 0;
299 mIncidence = incidence; 299 mIncidence = incidence;
300 mDate = qd; 300 mDate = qd;
301 mRecur = false; 301 mRecur = false;
302 mAlarm = false; 302 mAlarm = false;
303 mReply = false; 303 mReply = false;
304 mInfo = false; 304 mInfo = false;
305 mdayPos = 0; 305 mdayPos = 0;
306} 306}
307 307
308void MonthViewItem::paint(QPainter *p) 308void MonthViewItem::paint(QPainter *p)
309{ 309{
310 if ( mblockRepaint ) { 310 if ( mblockRepaint ) {
311 return; 311 return;
312 } 312 }
313#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 314 bool sel = isSelected();
315#else 315#else
316 bool sel = selected(); 316 bool sel = selected();
317#endif 317#endif
318
319
320 int heihei = height( listBox () ); 318 int heihei = height( listBox () );
321 int x = 1; 319 int x = 1;
322 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
323 { 321 {
324 p->setBackgroundColor( palette().color( QPalette::Normal, \ 322 p->setBackgroundColor( palette().color( QPalette::Normal, \
325 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 323 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
326 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); 324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei );
327 } 325 }
328 326
329 //int y = 3;//(height() - mRecurPixmap.height()) /2; 327 //int y = 3;//(height() - mRecurPixmap.height()) /2;
330 int size = PIXMAP_SIZE; 328 int size = PIXMAP_SIZE;
331 if ( QApplication::desktop()->width() < 300 ) 329 if ( QApplication::desktop()->width() < 300 )
332 size = 3; 330 size = 3;
333 int y = (heihei - size -1 ) /2; 331 int y = (heihei - size -1 ) /2;
334 332
335 if ( mIncidence->calID() > 1 ) { 333 if ( mIncidence->calID() > 1 ) {
336 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); 334 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
337 p->drawRect ( x, y-2,size,size+4); 335 p->drawRect ( x, y-2,size,size+4);
338 x += size + 1; 336 x += size + 1;
339 } 337 }
340
341 if ( KOPrefs::instance()->mMonthShowIcons ) { 338 if ( KOPrefs::instance()->mMonthShowIcons ) {
342 if ( mInfo ) { 339 if ( mInfo ) {
343 p->fillRect ( x, y,size,size, Qt::darkGreen ); 340 p->fillRect ( x, y,size,size, Qt::darkGreen );
344 x += size + 1; 341 x += size + 1;
345 } 342 }
346 if ( mRecur ) { 343 if ( mRecur ) {
347 p->fillRect ( x, y,size,size, Qt::blue ); 344 p->fillRect ( x, y,size,size, Qt::blue );
348 x += size + 1; 345 x += size + 1;
349 } 346 }
350 if ( mAlarm ) { 347 if ( mAlarm ) {
351 p->fillRect ( x, y,size,size, Qt::red ); 348 p->fillRect ( x, y,size,size, Qt::red );
352 x += size + 1; 349 x += size + 1;
353 } 350 }
354 if ( mReply ) { 351 if ( mReply ) {
355 p->fillRect ( x, y,size,size, Qt::yellow ); 352 p->fillRect ( x, y,size,size, Qt::yellow );
356 x += size + 1; 353 x += size + 1;
357 } 354 }
358 } 355 }
359 if ( mMultiday ) { 356 if ( mMultiday ) {
360 int yyy = y+(size/2); 357 int yyy = y+(size/2);
361 int sizeM = size+2; 358 int sizeM = size+2;
362 p->setBrush( QBrush::SolidPattern ); 359 p->setBrush( QBrush::SolidPattern );
363 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 360 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
364 if ( mMultiday == 2 || mMultiday == 3 ) { 361 if ( mMultiday == 2 || mMultiday == 3 ) {
365 QPointArray pa ( 3 ); 362 QPointArray pa ( 3 );
366 pa.setPoint (0, x, yyy ); 363 pa.setPoint (0, x, yyy );
367 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 364 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 365 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 366 p->drawPolygon( pa );
370 } 367 }
371 if ( mMultiday == 2 || mMultiday == 1 ) { 368 if ( mMultiday == 2 || mMultiday == 1 ) {
372 QPointArray pa ( 3 ); 369 QPointArray pa ( 3 );
373 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 370 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
374 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 371 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
375 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 372 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
376 p->drawPolygon( pa ); 373 p->drawPolygon( pa );
377 } 374 }
378 if ( mMultiday == 1 ) { 375 if ( mMultiday == 1 ) {
379 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 376 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
380
381 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 377 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
382 } 378 }
383 if ( mMultiday == 3 ) { 379 if ( mMultiday == 3 ) {
384 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 380 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
385 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 381 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
386 382
387 } 383 }
388 x += sizeM/2 + 1; 384 x += sizeM/2 + 1;
389 x += sizeM + 1; 385 x += sizeM + 1;
390 } 386 }
391 387
392 if ( mIncidence->typeID() == todoID ){ 388 if ( mIncidence->typeID() == todoID ){
393 Todo* td = ( Todo* ) mIncidence; 389 Todo* td = ( Todo* ) mIncidence;
394 if ( td->isCompleted() ) { 390 if ( td->isCompleted() ) {
395 int half = size/2; 391 int half = size/2;
396 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 392 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
397 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 393 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
398 x += half+half + 4; 394 x += half+half + 4;
399 395
400 } else { 396 } else {
401 int val = td->percentComplete()/20; 397 int val = td->percentComplete()/20;
402 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 398 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
403 p->drawRect ( x, y-2,7,size+4); 399 p->drawRect ( x, y-2,7,size+4);
404 x += size + 3; 400 x += size + 3;
405 } 401 }
406 } 402 }
407 QFontMetrics fm = p->fontMetrics(); 403 QFontMetrics fm = p->fontMetrics();
408 int yPos; 404 int yPos;
409 int pmheight = size; 405 int pmheight = size;
410 if( pmheight < fm.height() ) 406 if( pmheight < fm.height() )
411 yPos = fm.ascent() + fm.leading()/2; 407 yPos = fm.ascent() + fm.leading()/2;
412 else 408 else
413 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 409 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
414 p->setPen( palette().color( QPalette::Normal, sel ? \ 410 p->setPen( palette().color( QPalette::Normal, sel ? \
415 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 411 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
416 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { 412 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
417 p->drawText( x, yPos, text() ); 413 p->drawText( x, yPos, text() );
418 if ( mIncidence->cancelled() ) { 414 if ( mIncidence->cancelled() ) {
419 int wid = fm.width( text() ); 415 int wid = fm.width( text() );
420 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 416 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
421 } 417 }
422 } else { 418 } else {
423 QString pText = text(); 419 QString pText = text();
424 if( pText.mid(2,1) == ":" ) 420 if( pText.mid(2,1) == ":" )
425 pText = pText.mid( 6 ); 421 pText = pText.mid( 6 );
426 p->drawText( x, yPos, pText ); 422 p->drawText( x, yPos, pText );
427 if ( mIncidence->cancelled() ) { 423 if ( mIncidence->cancelled() ) {
428 int wid = fm.width( pText ); 424 int wid = fm.width( pText );
429 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 425 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
430 } 426 }
431 } 427 }
432} 428}
433 429
434int MonthViewItem::height(const QListBox *lb) const 430int MonthViewItem::height(const QListBox *lb) const
435{ 431{
436 int ret = 10; 432 int ret = 10;
437 if ( lb ) 433 if ( lb )
438 ret = lb->fontMetrics().lineSpacing()+1; 434 ret = lb->fontMetrics().lineSpacing()+1;
439 return ret; 435 return ret;
440} 436}
441 437
442int MonthViewItem::width(const QListBox *lb) const 438int MonthViewItem::width(const QListBox *lb) const
443{ 439{
444 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 440 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
445 int size = PIXMAP_SIZE; 441 int size = PIXMAP_SIZE;
446 if ( QApplication::desktop()->width() < 300 ) 442 if ( QApplication::desktop()->width() < 300 )
447 size = 3; 443 size = 3;
448 int x = 1; 444 int x = 1;
449 if ( KOPrefs::instance()->mMonthShowIcons ) { 445 if ( KOPrefs::instance()->mMonthShowIcons ) {
450 if ( mInfo ) { 446 if ( mInfo ) {
451 x += size + 1; 447 x += size + 1;
452 } 448 }
453 if( mRecur ) { 449 if( mRecur ) {
454 x += size+1; 450 x += size+1;
455 } 451 }
456 if( mAlarm ) { 452 if( mAlarm ) {
457 x += size+1; 453 x += size+1;
458 } 454 }
459 if( mReply ) { 455 if( mReply ) {
460 x += size+1; 456 x += size+1;
461 } 457 }
462 } 458 }
463 if( mMultiday ) { 459 if( mMultiday ) {
464 x += size+1+2+size/2; 460 x += size+1+2+size/2;
465 } 461 }
466 return( x + lb->fontMetrics().width( text() ) + 1 ); 462 return( x + lb->fontMetrics().width( text() ) + 1 );
467 } 463 }
468 if ( ! lb ) 464 if ( ! lb )
469 return 10; 465 return 10;
470 return lb->width(); 466 return lb->width();
471} 467}
472 468
473 469
474MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 470MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
475 : KNoScrollListBox( par ), 471 : KNoScrollListBox( par ),
476 mMonthView( parent ) 472 mMonthView( parent )
477{ 473{
478 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 474 //QVBoxLayout *topLayout = new QVBoxLayout( this );
479 currentPalette = 0; 475 currentPalette = 0;
480 // mLabel = new QLabel( this );QPushButton 476 // mLabel = new QLabel( this );QPushButton
481 mLabel = new QPushButton( this ); 477 mLabel = new QPushButton( this );
482 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 478 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
483 //mLabel->setLineWidth( 1 ); 479 //mLabel->setLineWidth( 1 );
484 //mLabel->setAlignment( AlignCenter ); 480 //mLabel->setAlignment( AlignCenter );
485 mLabel->setFlat( true ); 481 mLabel->setFlat( true );
486 mLabel->setFocusPolicy(NoFocus); 482 mLabel->setFocusPolicy(NoFocus);
487 //mItemList = new KNoScrollListBox( this ); 483 //mItemList = new KNoScrollListBox( this );
488 setMinimumSize( 10, 10 ); 484 setMinimumSize( 10, 10 );
489 setFrameStyle( QFrame::Panel | QFrame::Plain ); 485 setFrameStyle( QFrame::Panel | QFrame::Plain );
490 setLineWidth( 1 ); 486 setLineWidth( 1 );
491 //topLayout->addWidget( mItemList ); 487 //topLayout->addWidget( mItemList );
492 mLabel->raise(); 488 mLabel->raise();
493 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 489 // QColor( 0,0,255 ) QColor( 160,1600,255 )
494 mStandardPalette = palette(); 490 mStandardPalette = palette();
495 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 491 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
496 492
497 enableScrollBars( false ); 493 enableScrollBars( false );
498 updateConfig(); 494 updateConfig();
499 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 495 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
500 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 496 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
501 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 497 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
502 SLOT( defaultAction( QListBoxItem * ) ) ); 498 SLOT( defaultAction( QListBoxItem * ) ) );
503 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 499 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
504 const QPoint &) ), 500 const QPoint &) ),
505 SLOT( contextMenu( QListBoxItem * ) ) ); 501 SLOT( contextMenu( QListBoxItem * ) ) );
506 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 502 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
507 SLOT( selection( QListBoxItem * ) ) ); 503 SLOT( selection( QListBoxItem * ) ) );
508 504
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index d1ace4f..9359fad 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,378 +1,381 @@
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
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 11static KStaticDeleter<KIncidenceFormatter> insd;
12 12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) 13QString 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
31KIncidenceFormatter* KIncidenceFormatter::instance() 31KIncidenceFormatter* 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}
38KIncidenceFormatter::~KIncidenceFormatter() 38KIncidenceFormatter::~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}
44KIncidenceFormatter::KIncidenceFormatter() 44KIncidenceFormatter::KIncidenceFormatter()
45{ 45{
46 mColorMode = 0; 46 mColorMode = 0;
47} 47}
48void KIncidenceFormatter::setEvent(Event *event) 48void 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 } 56 }
56 else { 57 else {
57 if ( mColorMode == 1 ) { 58 if ( mColorMode == 1 ) {
58 mText +="<font color=\"#00A000\">"; 59 mText +="<font color=\"#00A000\">";
59 } 60 }
60 if ( mColorMode == 2 ) { 61 if ( mColorMode == 2 ) {
61 mText +="<font color=\"#C00000\">"; 62 mText +="<font color=\"#C00000\">";
62 } 63 }
63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 64 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
64 if ( mode == 1 ) { 65 if ( mode == 1 ) {
65 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 66 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
66 } else { 67 } else {
67 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 68 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
68 } 69 }
70 formatReadOnly(event);
69 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 ) );
70 if ( mColorMode ) 72 if ( mColorMode )
71 mText += "</font>"; 73 mText += "</font>";
72 } 74 }
73 if (event->cancelled ()) { 75 if (event->cancelled ()) {
74 mText +="<font color=\"#B00000\">"; 76 mText +="<font color=\"#B00000\">";
75 addTag("i",i18n("This event has been cancelled!")); 77 addTag("i",i18n("This event has been cancelled!"));
76 mText.append("<br>"); 78 mText.append("<br>");
77 mText += "</font>"; 79 mText += "</font>";
78 } 80 }
79 if (event->doesFloat()) { 81 if (event->doesFloat()) {
80 if (event->isMultiDay()) { 82 if (event->isMultiDay()) {
81 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>")
82 .arg(event->dtStartDateStr(shortDate)) 84 .arg(event->dtStartDateStr(shortDate))
83 .arg(event->dtEndDateStr(shortDate))); 85 .arg(event->dtEndDateStr(shortDate)));
84 } else { 86 } else {
85 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 )));
86 } 88 }
87 } else { 89 } else {
88 if (event->isMultiDay()) { 90 if (event->isMultiDay()) {
89 mText.append(i18n("<p><b>From:</b> %1</p> ") 91 mText.append(i18n("<p><b>From:</b> %1</p> ")
90 .arg(event->dtStartStr( shortDate))); 92 .arg(event->dtStartStr( shortDate)));
91 mText.append(i18n("<p><b>To:</b> %1</p>") 93 mText.append(i18n("<p><b>To:</b> %1</p>")
92 .arg(event->dtEndStr(shortDate))); 94 .arg(event->dtEndStr(shortDate)));
93 } else { 95 } else {
94 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>")
95 .arg(event->dtStartTimeStr()) 97 .arg(event->dtStartTimeStr())
96 .arg(event->dtEndTimeStr())); 98 .arg(event->dtEndTimeStr()));
97 mText.append(i18n("<p><b>On:</b> %1</p> ") 99 mText.append(i18n("<p><b>On:</b> %1</p> ")
98 .arg(event->dtStartDateStr( shortDate ))); 100 .arg(event->dtStartDateStr( shortDate )));
99 } 101 }
100 } 102 }
101 if (!event->location().isEmpty()) { 103 if (!event->location().isEmpty()) {
102 addTag("b",i18n("Location: ")); 104 addTag("b",i18n("Location: "));
103 mText.append(deTag(event->location())+"<br>"); 105 mText.append(deTag(event->location())+"<br>");
104 } 106 }
105 107
106 if (event->recurrence()->doesRecur()) { 108 if (event->recurrence()->doesRecur()) {
107 109
108 QString recurText = event->recurrence()->recurrenceText(); 110 QString recurText = event->recurrence()->recurrenceText();
109 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>");
110 112
111 bool ok; 113 bool ok;
112 QDate start = QDate::currentDate(); 114 QDate start = QDate::currentDate();
113 QDateTime next; 115 QDateTime next;
114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 116 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
115 if ( ok ) { 117 if ( ok ) {
116 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 118 addTag("p",i18n("<b>Next recurrence is on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 119 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
118 120
119 } else { 121 } else {
120 bool last; 122 bool last;
121 QDate nextd; 123 QDate nextd;
122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 124 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
123 if ( last ) { 125 if ( last ) {
124 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 126 addTag("p",i18n("<b>Last recurrence was on:</b>") );
125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 127 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
126 } 128 }
127 } 129 }
128 } 130 }
129 131
130 132
131 if (event->isAlarmEnabled()) { 133 if (event->isAlarmEnabled()) {
132 Alarm *alarm =event->alarms().first() ; 134 Alarm *alarm =event->alarms().first() ;
133 QDateTime t = alarm->time(); 135 QDateTime t = alarm->time();
134 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 136 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 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 ));
136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 138 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
137 //addTag("p",s); 139 //addTag("p",s);
138 } 140 }
139 141
140 142
141 143
142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 144 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
143 // mText.append(event->secrecyStr()+"<br>"); 145 // mText.append(event->secrecyStr()+"<br>");
144 formatCategories(event); 146 formatCategories(event);
145 147
146 formatReadOnly(event);
147 formatAttendees(event); 148 formatAttendees(event);
148 149
149 if ( mCreated ) { 150 if ( mCreated ) {
150#ifdef DESKTOP_VERSION 151#ifdef DESKTOP_VERSION
151 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 ));
152#else 153#else
153 addTag("p",i18n("<b>Created: ") +" </b>"); 154 addTag("p",i18n("<b>Created: ") +" </b>");
154 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 155 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#endif 156#endif
156 157
157 } 158 }
158 if ( mModified ) { 159 if ( mModified ) {
159#ifdef DESKTOP_VERSION 160#ifdef DESKTOP_VERSION
160 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 ));
161#else 162#else
162 addTag("p",i18n("<b>Last modified: ") +" </b>"); 163 addTag("p",i18n("<b>Last modified: ") +" </b>");
163 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 164 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
164#endif 165#endif
165 166
166 } 167 }
167 if ( mDetails ) { 168 if ( mDetails ) {
168 if (!event->description().isEmpty()) { 169 if (!event->description().isEmpty()) {
169 addTag("p",i18n("<b>Details: </b>")); 170 addTag("p",i18n("<b>Details: </b>"));
170 addTag("p",deTag(event->description())); 171 addTag("p",deTag(event->description()));
171 } 172 }
172 } 173 }
173 174
174} 175}
175 176
176void KIncidenceFormatter::setTodo(Todo *event ) 177void KIncidenceFormatter::setTodo(Todo *event )
177{ 178{
178 int mode = 0; 179 int mode = 0;
179 mCurrentIncidence = event; 180 mCurrentIncidence = event;
180 bool shortDate = true; 181 bool shortDate = true;
181 if (mode == 0 ) 182 if (mode == 0 ) {
182 addTag("h3",deTag(event->summary())); 183 addTag("h3",deTag(event->summary()));
184 formatReadOnly(event);
185 }
183 else { 186 else {
184 if ( mColorMode == 1 ) { 187 if ( mColorMode == 1 ) {
185 mText +="<font color=\"#00A000\">"; 188 mText +="<font color=\"#00A000\">";
186 } 189 }
187 if ( mColorMode == 2 ) { 190 if ( mColorMode == 2 ) {
188 mText +="<font color=\"#B00000\">"; 191 mText +="<font color=\"#B00000\">";
189 } 192 }
190 if ( mode == 1 ) { 193 if ( mode == 1 ) {
191 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 194 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
192 } else { 195 } else {
193 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 196 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
194 } 197 }
198 formatReadOnly(event);
195 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 ) );
196 if ( mColorMode ) 200 if ( mColorMode )
197 mText += "</font>"; 201 mText += "</font>";
198 } 202 }
199 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 203 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
200 mText +="<font color=\"#B00000\">"; 204 mText +="<font color=\"#B00000\">";
201 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) ) );
202 mText += "</font>"; 206 mText += "</font>";
203 } else { 207 } else {
204 mText.append(i18n("<p><i>%1 % completed</i></p>") 208 mText.append(i18n("<p><i>%1 % completed</i></p>")
205 .arg(event->percentComplete())); 209 .arg(event->percentComplete()));
206 } 210 }
207 if (event->cancelled ()) { 211 if (event->cancelled ()) {
208 mText +="<font color=\"#B00000\">"; 212 mText +="<font color=\"#B00000\">";
209 addTag("i",i18n("This todo has been cancelled!")); 213 addTag("i",i18n("This todo has been cancelled!"));
210 mText.append("<br>"); 214 mText.append("<br>");
211 mText += "</font>"; 215 mText += "</font>";
212 } 216 }
213 217
214 218
215 if (event->recurrence()->doesRecur()) { 219 if (event->recurrence()->doesRecur()) {
216 220
217 QString recurText = event->recurrence()->recurrenceText(); 221 QString recurText = event->recurrence()->recurrenceText();
218 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>");
219 } 223 }
220 224
221 if (event->hasStartDate()) { 225 if (event->hasStartDate()) {
222 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)));
223 } 227 }
224 228
225 229
226 if (event->hasDueDate()) { 230 if (event->hasDueDate()) {
227 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)));
228 } 232 }
229 233
230 if (!event->location().isEmpty()) { 234 if (!event->location().isEmpty()) {
231 addTag("b",i18n("Location: ")); 235 addTag("b",i18n("Location: "));
232 mText.append(deTag(event->location())+"<br>"); 236 mText.append(deTag(event->location())+"<br>");
233 } 237 }
234 238
235 mText.append(i18n("<p><b>Priority:</b> %2</p>") 239 mText.append(i18n("<p><b>Priority:</b> %2</p>")
236 .arg(QString::number(event->priority()))); 240 .arg(QString::number(event->priority())));
237 241
238 if (event->isAlarmEnabled()) { 242 if (event->isAlarmEnabled()) {
239 Alarm *alarm =event->alarms().first() ; 243 Alarm *alarm =event->alarms().first() ;
240 QDateTime t = alarm->time(); 244 QDateTime t = alarm->time();
241 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 245 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
242 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 246 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
243 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 247 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
244 //addTag("p",s); 248 //addTag("p",s);
245 } 249 }
246 250
247 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 251 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
248 formatCategories(event); 252 formatCategories(event);
249 253
250 formatReadOnly(event);
251 formatAttendees(event); 254 formatAttendees(event);
252 if ( mCreated ) { 255 if ( mCreated ) {
253#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
254 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 ));
255#else 258#else
256 addTag("p",i18n("<b>Created: ") +" </b>"); 259 addTag("p",i18n("<b>Created: ") +" </b>");
257 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 260 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
258#endif 261#endif
259 262
260 } 263 }
261 if ( mModified ) { 264 if ( mModified ) {
262#ifdef DESKTOP_VERSION 265#ifdef DESKTOP_VERSION
263 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 ));
264#else 267#else
265 addTag("p",i18n("<b>Last modified: ") +" </b>"); 268 addTag("p",i18n("<b>Last modified: ") +" </b>");
266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 269 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#endif 270#endif
268 271
269 } 272 }
270 if ( mDetails ) { 273 if ( mDetails ) {
271 if (!event->description().isEmpty()) { 274 if (!event->description().isEmpty()) {
272 addTag("p",i18n("<b>Details: </b>")); 275 addTag("p",i18n("<b>Details: </b>"));
273 addTag("p",deTag(event->description())); 276 addTag("p",deTag(event->description()));
274 } 277 }
275 } 278 }
276} 279}
277 280
278void KIncidenceFormatter::setJournal(Journal* ) 281void KIncidenceFormatter::setJournal(Journal* )
279{ 282{
280 283
281} 284}
282 285
283void KIncidenceFormatter::formatCategories(Incidence *event) 286void KIncidenceFormatter::formatCategories(Incidence *event)
284{ 287{
285 if (!event->categoriesStr().isEmpty()) { 288 if (!event->categoriesStr().isEmpty()) {
286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); 289 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
287 //mText.append(event->categoriesStr()); 290 //mText.append(event->categoriesStr());
288 } 291 }
289} 292}
290void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 293void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
291{ 294{
292 int number=text.contains("\n"); 295 int number=text.contains("\n");
293 QString str = "<" + tag + ">"; 296 QString str = "<" + tag + ">";
294 QString tmpText=text; 297 QString tmpText=text;
295 QString tmpStr=str; 298 QString tmpStr=str;
296 if(number !=-1) 299 if(number !=-1)
297 { 300 {
298 if (number > 0) { 301 if (number > 0) {
299 int pos=0; 302 int pos=0;
300 QString tmp; 303 QString tmp;
301 for(int i=0;i<=number;i++) { 304 for(int i=0;i<=number;i++) {
302 pos=tmpText.find("\n"); 305 pos=tmpText.find("\n");
303 tmp=tmpText.left(pos); 306 tmp=tmpText.left(pos);
304 tmpText=tmpText.right(tmpText.length()-pos-1); 307 tmpText=tmpText.right(tmpText.length()-pos-1);
305 tmpStr+=tmp+"<br>"; 308 tmpStr+=tmp+"<br>";
306 } 309 }
307 } 310 }
308 else tmpStr += tmpText; 311 else tmpStr += tmpText;
309 tmpStr+="</" + tag + ">"; 312 tmpStr+="</" + tag + ">";
310 mText.append(tmpStr); 313 mText.append(tmpStr);
311 } 314 }
312 else 315 else
313 { 316 {
314 str += text + "</" + tag + ">"; 317 str += text + "</" + tag + ">";
315 mText.append(str); 318 mText.append(str);
316 } 319 }
317} 320}
318 321
319void KIncidenceFormatter::formatAttendees(Incidence *event) 322void KIncidenceFormatter::formatAttendees(Incidence *event)
320{ 323{
321 QPtrList<Attendee> attendees = event->attendees(); 324 QPtrList<Attendee> attendees = event->attendees();
322 if (attendees.count()) { 325 if (attendees.count()) {
323 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 326 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
324 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 327 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
325 addTag("h3",i18n("Organizer")); 328 addTag("h3",i18n("Organizer"));
326 mText.append("<ul><li>"); 329 mText.append("<ul><li>");
327#if 0 330#if 0
328 //ndef KORG_NOKABC 331 //ndef KORG_NOKABC
329 332
330 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 333 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
331 KABC::Addressee::List addressList; 334 KABC::Addressee::List addressList;
332 addressList = add_book->findByEmail(event->organizer()); 335 addressList = add_book->findByEmail(event->organizer());
333 KABC::Addressee o = addressList.first(); 336 KABC::Addressee o = addressList.first();
334 if (!o.isEmpty() && addressList.size()<2) { 337 if (!o.isEmpty() && addressList.size()<2) {
335 mText += "<a href=\"uid:" + o.uid() + "\">"; 338 mText += "<a href=\"uid:" + o.uid() + "\">";
336 mText += o.formattedName(); 339 mText += o.formattedName();
337 mText += "</a>\n"; 340 mText += "</a>\n";
338 } else { 341 } else {
339 mText.append(event->organizer()); 342 mText.append(event->organizer());
340 } 343 }
341#else 344#else
342 mText.append(event->organizer()); 345 mText.append(event->organizer());
343#endif 346#endif
344 if (iconPath) { 347 if (iconPath) {
345 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 348 mText += " <a href=\"mailto:" + event->organizer() + "\">";
346 mText += "<IMG src=\"" + iconPath + "\">"; 349 mText += "<IMG src=\"" + iconPath + "\">";
347 mText += "</a>\n"; 350 mText += "</a>\n";
348 } 351 }
349 mText.append("</li></ul>"); 352 mText.append("</li></ul>");
350 353
351 addTag("h3",i18n("Attendees")); 354 addTag("h3",i18n("Attendees"));
352 Attendee *a; 355 Attendee *a;
353 mText.append("<ul>"); 356 mText.append("<ul>");
354 for(a=attendees.first();a;a=attendees.next()) { 357 for(a=attendees.first();a;a=attendees.next()) {
355#if 0 358#if 0
356//ndef KORG_NOKABC 359//ndef KORG_NOKABC
357 if (a->name().isEmpty()) { 360 if (a->name().isEmpty()) {
358 addressList = add_book->findByEmail(a->email()); 361 addressList = add_book->findByEmail(a->email());
359 KABC::Addressee o = addressList.first(); 362 KABC::Addressee o = addressList.first();
360 if (!o.isEmpty() && addressList.size()<2) { 363 if (!o.isEmpty() && addressList.size()<2) {
361 mText += "<a href=\"uid:" + o.uid() + "\">"; 364 mText += "<a href=\"uid:" + o.uid() + "\">";
362 mText += o.formattedName(); 365 mText += o.formattedName();
363 mText += "</a>\n"; 366 mText += "</a>\n";
364 } else { 367 } else {
365 mText += "<li>"; 368 mText += "<li>";
366 mText.append(a->email()); 369 mText.append(a->email());
367 mText += "\n"; 370 mText += "\n";
368 } 371 }
369 } else { 372 } else {
370 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 373 mText += "<li><a href=\"uid:" + a->uid() + "\">";
371 if (!a->name().isEmpty()) mText += a->name(); 374 if (!a->name().isEmpty()) mText += a->name();
372 else mText += a->email(); 375 else mText += a->email();
373 mText += "</a>\n"; 376 mText += "</a>\n";
374 } 377 }
375#else 378#else
376 //qDebug("nokabc "); 379 //qDebug("nokabc ");
377 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 380 mText += "<li><a href=\"uid:" + a->uid() + "\">";
378 if (!a->name().isEmpty()) mText += a->name(); 381 if (!a->name().isEmpty()) mText += a->name();