Diffstat (limited to 'korganizer/koimportoldialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koimportoldialog.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp index 36363e5..16f2eca 100644 --- a/korganizer/koimportoldialog.cpp +++ b/korganizer/koimportoldialog.cpp @@ -45,8 +45,9 @@ #include <libkdepim/kinputdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> +#include <kabc/stdaddressbook.h> #include "koprefs.h" #include "koglobals.h" @@ -439,14 +440,12 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe role = KCal::Attendee::NonParticipant; QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); if( mail.isEmpty() && name.find("@") > 0 ) mail = name; - QString uid; - if ( mail.isEmpty() ) - uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer()); - else - uid = mail; 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(); } @@ -463,4 +462,16 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe 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 ""; +} |