From 915a3b162dea2755ec1c8267a9c9f65709bce602 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 12 Jul 2004 13:32:09 +0000 Subject: Another win import fix --- (limited to 'korganizer') diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp index 36363e5..16f2eca 100644 --- a/korganizer/koimportoldialog.cpp +++ b/korganizer/koimportoldialog.cpp @@ -46,6 +46,7 @@ #include #include +#include #include "koprefs.h" #include "koglobals.h" @@ -440,12 +441,10 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe 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(); @@ -464,3 +463,15 @@ 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 ""; +} diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h index f6a753d..c8847c5 100644 --- a/korganizer/koimportoldialog.h +++ b/korganizer/koimportoldialog.h @@ -73,6 +73,7 @@ class KOImportOLdialog : public KDialogBase Calendar *mCalendar; QListView * mListView; + QString getUidByEmail( QString email ); private: int importedItems; -- cgit v0.9.0.2