summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koimportoldialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
index c4d5f06..7aa6076 100644
--- a/korganizer/koimportoldialog.cpp
+++ b/korganizer/koimportoldialog.cpp
@@ -293,194 +293,194 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe
293 int i; 293 int i;
294 int bb = 2; 294 int bb = 2;
295 for( i = 1; i <= 6; ++i ) { 295 for( i = 1; i <= 6; ++i ) {
296 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 296 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
297 bb = 4 << (i-1); 297 bb = 4 << (i-1);
298 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 298 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
299 } 299 }
300 if ( 1 & weekDaysNum) 300 if ( 1 & weekDaysNum)
301 weekDays.setBit( 6 ); 301 weekDays.setBit( 6 );
302 // int pos = 1;// pending 302 // int pos = 1;// pending
303 303
304 Recurrence *r = event->recurrence(); 304 Recurrence *r = event->recurrence();
305 int rtype = recpat.GetRecurrenceType(); 305 int rtype = recpat.GetRecurrenceType();
306 //recurrence types are: 306 //recurrence types are:
307 /* 307 /*
308 olRecursDaily(0) 308 olRecursDaily(0)
309 olRecursWeekly(1) 309 olRecursWeekly(1)
310 olRecursMonthly(2) 310 olRecursMonthly(2)
311 olRecursMonthNth(3) 311 olRecursMonthNth(3)
312 olRecursYearly(5) 312 olRecursYearly(5)
313 olRecursYearNth(6) 313 olRecursYearNth(6)
314 */ 314 */
315 315
316 int duration = recpat.GetOccurrences(); 316 int duration = recpat.GetOccurrences();
317 if ( !hasEndDate ) 317 if ( !hasEndDate )
318 duration = -1; 318 duration = -1;
319 319
320 //LPDISPATCH RecurrencePattern::GetExceptions() 320 //LPDISPATCH RecurrencePattern::GetExceptions()
321 //long RecurrencePattern::GetMonthOfYear() 321 //long RecurrencePattern::GetMonthOfYear()
322 if ( rtype == 0 ) { 322 if ( rtype == 0 ) {
323 if ( hasEndDate ) r->setDaily( freq, endDate ); 323 if ( hasEndDate ) r->setDaily( freq, endDate );
324 else r->setDaily( freq, duration ); 324 else r->setDaily( freq, duration );
325 } else if ( rtype == 1 ) { 325 } else if ( rtype == 1 ) {
326 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); 326 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
327 else r->setWeekly( freq, weekDays, duration ); 327 else r->setWeekly( freq, weekDays, duration );
328 } else if ( rtype == 2 ) { 328 } else if ( rtype == 2 ) {
329 if ( hasEndDate ) 329 if ( hasEndDate )
330 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 330 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
331 else 331 else
332 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 332 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
333 //r->addMonthlyDay( startDate.day() ); 333 //r->addMonthlyDay( startDate.day() );
334 r->addMonthlyDay( recpat.GetDayOfMonth() ); 334 r->addMonthlyDay( recpat.GetDayOfMonth() );
335 } else if ( rtype == 3 ) { 335 } else if ( rtype == 3 ) {
336 if ( hasEndDate ) 336 if ( hasEndDate )
337 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 337 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
338 else 338 else
339 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 339 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
340 QBitArray days( 7 ); 340 QBitArray days( 7 );
341 days.fill( false ); 341 days.fill( false );
342 days.setBit( startDate.dayOfWeek() - 1 ); 342 days.setBit( startDate.dayOfWeek() - 1 );
343 int pos = (startDate.day()/7)+1; 343 int pos = (startDate.day()/7)+1;
344 r->addMonthlyPos( pos, days ); 344 r->addMonthlyPos( pos, days );
345 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1); 345 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
346 //KMessageBox::information(this,mes); 346 //KMessageBox::information(this,mes);
347 } else if ( rtype == 5 ) { 347 } else if ( rtype == 5 ) {
348 freq = 1; 348 freq = 1;
349 if ( hasEndDate ) 349 if ( hasEndDate )
350 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 350 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
351 else 351 else
352 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 352 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
353 r->addYearlyNum( startDate.month() ); 353 r->addYearlyNum( startDate.month() );
354 } else if ( true /*rtype == 6*/ ) { 354 } else if ( true /*rtype == 6*/ ) {
355 // KOganizer cannot handle this in the GUI 355 // KOganizer cannot handle this in the GUI
356 // we are mapping this to monthly - every 12. month 356 // we are mapping this to monthly - every 12. month
357 freq = 12; 357 freq = 12;
358 if ( hasEndDate ) 358 if ( hasEndDate )
359 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 359 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
360 else 360 else
361 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 361 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
362 QBitArray days( 7 ); 362 QBitArray days( 7 );
363 days.fill( false ); 363 days.fill( false );
364 days.setBit( startDate.dayOfWeek() - 1 ); 364 days.setBit( startDate.dayOfWeek() - 1 );
365 int pos = (startDate.day()/7)+1; 365 int pos = (startDate.day()/7)+1;
366 r->addMonthlyPos( pos, days ); 366 r->addMonthlyPos( pos, days );
367 } 367 }
368 // recurrence exceptions 368 // recurrence exceptions
369 LPDISPATCH dispItem = recpat.GetExceptions(); 369 LPDISPATCH dispItem = recpat.GetExceptions();
370 dispItem->AddRef(); 370 dispItem->AddRef();
371 Exceptions ex(dispItem); 371 Exceptions ex(dispItem);
372 _variant_t indx((long)0); 372 _variant_t indx((long)0);
373 LPDISPATCH itm; 373 LPDISPATCH itm;
374 for(i=1; i <= ex.GetCount(); ++i) { 374 for(i=1; i <= ex.GetCount(); ++i) {
375 indx = (long)i; 375 indx = (long)i;
376 itm = ex.Item( indx.Detach() ); 376 itm = ex.Item( indx.Detach() );
377 ::Exception * pItem = (::Exception *)&itm; 377 ::Exception * pItem = (::Exception *)&itm;
378 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() ); 378 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
379 if ( !pItem->GetDeleted() ) { 379 if ( !pItem->GetDeleted() ) {
380 LPDISPATCH appIt = pItem->GetAppointmentItem(); 380 LPDISPATCH appIt = pItem->GetAppointmentItem();
381 _AppointmentItem * paItem = (_AppointmentItem *)&appIt; 381 _AppointmentItem * paItem = (_AppointmentItem *)&appIt;
382 ol2kopiCalendar( paItem, false ); 382 ol2kopiCalendar( paItem, false );
383 } 383 }
384 itm->Release(); 384 itm->Release();
385 } 385 }
386 } 386 }
387 // recurrence ENTE 387 // recurrence ENTE
388 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer())); 388 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
389 389
390 //GetOptionalAttendees() 390 //GetOptionalAttendees()
391 //GetRequiredAttendees() 391 //GetRequiredAttendees()
392 LPDISPATCH dispItem = aItem->GetRecipients(); 392 LPDISPATCH dispItem = aItem->GetRecipients();
393 dispItem->AddRef(); 393 dispItem->AddRef();
394 _Folders mf(dispItem); 394 _Folders mf(dispItem);
395 mf.m_lpDispatch->AddRef(); 395 mf.m_lpDispatch->AddRef();
396 _variant_t indx((long)0); 396 _variant_t indx((long)0);
397 LPDISPATCH itm; 397 LPDISPATCH itm;
398 int i; 398 int i;
399 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer()); 399 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
400 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer()); 400 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
401 //GetRequiredAttendees() 401 //GetRequiredAttendees()
402 for(i=1; i <= mf.GetCount(); ++i) { 402 for(i=1; i <= mf.GetCount(); ++i) {
403 indx = (long)i; 403 indx = (long)i;
404 itm = mf.Item( indx.Detach() ); 404 itm = mf.Item( indx.Detach() );
405 Recipient * pItem = (Recipient *)&itm; 405 Recipient * pItem = (Recipient *)&itm;
406 406
407 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 407 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
408 QString name = QString::fromUcs2( pItem->GetName().GetBuffer()); 408 QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
409 KCal::Attendee::PartStat stat; 409 KCal::Attendee::PartStat stat;
410 bool rsvp = false; 410 bool rsvp = false;
411 switch ( pItem->GetMeetingResponseStatus() ) { 411 switch ( pItem->GetMeetingResponseStatus() ) {
412 case 0: //not answered 412 case 0: //not answered
413 rsvp = true; 413 rsvp = true;
414 case 5: //not answered 414 case 5: //not answered
415 stat = Attendee::NeedsAction; 415 stat = Attendee::NeedsAction;
416 break; 416 break;
417 case 1: //organizer 417 case 1: //organizer
418 stat = Attendee::Delegated ; 418 stat = Attendee::Delegated ;
419 break; 419 break;
420 case 2: //tentative 420 case 2: //tentative
421 stat = Attendee::Tentative ; 421 stat = Attendee::Tentative ;
422 break; 422 break;
423 case 3: //accepted 423 case 3: //accepted
424 stat = Attendee::Accepted; 424 stat = Attendee::Accepted;
425 break; 425 break;
426 case 4: //declined 426 case 4: //declined
427 stat =Attendee::Declined ; 427 stat =Attendee::Declined ;
428 break; 428 break;
429 default: 429 default:
430 stat = Attendee::NeedsAction ; 430 stat = Attendee::NeedsAction ;
431 431
432 } 432 }
433 KCal::Attendee::Role role; 433 KCal::Attendee::Role role;
434 if ( event->organizer() == name ) 434 if ( event->organizer() == name )
435 role = KCal::Attendee::Chair; 435 role = KCal::Attendee::Chair;
436 else if ( reqAtt.find( name ) >= 0 ) 436 else if ( reqAtt.find( name ) >= 0 )
437 role = KCal::Attendee::ReqParticipant; 437 role = KCal::Attendee::ReqParticipant;
438 else if ( optAtt.find( name ) >= 0 ) 438 else if ( optAtt.find( name ) >= 0 )
439 role = KCal::Attendee::OptParticipant; 439 role = KCal::Attendee::OptParticipant;
440 else 440 else
441 role = KCal::Attendee::NonParticipant; 441 role = KCal::Attendee::NonParticipant;
442 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); 442 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
443 if( mail.isEmpty() && name.find("@") > 0 ) { 443 if( mail.isEmpty() && name.find("@") > 0 ) {
444 int kl = name.find("<"); 444 int kl = name.find("<");
445 int gr = name.find(">"); 445 int gr = name.find(">");
446 if ( kl >= 0 && gr >= 0) { 446 if ( kl >= 0 && gr >= 0) {
447 mail = name.mid (kl+1, gr - kl -1); 447 mail = name.mid (kl+1, gr - kl -1);
448 name = name.left( kl ); 448 name = name.left( kl );
449 } 449 }
450 else 450 else
451 mail = name; 451 mail = name;
452 } 452 }
453 mail = mail.stripWhiteSpace(); 453 mail = mail.stripWhiteSpace();
454 454
455 QString uid = getUidByEmail( mail ); 455 QString uid = getUidByEmail( mail );
456 //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer()); 456 //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
457 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ; 457 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
458 event->addAttendee( a , false ); 458 event->addAttendee( a , false );
459 itm->Release(); 459 itm->Release();
460 } 460 }
461 461
462 462
463 if ( !mCalendar->addEventNoDup( event )) 463 if ( !mCalendar->addEventNoDup( event ))
464 delete event; 464 delete event;
465 else { 465 else {
466 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString()); 466 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
467 //KMessageBox::information(this,mes); 467 //KMessageBox::information(this,mes);
468 ++importedItems; 468 ++importedItems;
469 } 469 }
470} 470}
471void KOImportOLdialog::slotCancel() 471void KOImportOLdialog::slotCancel()
472{ 472{
473 reject(); 473 reject();
474} 474}
475 475
476QString KOImportOLdialog::getUidByEmail( QString email ) 476QString KOImportOLdialog::getUidByEmail( QString email )
477{ 477{
478 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 478 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
479 KABC::AddressBook::Iterator it; 479 KABC::AddressBook::Iterator it;
480 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 480 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
481 QStringList em = (*it).emails(); 481 QStringList em = (*it).emails();
482 if ( em.contains( email )) 482 if ( em.contains( email ))
483 return (*it).uid(); 483 return (*it).uid();
484 } 484 }
485 return ""; 485 return email;
486} 486}