summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f4263c4..1a34e4d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -106,24 +106,25 @@
106#include "xxportmanager.h" 106#include "xxportmanager.h"
107#include "incsearchwidget.h" 107#include "incsearchwidget.h"
108#include "jumpbuttonbar.h" 108#include "jumpbuttonbar.h"
109#include "extensionmanager.h" 109#include "extensionmanager.h"
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
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 )
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
125KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 126KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
126 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 127 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
127 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 128 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
128 mReadWrite( readWrite ), mModified( false ) 129 mReadWrite( readWrite ), mModified( false )
129#endif //KAB_EMBEDDED 130#endif //KAB_EMBEDDED
@@ -389,25 +390,29 @@ void KABCore::createAboutData()
389 "for: Zaurus 5500 / 7x0 / 8x0\n" 390 "for: Zaurus 5500 / 7x0 / 8x0\n"
390#endif 391#endif
391 392
392 "(c) 2004 Ulf Schenk\n" 393 "(c) 2004 Ulf Schenk\n"
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
404void KABCore::setContactSelected( const QString &uid ) 409void 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
410 if ( !addr.isEmpty() ) { 415 if ( !addr.isEmpty() ) {
411 emit contactSelected( addr.formattedName() ); 416 emit contactSelected( addr.formattedName() );
412 KABC::Picture pic = addr.photo(); 417 KABC::Picture pic = addr.photo();
413 if ( pic.isIntern() ) { 418 if ( pic.isIntern() ) {
@@ -585,25 +590,25 @@ void KABCore::cutContacts()
585 } 590 }
586} 591}
587 592
588void KABCore::pasteContacts() 593void KABCore::pasteContacts()
589{ 594{
590 QClipboard *cb = QApplication::clipboard(); 595 QClipboard *cb = QApplication::clipboard();
591 596
592 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 597 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
593 598
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;
601 for ( it = list.begin(); it != list.end(); ++it ) 606 for ( it = list.begin(); it != list.end(); ++it )
602 (*it).setResource( resource ); 607 (*it).setResource( resource );
603 608
604 PwPasteCommand *command = new PwPasteCommand( this, list ); 609 PwPasteCommand *command = new PwPasteCommand( this, list );
605 UndoStack::instance()->push( command ); 610 UndoStack::instance()->push( command );
606 RedoStack::instance()->clear(); 611 RedoStack::instance()->clear();
607 612
608 setModified( true ); 613 setModified( true );
609} 614}
@@ -845,26 +850,43 @@ void KABCore::addEmail( QString aStr )
845} 850}
846 851
847void KABCore::importVCard( const KURL &url, bool showPreview ) 852void KABCore::importVCard( const KURL &url, bool showPreview )
848{ 853{
849 mXXPortManager->importVCard( url, showPreview ); 854 mXXPortManager->importVCard( url, showPreview );
850} 855}
851void KABCore::importFromOL() 856void 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
863void KABCore::importVCard( const QString &vCard, bool showPreview ) 885void KABCore::importVCard( const QString &vCard, bool showPreview )
864{ 886{
865 mXXPortManager->importVCard( vCard, showPreview ); 887 mXXPortManager->importVCard( vCard, showPreview );
866} 888}
867 889
868//US added a second method without defaultparameter 890//US added a second method without defaultparameter
869void KABCore::editContact2() { 891void KABCore::editContact2() {
870 editContact( QString::null ); 892 editContact( QString::null );