From kde-commits Mon Jul 07 07:10:14 2008 From: Pradeepto Bhattacharya Date: Mon, 07 Jul 2008 07:10:14 +0000 To: kde-commits Subject: branches/KDE/3.5/kdepim Message-Id: <1215414614.232512.9688.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121541463111431 SVN commit 828990 by pradeepto: Merged revisions 817568 via svnmerge from svn+ssh://pradeepto@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim ........ r817568 | pradeepto | 2008-06-06 15:16:13 +0530 (Fri, 06 Jun 2008) | 4 lines -- kolab/issue2741 - Button to do an ldap lookup is missing from the address selection dialog. Forward port from proko2 r592933, r597516 and some manual fixing. ........ _M . (directory) M +37 -0 kmail/recipientspicker.cpp M +10 -2 kmail/recipientspicker.h M +1 -1 libkdepim/Makefile.am M +38 -1 libkdepim/addressesdialog.cpp M +2 -0 libkdepim/addressesdialog.h M +26 -13 libkdepim/addresspicker.ui M +2 -1 libkdepim/ldapclient.h ** branches/KDE/3.5/kdepim #property svnmerge-integrated - /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-767946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-772316,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007,778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,779507-779852,779854-779994,782647-783127,783129-783243,783245,783248-783477,783479-783847,784547,787827 + /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-767946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-772316,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007,778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,779507-779852,779854-779994,782647-783127,783129-783243,783245,783248-783477,783479-783847,784547,787827,817568 --- branches/KDE/3.5/kdepim/kmail/recipientspicker.cpp #828989:828990 @@ -24,7 +24,10 @@ #include "globalsettings.h" #include +#include +#include + #ifndef KDEPIM_NEW_DISTRLISTS #include #endif @@ -396,6 +399,10 @@ label->setBuddy( label ); connect( mSearchLine, SIGNAL( downPressed() ), SLOT( setFocusList() ) ); + mSearchLDAPButton = new QPushButton( i18n("Search &Directory Service"), this ); + searchLayout->addWidget( mSearchLDAPButton ); + connect( mSearchLDAPButton, SIGNAL( clicked() ), SLOT( slotSearchLDAP() ) ); + QBoxLayout *buttonLayout = new QHBoxLayout( topLayout ); buttonLayout->addStretch( 1 ); @@ -833,4 +840,34 @@ mSearchLine->setText( QString::null ); } +void RecipientsPicker::slotSearchLDAP() +{ + if ( !ldapSearchDialog ) { + ldapSearchDialog = new KPIM::LDAPSearchDialog( this ); + connect( ldapSearchDialog, SIGNAL( addresseesAdded() ), + SLOT(ldapSearchResult() ) ); + } + ldapSearchDialog->show(); + +} + +void RecipientsPicker::ldapSearchResult() +{ + kdDebug() << k_funcinfo ; + + QStringList emails = QStringList::split(',', ldapSearchDialog->selectedEMails() ); + QStringList::iterator it( emails.begin() ); + QStringList::iterator end( emails.end() ); + for ( ; it != end; ++it ){ + QString name; + QString email; + KPIM::getNameAndMail( (*it), name, email ); + KABC::Addressee ad; + ad.setNameFromString( name ); + ad.insertEmail( email ); + //addAddresseeToSelected( ad, selectedToItem() ); + } + +} + #include "recipientspicker.moc" --- branches/KDE/3.5/kdepim/kmail/recipientspicker.h #828989:828990 @@ -45,6 +45,10 @@ } #endif +namespace KPIM { +class LDAPSearchDialog; +} + class RecipientItem { public: @@ -213,7 +217,8 @@ void setFocusList(); void resetSearch(); void insertAddressBook( AddressBook * ); - + void slotSearchLDAP(); + void ldapSearchResult(); private: KABC::StdAddressBook *mAddressBook; @@ -224,7 +229,10 @@ QPushButton *mToButton; QPushButton *mCcButton; QPushButton *mBccButton; - + + QPushButton *mSearchLDAPButton; + KPIM::LDAPSearchDialog *ldapSearchDialog; + QMap mCollectionMap; RecipientsCollection *mAllRecipients; RecipientsCollection *mDistributionLists; --- branches/KDE/3.5/kdepim/libkdepim/Makefile.am #828989:828990 @@ -23,7 +23,7 @@ overlaywidget.cpp progressmanager.cpp progressdialog.cpp \ statusbarprogresswidget.cpp ssllabel.cpp completionordereditor.cpp \ resourceabc.cpp diffalgo.cpp addresseediffalgo.cpp calendardiffalgo.cpp \ - htmldiffalgodisplay.cpp broadcaststatus.cpp kresourceprefs.cpp \ + htmldiffalgodisplay.cpp ldapsearchdialog.cpp broadcaststatus.cpp kresourceprefs.cpp \ kpixmapregionselectorwidget.cpp kpixmapregionselectordialog.cpp \ kabcresourcecached.cpp kxface.cpp \ kaccount.cpp kaddrbook.cpp kfoldertree.cpp kregexp3.cpp \ --- branches/KDE/3.5/kdepim/libkdepim/addressesdialog.cpp #828989:828990 @@ -24,9 +24,12 @@ #include "addressesdialog.h" #include "addresspicker.h" +#include "ldapsearchdialog.h" #include +#include + #ifdef KDEPIM_NEW_DISTRLISTS #include "distributionlist.h" #include @@ -64,7 +67,10 @@ }; struct AddressesDialog::AddressesDialogPrivate { - AddressesDialogPrivate() : ui(0), personal(0), recent(0), toItem(0), ccItem(0), bccItem(0) + AddressesDialogPrivate() : + ui(0), personal(0), recent(0), + toItem(0), ccItem(0), bccItem(0), + ldapSearchDialog(0) {} AddressPickerUI *ui; @@ -79,6 +85,7 @@ QDict groupDict; KABC::Addressee::List recentAddresses; + LDAPSearchDialog *ldapSearchDialog; }; // privates end @@ -565,6 +572,8 @@ SLOT(addSelectedBCC()) ); connect( d->ui->mSaveAs, SIGNAL(clicked()), SLOT(saveAs()) ); + connect( d->ui->mLdapSearch, SIGNAL(clicked()), + SLOT(searchLdap()) ); connect( d->ui->mRemoveButton, SIGNAL(clicked()), SLOT(removeEntry()) ); connect( d->ui->mAvailableView, SIGNAL(selectionChanged()), @@ -928,6 +937,34 @@ } void +AddressesDialog::searchLdap() +{ + if ( !d->ldapSearchDialog ) { + d->ldapSearchDialog = new LDAPSearchDialog( this ); + connect( d->ldapSearchDialog, SIGNAL( addresseesAdded() ), + SLOT(ldapSearchResult() ) ); + } + d->ldapSearchDialog->show(); +} + +void +AddressesDialog::ldapSearchResult() +{ + QStringList emails = QStringList::split(',', d->ldapSearchDialog->selectedEMails() ); + QStringList::iterator it( emails.begin() ); + QStringList::iterator end( emails.end() ); + for ( ; it != end; ++it ){ + QString name; + QString email; + KPIM::getNameAndMail( (*it), name, email ); + KABC::Addressee ad; + ad.setNameFromString( name ); + ad.insertEmail( email ); + addAddresseeToSelected( ad, selectedToItem() ); + } +} + +void AddressesDialog::launchAddressBook() { kapp->startServiceByDesktopName( "kaddressbook", QString() ); --- branches/KDE/3.5/kdepim/libkdepim/addressesdialog.h #828989:828990 @@ -169,6 +169,8 @@ void removeEntry(); void saveAs(); + void searchLdap(); + void ldapSearchResult(); void launchAddressBook(); void filterChanged( const QString & ); --- branches/KDE/3.5/kdepim/libkdepim/addresspicker.ui #828989:828990 @@ -1,4 +1,4 @@ - + AddressPickerUI @@ -9,7 +9,7 @@ 0 0 591 - 350 + 442 @@ -169,17 +169,6 @@ - - - mSaveAs - - - false - - - Save as &Distribution List... - - textLabel2 @@ -300,8 +289,32 @@ true + + + mSaveAs + + + false + + + Save as &Distribution List... + + + Alt+D + + + + + mLdapSearch + + + &Search Directory Service + + + + klistview.h --- branches/KDE/3.5/kdepim/libkdepim/ldapclient.h #828989:828990 @@ -1,5 +1,5 @@ /* kldapclient.h - LDAP access - * Copyright (C) 2002 Klarälvdalens Datakonsult AB + * Copyright (C) 2002 Klar�vdalens Datakonsult AB * * Author: Steffen Hansen * @@ -33,6 +33,7 @@ #include #include +#include #include