summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-12 13:32:09 (UTC)
committer zautrix <zautrix>2004-07-12 13:32:09 (UTC)
commit915a3b162dea2755ec1c8267a9c9f65709bce602 (patch) (unidiff)
tree75b3d15a2386a4da7ab790a1f249ff811a7a7ae8
parentcbc789907408fa3359444c464ba5a86be892f301 (diff)
downloadkdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.zip
kdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.tar.gz
kdepimpi-915a3b162dea2755ec1c8267a9c9f65709bce602.tar.bz2
Another win import fix
Diffstat (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
@@ -37,24 +37,25 @@
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kstandarddirs.h> 40#include <kstandarddirs.h>
41#include <kmessagebox.h> 41#include <kmessagebox.h>
42#include <kfiledialog.h> 42#include <kfiledialog.h>
43 43
44#include <libkdepim/categoryselectdialog.h> 44#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h> 45#include <libkdepim/kinputdialog.h>
46 46
47#include <libkcal/calendarlocal.h> 47#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 48#include <libkcal/icalformat.h>
49#include <kabc/stdaddressbook.h>
49 50
50#include "koprefs.h" 51#include "koprefs.h"
51#include "koglobals.h" 52#include "koglobals.h"
52 53
53#include "koimportoldialog.h" 54#include "koimportoldialog.h"
54 55
55#include "../outport/msoutl9.h" 56#include "../outport/msoutl9.h"
56#include <ole2.h> 57#include <ole2.h>
57#include <comutil.h> 58#include <comutil.h>
58_Application gOlApp; 59_Application gOlApp;
59 60
60QDateTime mDdate2Qdtr( DATE dt) 61QDateTime mDdate2Qdtr( DATE dt)
@@ -431,36 +432,46 @@ void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRe
431 KCal::Attendee::Role role; 432 KCal::Attendee::Role role;
432 if ( event->organizer() == name ) 433 if ( event->organizer() == name )
433 role = KCal::Attendee::Chair; 434 role = KCal::Attendee::Chair;
434 else if ( reqAtt.find( name ) >= 0 ) 435 else if ( reqAtt.find( name ) >= 0 )
435 role = KCal::Attendee::ReqParticipant; 436 role = KCal::Attendee::ReqParticipant;
436 else if ( optAtt.find( name ) >= 0 ) 437 else if ( optAtt.find( name ) >= 0 )
437 role = KCal::Attendee::OptParticipant; 438 role = KCal::Attendee::OptParticipant;
438 else 439 else
439 role = KCal::Attendee::NonParticipant; 440 role = KCal::Attendee::NonParticipant;
440 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); 441 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
441 if( mail.isEmpty() && name.find("@") > 0 ) 442 if( mail.isEmpty() && name.find("@") > 0 )
442 mail = name; 443 mail = name;
443 QString uid;
444 if ( mail.isEmpty() )
445 uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
446 else
447 uid = mail;
448 mail = mail.stripWhiteSpace(); 444 mail = mail.stripWhiteSpace();
445
446 QString uid = getUidByEmail( mail );
447 //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
449 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ; 448 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
450 event->addAttendee( a , false ); 449 event->addAttendee( a , false );
451 itm->Release(); 450 itm->Release();
452 } 451 }
453 452
454 453
455 if ( !mCalendar->addEventNoDup( event )) 454 if ( !mCalendar->addEventNoDup( event ))
456 delete event; 455 delete event;
457 else { 456 else {
458 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString()); 457 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
459 //KMessageBox::information(this,mes); 458 //KMessageBox::information(this,mes);
460 ++importedItems; 459 ++importedItems;
461 } 460 }
462} 461}
463void KOImportOLdialog::slotCancel() 462void KOImportOLdialog::slotCancel()
464{ 463{
465 reject(); 464 reject();
466} 465}
466
467QString KOImportOLdialog::getUidByEmail( QString email )
468{
469 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
470 KABC::AddressBook::Iterator it;
471 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
472 QStringList em = (*it).emails();
473 if ( em.contains( email ))
474 return (*it).uid();
475 }
476 return "";
477}
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
index f6a753d..c8847c5 100644
--- a/korganizer/koimportoldialog.h
+++ b/korganizer/koimportoldialog.h
@@ -64,20 +64,21 @@ class KOImportOLdialog : public KDialogBase
64 void slotApply(); 64 void slotApply();
65 void slotOk(); 65 void slotOk();
66 void slotCancel(); 66 void slotCancel();
67 67
68 protected: 68 protected:
69 void setupFolderView(); 69 void setupFolderView();
70 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); 70 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
71 void readCalendarData( DWORD folder ); 71 void readCalendarData( DWORD folder );
72 void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true ); 72 void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
73 73
74 Calendar *mCalendar; 74 Calendar *mCalendar;
75 QListView * mListView; 75 QListView * mListView;
76 QString getUidByEmail( QString email );
76 77
77 private: 78 private:
78 int importedItems; 79 int importedItems;
79}; 80};
80 81
81#endif 82#endif
82 83
83 84