kaddressbook

ldapsearchdialog.h
1 /* ldapsearchdialogimpl.h - LDAP access
2  * Copyright (C) 2002 Klarälvdalens Datakonsult AB
3  *
4  * Author: Steffen Hansen <hansen@kde.org>
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This file is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef LDAPSEARCHDIALOG_H
22 #define LDAPSEARCHDIALOG_H
23 
24 #include "config.h"
25 
26 #include <tqptrlist.h>
27 
28 #include <tdeabc/addressbook.h>
29 #include <ldapclient.h>
30 #include <kdialogbase.h>
31 
32 #ifdef TDEPIM_NEW_DISTRLISTS
33 #include <libtdepim/distributionlist.h>
34 #endif
35 
37 class KComboBox;
38 class KLineEdit;
39 
40 class TQCheckBox;
41 class TQListView;
42 class TQPushButton;
43 class KABCore;
44 class ContactListItem;
45 
46 namespace TDEABC {
47  class Resource;
48 }
49 
50 class LDAPSearchDialog : public KDialogBase
51 {
52  TQ_OBJECT
53 
54 
55  public:
56  LDAPSearchDialog( TDEABC::AddressBook *ab, KABCore *core, TQWidget* parent, const char* name = 0 );
57  ~LDAPSearchDialog();
58 
59  bool isOK() const { return mIsOK; }
60 
61  void restoreSettings();
62 
63  signals:
64  void addresseesAdded();
65 
66  protected slots:
67  void slotAddResult( const KPIM::LdapObject& obj );
68  void slotSetScope( bool rec );
69  void slotStartSearch();
70  void slotStopSearch();
71  void slotSearchDone();
72  void slotError( const TQString& );
73  virtual void slotHelp();
74  virtual void slotUser1();
75  virtual void slotUser2();
76  void slotSelectAll();
77  void slotUnselectAll();
83  TDEABC::Addressee::List importContactsUnlessTheyExist( const TQValueList<ContactListItem*>& items, TDEABC::Resource * const resource );
84 
85  protected:
86  TQString selectedEMails() const;
87 
88  virtual void closeEvent( TQCloseEvent* );
89 
90  private:
91  void saveSettings();
92  static TDEABC::Addressee convertLdapAttributesToAddressee( const KPIM::LdapAttrMap& attrs );
93 #ifdef TDEPIM_NEW_DISTRLISTS
94  KPIM::DistributionList selectDistributionList();
95 #endif
96 
97  TQString makeFilter( const TQString& query, const TQString& attr, bool startsWith );
98 
99  void cancelQuery();
100 
101  int mNumHosts;
102  TQPtrList<KPIM::LdapClient> mLdapClientList;
103  bool mIsOK;
104  TDEABC::AddressBook *mAddressBook;
105  KABCore *mCore;
106 
107  KComboBox* mFilterCombo;
108  KComboBox* mSearchType;
109  KLineEdit* mSearchEdit;
110 
111  TQCheckBox* mRecursiveCheckbox;
112  TQListView* mResultListView;
113  TQPushButton* mSearchButton;
114  class Private;
115  Private* const d;
116 };
117 
118 #endif
This class is the table view for kaddressbook.