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   TQ_OBJECT
00054 
00055   public:
00056     LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core, TQWidget* parent, const char* name = 0 );
00057     ~LDAPSearchDialog();
00058 
00059     bool isOK() const { return mIsOK; }
00060 
00061     void restoreSettings();
00062 
00063   signals:
00064     void addresseesAdded();
00065 
00066   protected slots:
00067     void slotAddResult( const KPIM::LdapObject& obj );
00068     void slotSetScope( bool rec );
00069     void slotStartSearch();
00070     void slotStopSearch();
00071     void slotSearchDone();
00072     void slotError( const TQString& );
00073     virtual void slotHelp();
00074     virtual void slotUser1();
00075     virtual void slotUser2();
00076     void slotSelectAll();
00077     void slotUnselectAll();
00083     KABC::Addressee::List importContactsUnlessTheyExist( const TQValueList<ContactListItem*>& items, KABC::Resource * const resource );
00084 
00085   protected:
00086     TQString selectedEMails() const;
00087 
00088     virtual void closeEvent( TQCloseEvent* );
00089 
00090   private:
00091     void saveSettings();
00092     static KABC::Addressee convertLdapAttributesToAddressee( const KPIM::LdapAttrMap& attrs );
00093 #ifdef KDEPIM_NEW_DISTRLISTS
00094     KPIM::DistributionList selectDistributionList();
00095 #endif
00096 
00097     TQString makeFilter( const TQString& query, const TQString& attr, bool startsWith );
00098 
00099     void cancelQuery();
00100 
00101     int mNumHosts;
00102     TQPtrList<KPIM::LdapClient> mLdapClientList;
00103     bool mIsOK;
00104     KABC::AddressBook *mAddressBook;
00105     KABCore *mCore;
00106 
00107     KComboBox* mFilterCombo;
00108     KComboBox* mSearchType;
00109     KLineEdit* mSearchEdit;
00110 
00111     TQCheckBox* mRecursiveCheckbox;
00112     TQListView* mResultListView;
00113     TQPushButton* mSearchButton;
00114     class Private;
00115     Private* const d;
00116 };
00117 
00118 #endif