summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-12 12:43:54 (UTC)
committer zautrix <zautrix>2004-07-12 12:43:54 (UTC)
commitcbc789907408fa3359444c464ba5a86be892f301 (patch) (unidiff)
tree82d02fc50134c1e64acf4ea9f5388ac3396602b3
parenta55fa40fa32b115c7f7803fb6af0da5184cd7dff (diff)
downloadkdepimpi-cbc789907408fa3359444c464ba5a86be892f301.zip
kdepimpi-cbc789907408fa3359444c464ba5a86be892f301.tar.gz
kdepimpi-cbc789907408fa3359444c464ba5a86be892f301.tar.bz2
Windows import fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp30
-rw-r--r--kaddressbook/kaimportoldialog.cpp10
-rw-r--r--kaddressbook/undocmds.cpp5
3 files changed, 36 insertions, 9 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f4263c4..1a34e4d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -115,6 +115,7 @@
115#include "kaimportoldialog.h" 115#include "kaimportoldialog.h"
116#endif 116#endif
117 117
118bool pasteWithNewUid = true;
118 119
119#ifdef KAB_EMBEDDED 120#ifdef KAB_EMBEDDED
120KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 121KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
@@ -398,7 +399,11 @@ void KABCore::createAboutData()
398 "Greg Stern DCOP interface\n" 399 "Greg Stern DCOP interface\n"
399 "Mark Westcot Contact pinning\n" 400 "Mark Westcot Contact pinning\n"
400 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 401 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
401 "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); 402 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
403#ifdef _WIN32_
404 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
405#endif
406 );
402} 407}
403 408
404void KABCore::setContactSelected( const QString &uid ) 409void KABCore::setContactSelected( const QString &uid )
@@ -594,7 +599,7 @@ void KABCore::pasteContacts()
594 pasteContacts( list ); 599 pasteContacts( list );
595} 600}
596 601
597void KABCore::pasteContacts( KABC::Addressee::List &list ) 602void KABCore::pasteContacts( KABC::Addressee::List &list )
598{ 603{
599 KABC::Resource *resource = requestResource( this ); 604 KABC::Resource *resource = requestResource( this );
600 KABC::Addressee::List::Iterator it; 605 KABC::Addressee::List::Iterator it;
@@ -854,8 +859,25 @@ void KABCore::importFromOL()
854 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 859 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
855 idgl->exec(); 860 idgl->exec();
856 KABC::Addressee::List list = idgl->getAddressList(); 861 KABC::Addressee::List list = idgl->getAddressList();
857 if ( list.count() > 0 ) 862 if ( list.count() > 0 ) {
858 pasteContacts( list ); 863 KABC::Addressee::List listNew;
864 KABC::Addressee::List listExisting;
865 KABC::Addressee::List::Iterator it;
866 KABC::AddressBook::Iterator iter;
867 for ( it = list.begin(); it != list.end(); ++it ) {
868 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
869 listNew.append( (*it) );
870 else
871 listExisting.append( (*it) );
872 }
873 if ( listExisting.count() > 0 )
874 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
875 if ( listNew.count() > 0 ) {
876 pasteWithNewUid = false;
877 pasteContacts( listNew );
878 pasteWithNewUid = true;
879 }
880 }
859 delete idgl; 881 delete idgl;
860#endif 882#endif
861} 883}
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp
index 5e7d7c4..ef949e7 100644
--- a/kaddressbook/kaimportoldialog.cpp
+++ b/kaddressbook/kaimportoldialog.cpp
@@ -248,7 +248,7 @@ void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem )
248 KABC::Addressee addressee; 248 KABC::Addressee addressee;
249 249
250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); 250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
251 251 //GetLastModificationTime()
252 //addressee.setName( const QString &name ); 252 //addressee.setName( const QString &name );
253 //addressee.setFormattedName( const QString &formattedName ); 253 //addressee.setFormattedName( const QString &formattedName );
254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); 254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) );
@@ -629,7 +629,11 @@ bool KAImportOLdialog::addAddressee( KABC::Addressee a )
629 break; 629 break;
630 } 630 }
631 } 631 }
632 if ( add ) 632 if ( add ) {
633 mAList.append ( a ); 633 if ( mABook->findByUid(a.uid() ).isEmpty())
634 mAList.append ( a );
635 else
636 add = false;
637 }
634 return add; 638 return add;
635} 639}
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp
index 5fbeec3..5807dc0 100644
--- a/kaddressbook/undocmds.cpp
+++ b/kaddressbook/undocmds.cpp
@@ -36,7 +36,7 @@
36#include "kabcore.h" 36#include "kabcore.h"
37 37
38#include "undocmds.h" 38#include "undocmds.h"
39 39extern bool pasteWithNewUid;
40///////////////////////////////// 40/////////////////////////////////
41// PwDelete Methods 41// PwDelete Methods
42 42
@@ -112,7 +112,8 @@ void PwPasteCommand::redo()
112 /* we have to set a new uid for the contact, otherwise insertAddressee() 112 /* we have to set a new uid for the contact, otherwise insertAddressee()
113 ignore it. 113 ignore it.
114 */ 114 */
115 (*it).setUid( KApplication::randomString( 10 ) ); 115 if ( pasteWithNewUid )
116 (*it).setUid( KApplication::randomString( 10 ) );
116 uids.append( (*it).uid() ); 117 uids.append( (*it).uid() );
117 mCore->addressBook()->insertAddressee( *it ); 118 mCore->addressBook()->insertAddressee( *it );
118 } 119 }