00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "config.h"
00022
00023 #include <qcheckbox.h>
00024 #include <qgroupbox.h>
00025 #include <qheader.h>
00026 #include <qlabel.h>
00027 #include <qlayout.h>
00028 #include <qlistview.h>
00029 #include <qmap.h>
00030 #include <qpushbutton.h>
00031
00032 #include <addresseelineedit.h>
00033 #include <kapplication.h>
00034 #include <kbuttonbox.h>
00035 #include <kcombobox.h>
00036 #include <kconfig.h>
00037 #include <klineedit.h>
00038 #include <klocale.h>
00039 #include <kmessagebox.h>
00040
00041 #include "kabcore.h"
00042 #include "ldapsearchdialog.h"
00043 #include "kablock.h"
00044
00045 #ifdef KDEPIM_NEW_DISTRLISTS
00046 #include "distributionlistpicker.h"
00047 #endif
00048
00049 static QString asUtf8( const QByteArray &val )
00050 {
00051 if ( val.isEmpty() )
00052 return QString::null;
00053
00054 const char *data = val.data();
00055
00056
00057 if ( data[ val.size() - 1 ] == '\0' )
00058 return QString::fromUtf8( data, val.size() - 1 );
00059 else
00060 return QString::fromUtf8( data, val.size() );
00061 }
00062
00063 static QString join( const KPIM::LdapAttrValue& lst, const QString& sep )
00064 {
00065 QString res;
00066 bool alredy = false;
00067 for ( KPIM::LdapAttrValue::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
00068 if ( alredy )
00069 res += sep;
00070 alredy = true;
00071 res += asUtf8( *it );
00072 }
00073 return res;
00074 }
00075
00076 static QMap<QString, QString>& adrbookattr2ldap()
00077 {
00078 static QMap<QString, QString> keys;
00079
00080 if ( keys.isEmpty() ) {
00081 keys[ i18n( "Title" ) ] = "title";
00082 keys[ i18n( "Full Name" ) ] = "cn";
00083 keys[ i18n( "Email" ) ] = "mail";
00084 keys[ i18n( "Home Number" ) ] = "homePhone";
00085 keys[ i18n( "Work Number" ) ] = "telephoneNumber";
00086 keys[ i18n( "Mobile Number" ) ] = "mobile";
00087 keys[ i18n( "Fax Number" ) ] = "facsimileTelephoneNumber";
00088 keys[ i18n( "Pager" ) ] = "pager";
00089 keys[ i18n( "Street") ] = "street";
00090 keys[ i18n( "State" ) ] = "st";
00091 keys[ i18n( "Country" ) ] = "co";
00092 keys[ i18n( "City" ) ] = "l";
00093 keys[ i18n( "Organization" ) ] = "o";
00094 keys[ i18n( "Company" ) ] = "Company";
00095 keys[ i18n( "Department" ) ] = "department";
00096 keys[ i18n( "Zip Code" ) ] = "postalCode";
00097 keys[ i18n( "Postal Address" ) ] = "postalAddress";
00098 keys[ i18n( "Description" ) ] = "description";
00099 keys[ i18n( "User ID" ) ] = "uid";
00100 }
00101 return keys;
00102 }
00103
00104 class ContactListItem : public QListViewItem
00105 {
00106 public:
00107 ContactListItem( QListView* parent, const KPIM::LdapAttrMap& attrs )
00108 : QListViewItem( parent ), mAttrs( attrs )
00109 { }
00110
00111 KPIM::LdapAttrMap mAttrs;
00112
00113 virtual QString text( int col ) const
00114 {
00115
00116 const QString colName = listView()->columnText( col );
00117 const QString ldapAttrName = adrbookattr2ldap()[ colName ];
00118 return join( mAttrs[ ldapAttrName ], ", " );
00119 }
00120 };
00121
00122 class LDAPSearchDialog::Private
00123 {
00124 public:
00125 static QValueList<ContactListItem*> selectedItems( QListView* );
00126 QMap<const ContactListItem*, QString> itemToServer;
00127 };
00128
00129 QValueList<ContactListItem*> LDAPSearchDialog::Private::selectedItems( QListView* view )
00130 {
00131 QValueList<ContactListItem*> selected;
00132 ContactListItem* cli = static_cast<ContactListItem*>( view->firstChild() );
00133 while ( cli ) {
00134 if ( cli->isSelected() )
00135 selected.append( cli );
00136 cli = static_cast<ContactListItem*>( cli->nextSibling() );
00137 }
00138 return selected;
00139 }
00140
00141 LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
00142 QWidget* parent, const char* name )
00143 : KDialogBase( Plain, i18n( "Search for Addresses in Directory" ), Help | User1 | User2 |
00144 Cancel, Default, parent, name, false, true ),
00145 mAddressBook( ab ), mCore( core ), d( new Private )
00146 {
00147 setButtonCancel( KStdGuiItem::close() );
00148 QFrame *page = plainPage();
00149 QVBoxLayout *topLayout = new QVBoxLayout( page, marginHint(), spacingHint() );
00150
00151 QGroupBox *groupBox = new QGroupBox( i18n( "Search for Addresses in Directory" ),
00152 page );
00153 groupBox->setFrameShape( QGroupBox::Box );
00154 groupBox->setFrameShadow( QGroupBox::Sunken );
00155 groupBox->setColumnLayout( 0, Qt::Vertical );
00156 QGridLayout *boxLayout = new QGridLayout( groupBox->layout(), 2,
00157 5, spacingHint() );
00158 boxLayout->setColStretch( 1, 1 );
00159
00160 QLabel *label = new QLabel( i18n( "Search for:" ), groupBox );
00161 boxLayout->addWidget( label, 0, 0 );
00162
00163 mSearchEdit = new KLineEdit( groupBox );
00164 boxLayout->addWidget( mSearchEdit, 0, 1 );
00165 label->setBuddy( mSearchEdit );
00166
00167 label = new QLabel( i18n( "In LDAP attribute", "in" ), groupBox );
00168 boxLayout->addWidget( label, 0, 2 );
00169
00170 mFilterCombo = new KComboBox( groupBox );
00171 mFilterCombo->insertItem( i18n( "Name" ) );
00172 mFilterCombo->insertItem( i18n( "Email" ) );
00173 mFilterCombo->insertItem( i18n( "Home Number" ) );
00174 mFilterCombo->insertItem( i18n( "Work Number" ) );
00175 boxLayout->addWidget( mFilterCombo, 0, 3 );
00176
00177 QSize buttonSize;
00178 mSearchButton = new QPushButton( i18n( "Stop" ), groupBox );
00179 buttonSize = mSearchButton->sizeHint();
00180 mSearchButton->setText( i18n( "&Search" ) );
00181 if ( buttonSize.width() < mSearchButton->sizeHint().width() )
00182 buttonSize = mSearchButton->sizeHint();
00183 mSearchButton->setFixedWidth( buttonSize.width() );
00184
00185 mSearchButton->setDefault( true );
00186 boxLayout->addWidget( mSearchButton, 0, 4 );
00187
00188 mRecursiveCheckbox = new QCheckBox( i18n( "Recursive search" ), groupBox );
00189 mRecursiveCheckbox->setChecked( true );
00190 boxLayout->addMultiCellWidget( mRecursiveCheckbox, 1, 1, 0, 4 );
00191
00192 mSearchType = new KComboBox( groupBox );
00193 mSearchType->insertItem( i18n( "Contains" ) );
00194 mSearchType->insertItem( i18n( "Starts With" ) );
00195 boxLayout->addMultiCellWidget( mSearchType, 1, 1, 3, 4 );
00196
00197 topLayout->addWidget( groupBox );
00198
00199 mResultListView = new QListView( page );
00200 mResultListView->setSelectionMode( QListView::Multi );
00201 mResultListView->setAllColumnsShowFocus( true );
00202 mResultListView->setShowSortIndicator( true );
00203 topLayout->addWidget( mResultListView );
00204
00205 KButtonBox *buttons = new KButtonBox( page, Qt::Horizontal );
00206 buttons->addButton( i18n( "Select All" ), this, SLOT( slotSelectAll() ) );
00207 buttons->addButton( i18n( "Unselect All" ), this, SLOT( slotUnselectAll() ) );
00208
00209 topLayout->addWidget( buttons );
00210
00211 resize( QSize( 600, 400).expandedTo( minimumSizeHint() ) );
00212
00213 setButtonText( User1, i18n( "Add Selected" ) );
00214
00215 showButton( User2, false );
00216
00217 #ifdef KDEPIM_NEW_DISTRLISTS
00218 showButton( User2, true );
00219 setButtonText( User2, i18n( "Add to Distribution List..." ) );
00220 #endif
00221
00222 mNumHosts = 0;
00223 mIsOK = false;
00224
00225 connect( mRecursiveCheckbox, SIGNAL( toggled( bool ) ),
00226 this, SLOT( slotSetScope( bool ) ) );
00227 connect( mSearchButton, SIGNAL( clicked() ),
00228 this, SLOT( slotStartSearch() ) );
00229
00230 setTabOrder(mSearchEdit, mFilterCombo);
00231 setTabOrder(mFilterCombo, mSearchButton);
00232 mSearchEdit->setFocus();
00233
00234 restoreSettings();
00235 }
00236
00237 LDAPSearchDialog::~LDAPSearchDialog()
00238 {
00239 saveSettings();
00240 delete d;
00241 }
00242
00243 void LDAPSearchDialog::restoreSettings()
00244 {
00245
00246
00247
00248
00249 mLdapClientList.setAutoDelete( true );
00250 mLdapClientList.clear();
00251
00252 KConfig kabConfig( "kaddressbookrc" );
00253 kabConfig.setGroup( "LDAPSearch" );
00254 mSearchType->setCurrentItem( kabConfig.readNumEntry( "SearchType", 0 ) );
00255
00256
00257
00258 KConfig* config = KPIM::LdapSearch::config();
00259 KConfigGroupSaver saver( config, "LDAP" );
00260 mNumHosts = config->readUnsignedNumEntry( "NumSelectedHosts" );
00261 if ( !mNumHosts ) {
00262 KMessageBox::error( this, i18n( "You must select a LDAP server before searching.\nYou can do this from the menu Settings/Configure KAddressBook." ) );
00263 mIsOK = false;
00264 } else {
00265 mIsOK = true;
00266 for ( int j = 0; j < mNumHosts; ++j ) {
00267 KPIM::LdapClient* ldapClient = new KPIM::LdapClient( 0, this, "ldapclient" );
00268 KPIM::LdapServer ldapServer;
00269 KPIM::LdapSearch::readConfig( ldapServer, config, j, true );
00270 ldapClient->setServer( ldapServer );
00271 QStringList attrs;
00272
00273 for ( QMap<QString,QString>::ConstIterator it = adrbookattr2ldap().begin(); it != adrbookattr2ldap().end(); ++it )
00274 attrs << *it;
00275
00276 ldapClient->setAttrs( attrs );
00277
00278 connect( ldapClient, SIGNAL( result( const KPIM::LdapObject& ) ),
00279 this, SLOT( slotAddResult( const KPIM::LdapObject& ) ) );
00280 connect( ldapClient, SIGNAL( done() ),
00281 this, SLOT( slotSearchDone() ) );
00282 connect( ldapClient, SIGNAL( error( const QString& ) ),
00283 this, SLOT( slotError( const QString& ) ) );
00284
00285 mLdapClientList.append( ldapClient );
00286 }
00287
00289 while ( mResultListView->header()->count() > 0 ) {
00290 mResultListView->removeColumn(0);
00291 }
00292
00293 mResultListView->addColumn( i18n( "Full Name" ) );
00294 mResultListView->addColumn( i18n( "Email" ) );
00295 mResultListView->addColumn( i18n( "Home Number" ) );
00296 mResultListView->addColumn( i18n( "Work Number" ) );
00297 mResultListView->addColumn( i18n( "Mobile Number" ) );
00298 mResultListView->addColumn( i18n( "Fax Number" ) );
00299 mResultListView->addColumn( i18n( "Company" ) );
00300 mResultListView->addColumn( i18n( "Organization" ) );
00301 mResultListView->addColumn( i18n( "Street" ) );
00302 mResultListView->addColumn( i18n( "State" ) );
00303 mResultListView->addColumn( i18n( "Country" ) );
00304 mResultListView->addColumn( i18n( "Zip Code" ) );
00305 mResultListView->addColumn( i18n( "Postal Address" ) );
00306 mResultListView->addColumn( i18n( "City" ) );
00307 mResultListView->addColumn( i18n( "Department" ) );
00308 mResultListView->addColumn( i18n( "Description" ) );
00309 mResultListView->addColumn( i18n( "User ID" ) );
00310 mResultListView->addColumn( i18n( "Title" ) );
00311
00312 mResultListView->clear();
00313 d->itemToServer.clear();
00314 }
00315 }
00316
00317 void LDAPSearchDialog::saveSettings()
00318 {
00319 KConfig config( "kaddressbookrc" );
00320 config.setGroup( "LDAPSearch" );
00321 config.writeEntry( "SearchType", mSearchType->currentItem() );
00322 config.sync();
00323 }
00324
00325 void LDAPSearchDialog::cancelQuery()
00326 {
00327 for ( KPIM::LdapClient* client = mLdapClientList.first(); client; client = mLdapClientList.next() ) {
00328 client->cancelQuery();
00329 }
00330 }
00331
00332 void LDAPSearchDialog::slotAddResult( const KPIM::LdapObject& obj )
00333 {
00334 ContactListItem* item = new ContactListItem( mResultListView, obj.attrs );
00335 d->itemToServer[item] = obj.client->server().host();
00336 }
00337
00338 void LDAPSearchDialog::slotSetScope( bool rec )
00339 {
00340 for ( KPIM::LdapClient* client = mLdapClientList.first(); client; client = mLdapClientList.next() ) {
00341 if ( rec )
00342 client->setScope( "sub" );
00343 else
00344 client->setScope( "one" );
00345 }
00346 }
00347
00348 QString LDAPSearchDialog::makeFilter( const QString& query, const QString& attr,
00349 bool startsWith )
00350 {
00351
00352
00353
00354
00355
00356
00357 QString result( "&(|(objectclass=person)(objectclass=groupofnames)(mail=*))(" );
00358 if( query.isEmpty() )
00359
00360 return result + "|(cn=*)(sn=*)" + ")";
00361
00362 if ( attr == i18n( "Name" ) ) {
00363 result += startsWith ? "|(cn=%1*)(sn=%2*)" : "|(cn=*%1*)(sn=*%2*)";
00364 result = result.arg( query ).arg( query );
00365 } else {
00366 result += (startsWith ? "%1=%2*" : "%1=*%2*");
00367 if ( attr == i18n( "Email" ) ) {
00368 result = result.arg( "mail" ).arg( query );
00369 } else if ( attr == i18n( "Home Number" ) ) {
00370 result = result.arg( "homePhone" ).arg( query );
00371 } else if ( attr == i18n( "Work Number" ) ) {
00372 result = result.arg( "telephoneNumber" ).arg( query );
00373 } else {
00374
00375 result = QString::null;
00376 return result;
00377 }
00378 }
00379 result += ")";
00380 return result;
00381 }
00382
00383 void LDAPSearchDialog::slotStartSearch()
00384 {
00385 cancelQuery();
00386
00387 QApplication::setOverrideCursor( Qt::waitCursor );
00388 mSearchButton->setText( i18n( "Stop" ) );
00389
00390 disconnect( mSearchButton, SIGNAL( clicked() ),
00391 this, SLOT( slotStartSearch() ) );
00392 connect( mSearchButton, SIGNAL( clicked() ),
00393 this, SLOT( slotStopSearch() ) );
00394
00395 bool startsWith = (mSearchType->currentItem() == 1);
00396
00397 QString filter = makeFilter( mSearchEdit->text().stripWhiteSpace(), mFilterCombo->currentText(), startsWith );
00398
00399
00400 mResultListView->clear();
00401 d->itemToServer.clear();
00402 for ( KPIM::LdapClient* client = mLdapClientList.first(); client; client = mLdapClientList.next() )
00403 client->startQuery( filter );
00404
00405 saveSettings();
00406 }
00407
00408 void LDAPSearchDialog::slotStopSearch()
00409 {
00410 cancelQuery();
00411 slotSearchDone();
00412 }
00413
00414 void LDAPSearchDialog::slotSearchDone()
00415 {
00416
00417 for ( KPIM::LdapClient* client = mLdapClientList.first(); client; client = mLdapClientList.next() ) {
00418 if ( client->isActive() )
00419 return;
00420 }
00421
00422 disconnect( mSearchButton, SIGNAL( clicked() ),
00423 this, SLOT( slotStopSearch() ) );
00424 connect( mSearchButton, SIGNAL( clicked() ),
00425 this, SLOT( slotStartSearch() ) );
00426
00427 mSearchButton->setText( i18n( "&Search" ) );
00428 QApplication::restoreOverrideCursor();
00429 }
00430
00431 void LDAPSearchDialog::slotError( const QString& error )
00432 {
00433 QApplication::restoreOverrideCursor();
00434 KMessageBox::error( this, error );
00435 }
00436
00437 void LDAPSearchDialog::closeEvent( QCloseEvent* e )
00438 {
00439 slotStopSearch();
00440 e->accept();
00441 }
00442
00447 QString LDAPSearchDialog::selectedEMails() const
00448 {
00449 QStringList result;
00450 ContactListItem* cli = static_cast<ContactListItem*>( mResultListView->firstChild() );
00451 while ( cli ) {
00452 if ( cli->isSelected() ) {
00453 QString email = asUtf8( cli->mAttrs[ "mail" ].first() ).stripWhiteSpace();
00454 if ( !email.isEmpty() ) {
00455 QString name = asUtf8( cli->mAttrs[ "cn" ].first() ).stripWhiteSpace();
00456 if ( name.isEmpty() ) {
00457 result << email;
00458 } else {
00459 result << name + " <" + email + ">";
00460 }
00461 }
00462 }
00463 cli = static_cast<ContactListItem*>( cli->nextSibling() );
00464 }
00465
00466 return result.join( ", " );
00467 }
00468
00469 void LDAPSearchDialog::slotHelp()
00470 {
00471 kapp->invokeHelp( "ldap-queries" );
00472 }
00473
00474 void LDAPSearchDialog::slotUnselectAll()
00475 {
00476 mResultListView->selectAll( false );
00477 }
00478
00479 void LDAPSearchDialog::slotSelectAll()
00480 {
00481 mResultListView->selectAll( true );
00482 }
00483
00484 KABC::Addressee LDAPSearchDialog::convertLdapAttributesToAddressee( const KPIM::LdapAttrMap& attrs )
00485 {
00486 KABC::Addressee addr;
00487
00488
00489 addr.setNameFromString( asUtf8( attrs["cn"].first() ) );
00490
00491
00492 KPIM::LdapAttrValue lst = attrs["mail"];
00493 KPIM::LdapAttrValue::ConstIterator it = lst.begin();
00494 bool pref = true;
00495 if ( it != lst.end() ) {
00496 addr.insertEmail( asUtf8( *it ), pref );
00497 pref = false;
00498 ++it;
00499 }
00500
00501 addr.setOrganization( asUtf8( attrs[ "o" ].first() ) );
00502 if ( addr.organization().isEmpty() )
00503 addr.setOrganization( asUtf8( attrs[ "Company" ].first() ) );
00504
00505 addr.insertCustom("KADDRESSBOOK", "X-Department", asUtf8( attrs[ "department" ].first() ) );
00506
00507
00508 KABC::Address workAddr( KABC::Address::Work );
00509
00510 workAddr.setStreet( asUtf8( attrs[ "street" ].first()) );
00511 workAddr.setLocality( asUtf8( attrs[ "l" ].first()) );
00512 workAddr.setRegion( asUtf8( attrs[ "st" ].first()));
00513 workAddr.setPostalCode( asUtf8( attrs[ "postalCode" ].first()) );
00514 workAddr.setCountry( asUtf8( attrs[ "co" ].first()) );
00515
00516 if ( !workAddr.isEmpty() )
00517 addr.insertAddress( workAddr );
00518
00519
00520 KABC::PhoneNumber homeNr = asUtf8( attrs[ "homePhone" ].first() );
00521 homeNr.setType( KABC::PhoneNumber::Home );
00522 addr.insertPhoneNumber( homeNr );
00523
00524 KABC::PhoneNumber workNr = asUtf8( attrs[ "telephoneNumber" ].first() );
00525 workNr.setType( KABC::PhoneNumber::Work );
00526 addr.insertPhoneNumber( workNr );
00527
00528 KABC::PhoneNumber faxNr = asUtf8( attrs[ "facsimileTelephoneNumber" ].first() );
00529 faxNr.setType( KABC::PhoneNumber::Fax );
00530 addr.insertPhoneNumber( faxNr );
00531
00532 KABC::PhoneNumber cellNr = asUtf8( attrs[ "mobile" ].first() );
00533 cellNr.setType( KABC::PhoneNumber::Cell );
00534 addr.insertPhoneNumber( cellNr );
00535
00536 KABC::PhoneNumber pagerNr = asUtf8( attrs[ "pager" ].first() );
00537 pagerNr.setType( KABC::PhoneNumber::Pager );
00538 addr.insertPhoneNumber( pagerNr );
00539 return addr;
00540 }
00541
00542 #ifdef KDEPIM_NEW_DISTRLISTS
00543 KPIM::DistributionList LDAPSearchDialog::selectDistributionList()
00544 {
00545 QGuardedPtr<KPIM::DistributionListPickerDialog> picker = new KPIM::DistributionListPickerDialog( mCore->addressBook(), this );
00546 picker->setLabelText( i18n( "Select a distribution list to add the selected contacts to." ) );
00547 picker->setCaption( i18n( "Select Distribution List" ) );
00548 picker->exec();
00549 const KPIM::DistributionList list = KPIM::DistributionList::findByName( mCore->addressBook(), picker
00550 ? picker->selectedDistributionList() : QString() );
00551 delete picker;
00552 return list;
00553 }
00554 #endif
00555
00556 KABC::Addressee::List LDAPSearchDialog::importContactsUnlessTheyExist( const QValueList<ContactListItem*>& selectedItems,
00557 KABC::Resource * const resource )
00558 {
00559 const QDateTime now = QDateTime::currentDateTime();
00560 QStringList importedAddrs;
00561 KABC::Addressee::List localAddrs;
00562
00563 KABLock::self( mCore->addressBook() )->lock( resource );
00564
00565 for ( QValueList<ContactListItem*>::ConstIterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
00566 const ContactListItem * const cli = *it;
00567 KABC::Addressee addr = convertLdapAttributesToAddressee( cli->mAttrs );
00568 const KABC::Addressee::List existing = mCore->addressBook()->findByEmail( addr.preferredEmail() );
00569
00570 if ( existing.isEmpty() ) {
00571 addr.setUid( KApplication::randomString( 10 ) );
00572 addr.setNote( i18n( "arguments are host name, datetime", "Imported from LDAP directory %1 on %2" ).arg( d->itemToServer[cli], KGlobal::locale()->formatDateTime( now ) ) );
00573 addr.setResource( resource );
00574 mCore->addressBook()->insertAddressee( addr );
00575 importedAddrs.append( addr.fullEmail() );
00576 localAddrs.append( addr );
00577 } else {
00578 localAddrs.append( existing.first() );
00579 }
00580 }
00581 KABLock::self( mCore->addressBook() )->unlock( resource );
00582 if ( !importedAddrs.isEmpty() ) {
00583 KMessageBox::informationList( this, i18n( "The following contact was imported into your address book:",
00584 "The following %n contacts were imported into your address book:", importedAddrs.count() ),
00585 importedAddrs );
00586 emit addresseesAdded();
00587 }
00588 return localAddrs;
00589 }
00590
00591 void LDAPSearchDialog::slotUser2()
00592 {
00593 #ifdef KDEPIM_NEW_DISTRLISTS
00594 KABC::Resource *resource = mCore->requestResource( this );
00595 if ( !resource ) return;
00596
00597 const QValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
00598 if ( selectedItems.isEmpty() ) {
00599 KMessageBox::information( this, i18n( "Please select the contacts you want to add to the distribution list." ), i18n( "No Contacts Selected" ) );
00600 return;
00601 }
00602 KPIM::DistributionList dist = selectDistributionList();
00603 if ( dist.isEmpty() )
00604 return;
00605
00606
00607 KABC::Addressee::List localAddrs = importContactsUnlessTheyExist( selectedItems, resource );
00608
00609 if ( localAddrs.isEmpty() )
00610 return;
00611
00612 for ( KABC::Addressee::List::ConstIterator it = localAddrs.begin(); it != localAddrs.end(); ++it ) {
00613 dist.insertEntry( *it, QString() );
00614 }
00615 KABLock::self( mCore->addressBook() )->lock( resource );
00616 mCore->addressBook()->insertAddressee( dist );
00617 KABLock::self( mCore->addressBook() )->unlock( resource );
00618 emit addresseesAdded();
00619 #endif
00620 }
00621
00622 void LDAPSearchDialog::slotUser1()
00623 {
00624 KABC::Resource *resource = mCore->requestResource( this );
00625 if ( !resource ) return;
00626 const QValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
00627 importContactsUnlessTheyExist( selectedItems, resource );
00628 }
00629
00630 #include "ldapsearchdialog.moc"