-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 | |||
@@ -110,16 +110,17 @@ | |||
110 | #include "addresseeconfig.h" | 110 | #include "addresseeconfig.h" |
111 | #include <kcmultidialog.h> | 111 | #include <kcmultidialog.h> |
112 | 112 | ||
113 | #ifdef _WIN32_ | 113 | #ifdef _WIN32_ |
114 | 114 | ||
115 | #include "kaimportoldialog.h" | 115 | #include "kaimportoldialog.h" |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | bool pasteWithNewUid = true; | ||
118 | 119 | ||
119 | #ifdef KAB_EMBEDDED | 120 | #ifdef KAB_EMBEDDED |
120 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 121 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 122 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
122 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 123 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
123 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 124 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
124 | #else //KAB_EMBEDDED | 125 | #else //KAB_EMBEDDED |
125 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 126 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
@@ -393,17 +394,21 @@ void KABCore::createAboutData() | |||
393 | "(c) 1997-2003, The KDE PIM Team\n" | 394 | "(c) 1997-2003, The KDE PIM Team\n" |
394 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 395 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
395 | "Don Sanders Original author\n" | 396 | "Don Sanders Original author\n" |
396 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 397 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
397 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 398 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
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 | ||
404 | void KABCore::setContactSelected( const QString &uid ) | 409 | void KABCore::setContactSelected( const QString &uid ) |
405 | { | 410 | { |
406 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 411 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
407 | if ( !mDetails->isHidden() ) | 412 | if ( !mDetails->isHidden() ) |
408 | mDetails->setAddressee( addr ); | 413 | mDetails->setAddressee( addr ); |
409 | 414 | ||
@@ -849,18 +854,35 @@ void KABCore::importVCard( const KURL &url, bool showPreview ) | |||
849 | mXXPortManager->importVCard( url, showPreview ); | 854 | mXXPortManager->importVCard( url, showPreview ); |
850 | } | 855 | } |
851 | void KABCore::importFromOL() | 856 | void KABCore::importFromOL() |
852 | { | 857 | { |
853 | #ifdef _WIN32_ | 858 | #ifdef _WIN32_ |
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 | } |
862 | 884 | ||
863 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 885 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
864 | { | 886 | { |
865 | mXXPortManager->importVCard( vCard, showPreview ); | 887 | mXXPortManager->importVCard( vCard, showPreview ); |
866 | } | 888 | } |
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp index 5e7d7c4..ef949e7 100644 --- a/kaddressbook/kaimportoldialog.cpp +++ b/kaddressbook/kaimportoldialog.cpp | |||
@@ -243,17 +243,17 @@ void KAImportOLdialog::slotOk() | |||
243 | QDialog::accept(); | 243 | QDialog::accept(); |
244 | } | 244 | } |
245 | 245 | ||
246 | void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) | 246 | void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) |
247 | { | 247 | { |
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()) ); |
255 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); | 255 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); |
256 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); | 256 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); |
257 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); | 257 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); |
258 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); | 258 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); |
259 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); | 259 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); |
@@ -624,12 +624,16 @@ bool KAImportOLdialog::addAddressee( KABC::Addressee a ) | |||
624 | bool add = true; | 624 | bool add = true; |
625 | KABC::Addressee::List::Iterator it; | 625 | KABC::Addressee::List::Iterator it; |
626 | for ( it = mAList.begin(); it != mAList.end(); ++it ) { | 626 | for ( it = mAList.begin(); it != mAList.end(); ++it ) { |
627 | if ( (*it).uid() == a.uid() ) { | 627 | if ( (*it).uid() == a.uid() ) { |
628 | add = false; | 628 | add = false; |
629 | break; | 629 | break; |
630 | } | 630 | } |
631 | } | 631 | } |
632 | if ( add ) | 632 | if ( add ) { |
633 | if ( mABook->findByUid(a.uid() ).isEmpty()) | ||
633 | mAList.append ( a ); | 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 | |||
@@ -31,17 +31,17 @@ | |||
31 | #include <kapplication.h> | 31 | #include <kapplication.h> |
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | 33 | ||
34 | #include "addresseeutil.h" | 34 | #include "addresseeutil.h" |
35 | #include "addresseeconfig.h" | 35 | #include "addresseeconfig.h" |
36 | #include "kabcore.h" | 36 | #include "kabcore.h" |
37 | 37 | ||
38 | #include "undocmds.h" | 38 | #include "undocmds.h" |
39 | 39 | extern bool pasteWithNewUid; | |
40 | ///////////////////////////////// | 40 | ///////////////////////////////// |
41 | // PwDelete Methods | 41 | // PwDelete Methods |
42 | 42 | ||
43 | PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc, | 43 | PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc, |
44 | const QStringList &uidList) | 44 | const QStringList &uidList) |
45 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList) | 45 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList) |
46 | { | 46 | { |
47 | redo(); | 47 | redo(); |
@@ -107,16 +107,17 @@ void PwPasteCommand::undo() | |||
107 | void PwPasteCommand::redo() | 107 | void PwPasteCommand::redo() |
108 | { | 108 | { |
109 | QStringList uids; | 109 | QStringList uids; |
110 | KABC::Addressee::List::Iterator it; | 110 | KABC::Addressee::List::Iterator it; |
111 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) { | 111 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) { |
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 | if ( pasteWithNewUid ) | ||
115 | (*it).setUid( KApplication::randomString( 10 ) ); | 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 | } |
119 | if ( uids.count() < 4 ) { | 120 | if ( uids.count() < 4 ) { |
120 | QStringList::Iterator uidIt; | 121 | QStringList::Iterator uidIt; |
121 | for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) | 122 | for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) |
122 | mCore->editContact( *uidIt ); | 123 | mCore->editContact( *uidIt ); |