summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-07-12 13:32:09 (UTC)
committer zautrix <zautrix>2004-07-12 13:32:09 (UTC)
commit915a3b162dea2755ec1c8267a9c9f65709bce602 (patch) (side-by-side diff)
tree75b3d15a2386a4da7ab790a1f249ff811a7a7ae8 /korganizer
parentcbc789907408fa3359444c464ba5a86be892f301 (diff)
downloadkdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.zip
kdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.tar.gz
kdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.tar.bz2
Another win import fix
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koimportoldialog.cpp21
-rw-r--r--korganizer/koimportoldialog.h1
2 files changed, 17 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
@@ -33,32 +33,33 @@
#include <qhbox.h>
#include <qheader.h>
#include <qdatetime.h>
#include <qlistview.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kinputdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
+#include <kabc/stdaddressbook.h>
#include "koprefs.h"
#include "koglobals.h"
#include "koimportoldialog.h"
#include "../outport/msoutl9.h"
#include <ole2.h>
#include <comutil.h>
_Application gOlApp;
QDateTime mDdate2Qdtr( DATE dt)
{
COleDateTime odt;
SYSTEMTIME st;
odt = dt;
@@ -427,40 +428,50 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe
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 )
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();
}
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 "";
+}
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
index f6a753d..c8847c5 100644
--- a/korganizer/koimportoldialog.h
+++ b/korganizer/koimportoldialog.h
@@ -60,24 +60,25 @@ class KOImportOLdialog : public KDialogBase
signals:
protected slots:
void slotApply();
void slotOk();
void slotCancel();
protected:
void setupFolderView();
void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
void readCalendarData( DWORD folder );
void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
Calendar *mCalendar;
QListView * mListView;
+ QString getUidByEmail( QString email );
private:
int importedItems;
};
#endif