-rw-r--r-- | kaddressbook/kabcore.cpp | 28 | ||||
-rw-r--r-- | kaddressbook/kaimportoldialog.cpp | 8 | ||||
-rw-r--r-- | kaddressbook/undocmds.cpp | 3 |
3 files changed, 33 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f4263c4..1a34e4d 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -117,2 +117,3 @@ +bool pasteWithNewUid = true; @@ -400,3 +401,7 @@ void KABCore::createAboutData() "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" - "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); + "Steffen Hansen LDAP Lookup hansen@kde.org\n" +#ifdef _WIN32_ + "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" +#endif + ); } @@ -856,4 +861,21 @@ void KABCore::importFromOL() KABC::Addressee::List list = idgl->getAddressList(); - if ( list.count() > 0 ) - pasteContacts( list ); + if ( list.count() > 0 ) { + KABC::Addressee::List listNew; + KABC::Addressee::List listExisting; + KABC::Addressee::List::Iterator it; + KABC::AddressBook::Iterator iter; + for ( it = list.begin(); it != list.end(); ++it ) { + if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) + listNew.append( (*it) ); + else + listExisting.append( (*it) ); + } + if ( listExisting.count() > 0 ) + KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); + if ( listNew.count() > 0 ) { + pasteWithNewUid = false; + pasteContacts( listNew ); + pasteWithNewUid = true; + } + } delete idgl; diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp index 5e7d7c4..ef949e7 100644 --- a/kaddressbook/kaimportoldialog.cpp +++ b/kaddressbook/kaimportoldialog.cpp @@ -250,3 +250,3 @@ void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); - + //GetLastModificationTime() //addressee.setName( const QString &name ); @@ -631,4 +631,8 @@ bool KAImportOLdialog::addAddressee( KABC::Addressee a ) } - if ( add ) + if ( add ) { + if ( mABook->findByUid(a.uid() ).isEmpty()) mAList.append ( a ); + else + add = false; + } return add; diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp index 5fbeec3..5807dc0 100644 --- a/kaddressbook/undocmds.cpp +++ b/kaddressbook/undocmds.cpp @@ -38,3 +38,3 @@ #include "undocmds.h" - +extern bool pasteWithNewUid; ///////////////////////////////// @@ -114,2 +114,3 @@ void PwPasteCommand::redo() */ + if ( pasteWithNewUid ) (*it).setUid( KApplication::randomString( 10 ) ); |