summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-29 21:26:43 (UTC)
committer zautrix <zautrix>2005-06-29 21:26:43 (UTC)
commit7ccfe9b674bd5cc52eab708c2e7dfb02c3328deb (patch) (side-by-side diff)
tree4083b66180ee5385ee12dc2a9e03ef26e78f1f58
parentd1ca2fd41cb1390843c974c985cae5912d458d51 (diff)
downloadkdepimpi-7ccfe9b674bd5cc52eab708c2e7dfb02c3328deb.zip
kdepimpi-7ccfe9b674bd5cc52eab708c2e7dfb02c3328deb.tar.gz
kdepimpi-7ccfe9b674bd5cc52eab708c2e7dfb02c3328deb.tar.bz2
fixx
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
int i;
int bb = 2;
for( i = 1; i <= 6; ++i ) {
weekDays.setBit( i - 1, ( bb & weekDaysNum ));
bb = 4 << (i-1);
//qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
}
if ( 1 & weekDaysNum)
weekDays.setBit( 6 );
// int pos = 1;// pending
Recurrence *r = event->recurrence();
int rtype = recpat.GetRecurrenceType();
//recurrence types are:
/*
olRecursDaily(0)
olRecursWeekly(1)
olRecursMonthly(2)
olRecursMonthNth(3)
olRecursYearly(5)
olRecursYearNth(6)
*/
int duration = recpat.GetOccurrences();
if ( !hasEndDate )
duration = -1;
//LPDISPATCH RecurrencePattern::GetExceptions()
//long RecurrencePattern::GetMonthOfYear()
if ( rtype == 0 ) {
if ( hasEndDate ) r->setDaily( freq, endDate );
else r->setDaily( freq, duration );
} else if ( rtype == 1 ) {
if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
else r->setWeekly( freq, weekDays, duration );
} else if ( rtype == 2 ) {
if ( hasEndDate )
r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
else
r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
//r->addMonthlyDay( startDate.day() );
r->addMonthlyDay( recpat.GetDayOfMonth() );
} else if ( rtype == 3 ) {
if ( hasEndDate )
r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
else
r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
QBitArray days( 7 );
days.fill( false );
days.setBit( startDate.dayOfWeek() - 1 );
int pos = (startDate.day()/7)+1;
r->addMonthlyPos( pos, days );
//QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
//KMessageBox::information(this,mes);
} else if ( rtype == 5 ) {
freq = 1;
if ( hasEndDate )
r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
else
r->setYearly( Recurrence::rYearlyMonth, freq, duration );
r->addYearlyNum( startDate.month() );
} else if ( true /*rtype == 6*/ ) {
// KOganizer cannot handle this in the GUI
// we are mapping this to monthly - every 12. month
freq = 12;
if ( hasEndDate )
r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
else
r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
QBitArray days( 7 );
days.fill( false );
days.setBit( startDate.dayOfWeek() - 1 );
int pos = (startDate.day()/7)+1;
r->addMonthlyPos( pos, days );
}
// recurrence exceptions
LPDISPATCH dispItem = recpat.GetExceptions();
dispItem->AddRef();
Exceptions ex(dispItem);
_variant_t indx((long)0);
LPDISPATCH itm;
for(i=1; i <= ex.GetCount(); ++i) {
indx = (long)i;
itm = ex.Item( indx.Detach() );
::Exception * pItem = (::Exception *)&itm;
event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
if ( !pItem->GetDeleted() ) {
LPDISPATCH appIt = pItem->GetAppointmentItem();
_AppointmentItem * paItem = (_AppointmentItem *)&appIt;
ol2kopiCalendar( paItem, false );
}
itm->Release();
}
}
// recurrence ENTE
event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
//GetOptionalAttendees()
//GetRequiredAttendees()
LPDISPATCH dispItem = aItem->GetRecipients();
dispItem->AddRef();
_Folders mf(dispItem);
mf.m_lpDispatch->AddRef();
_variant_t indx((long)0);
LPDISPATCH itm;
int i;
QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
//GetRequiredAttendees()
for(i=1; i <= mf.GetCount(); ++i) {
indx = (long)i;
itm = mf.Item( indx.Detach() );
Recipient * pItem = (Recipient *)&itm;
//a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
KCal::Attendee::PartStat stat;
bool rsvp = false;
switch ( pItem->GetMeetingResponseStatus() ) {
case 0: //not answered
rsvp = true;
case 5: //not answered
stat = Attendee::NeedsAction;
break;
case 1: //organizer
stat = Attendee::Delegated ;
break;
case 2: //tentative
stat = Attendee::Tentative ;
break;
case 3: //accepted
stat = Attendee::Accepted;
break;
case 4: //declined
stat =Attendee::Declined ;
break;
default:
stat = Attendee::NeedsAction ;
}
KCal::Attendee::Role role;
if ( event->organizer() == name )
role = KCal::Attendee::Chair;
else if ( reqAtt.find( name ) >= 0 )
role = KCal::Attendee::ReqParticipant;
else if ( optAtt.find( name ) >= 0 )
role = KCal::Attendee::OptParticipant;
else
role = KCal::Attendee::NonParticipant;
QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
if( mail.isEmpty() && name.find("@") > 0 ) {
int kl = name.find("<");
int gr = name.find(">");
if ( kl >= 0 && gr >= 0) {
mail = name.mid (kl+1, gr - kl -1);
name = name.left( kl );
}
else
mail = name;
}
mail = mail.stripWhiteSpace();
QString uid = getUidByEmail( mail );
//uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
event->addAttendee( a , false );
itm->Release();
}
if ( !mCalendar->addEventNoDup( event ))
delete event;
else {
// QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
//KMessageBox::information(this,mes);
++importedItems;
}
}
void KOImportOLdialog::slotCancel()
{
reject();
}
QString KOImportOLdialog::getUidByEmail( QString email )
{
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
QStringList em = (*it).emails();
if ( em.contains( email ))
return (*it).uid();
}
- return "";
+ return email;
}