kaddressbook

ldapsearchdialog.h

00001 /* ldapsearchdialogimpl.h - LDAP access
00002  *      Copyright (C) 2002 Klar�lvdalens Datakonsult AB
00003  *
00004  *      Author: Steffen Hansen <hansen@kde.org>
00005  *
00006  * This file is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This file is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #ifndef LDAPSEARCHDIALOG_H
00022 #define LDAPSEARCHDIALOG_H
00023 
00024 #include "config.h"
00025 
00026 #include <tqptrlist.h>
00027 
00028 #include <kabc/addressbook.h>
00029 #include <ldapclient.h>
00030 #include <kdialogbase.h>
00031 
00032 #ifdef KDEPIM_NEW_DISTRLISTS
00033 #include <libkdepim/distributionlist.h>
00034 #endif
00035 
00036 class KAddressBookTableView;
00037 class KComboBox;
00038 class KLineEdit;
00039 
00040 class TQCheckBox;
00041 class TQListView;
00042 class TQPushButton;
00043 class KABCore;
00044 class ContactListItem;
00045 
00046 namespace KABC {
00047     class Resource;
00048 }
00049 
00050 class LDAPSearchDialog : public KDialogBase
00051 {
00052   Q_OBJECT
00053 
00054   public:
00055     LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core, TQWidget* parent, const char* name = 0 );
00056     ~LDAPSearchDialog();
00057 
00058     bool isOK() const { return mIsOK; }
00059 
00060     void restoreSettings();
00061 
00062   signals:
00063     void addresseesAdded();
00064 
00065   protected slots:
00066     void slotAddResult( const KPIM::LdapObject& obj );
00067     void slotSetScope( bool rec );
00068     void slotStartSearch();
00069     void slotStopSearch();
00070     void slotSearchDone();
00071     void slotError( const TQString& );
00072     virtual void slotHelp();
00073     virtual void slotUser1();
00074     virtual void slotUser2();
00075     void slotSelectAll();
00076     void slotUnselectAll();
00082     KABC::Addressee::List importContactsUnlessTheyExist( const TQValueList<ContactListItem*>& items, KABC::Resource * const resource );
00083 
00084   protected:
00085     TQString selectedEMails() const;
00086 
00087     virtual void closeEvent( TQCloseEvent* );
00088 
00089   private:
00090     void saveSettings();
00091     static KABC::Addressee convertLdapAttributesToAddressee( const KPIM::LdapAttrMap& attrs );
00092 #ifdef KDEPIM_NEW_DISTRLISTS
00093     KPIM::DistributionList selectDistributionList();
00094 #endif
00095 
00096     TQString makeFilter( const TQString& query, const TQString& attr, bool startsWith );
00097 
00098     void cancelQuery();
00099 
00100     int mNumHosts;
00101     TQPtrList<KPIM::LdapClient> mLdapClientList;
00102     bool mIsOK;
00103     KABC::AddressBook *mAddressBook;
00104     KABCore *mCore;
00105 
00106     KComboBox* mFilterCombo;
00107     KComboBox* mSearchType;
00108     KLineEdit* mSearchEdit;
00109 
00110     TQCheckBox* mRecursiveCheckbox;
00111     TQListView* mResultListView;
00112     TQPushButton* mSearchButton;
00113     class Private;
00114     Private* const d;
00115 };
00116 
00117 #endif