• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
ldapclient.h
1/* kldapclient.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
22#ifndef KABC_LDAPCLIENT_H
23#define KABC_LDAPCLIENT_H
24
25
26#include <tqobject.h>
27#include <tqstring.h>
28#include <tqcstring.h>
29#include <tqstringlist.h>
30#include <tqmemarray.h>
31#include <tqguardedptr.h>
32#include <tqtimer.h>
33
34#include <tdeio/job.h>
35
36namespace TDEABC {
37
38class LdapClient;
39typedef TQValueList<TQByteArray> LdapAttrValue;
40typedef TQMap<TQString,LdapAttrValue > LdapAttrMap;
41
49class KABC_EXPORT LdapObject
50{
51 public:
52 LdapObject()
53 : dn( TQString::null ), client( 0 ) {}
54 explicit LdapObject( const TQString& _dn, LdapClient* _cl ) : dn( _dn ), client( _cl ) {}
55 LdapObject( const LdapObject& that ) { assign( that ); }
56
57 LdapObject& operator=( const LdapObject& that )
58 {
59 assign( that );
60 return *this;
61 }
62
63 TQString toString() const;
64
65 void clear();
66
67 TQString dn;
68 LdapAttrMap attrs;
69 LdapClient* client;
70
71 protected:
72 void assign( const LdapObject& that );
73
74 private:
75 //class LdapObjectPrivate* d;
76};
77
85class KABC_EXPORT LdapClient : public TQObject
86{
87 TQ_OBJECT
88
89 public:
90 LdapClient( TQObject* parent = 0, const char* name = 0 );
91 virtual ~LdapClient();
92
94 bool isActive() const { return mActive; }
95
96 signals:
98 void done();
99
101 void error( const TQString& );
102
106 void result( const TDEABC::LdapObject& );
107
108 public slots:
112 void setHost( const TQString& host );
113 TQString host() const { return mHost; }
114
119 void setPort( const TQString& port );
120 TQString port() const { return mPort; }
121
125 void setBase( const TQString& base );
126 TQString base() const { return mBase; }
127
131 void setBindDN( const TQString& bindDN );
132 TQString bindDN() const;
133
137 void setPwdBindDN( const TQString& pwdBindDN );
138 TQString pwdBindDN() const;
139
144 void setAttrs( const TQStringList& attrs );
145 TQStringList attrs() const { return mAttrs; }
146
147 void setScope( const TQString scope ) { mScope = scope; }
148
152 void startQuery( const TQString& filter );
153
157 void cancelQuery();
158
159 protected slots:
160 void slotData( TDEIO::Job*, const TQByteArray &data );
161 void slotInfoMessage( TDEIO::Job*, const TQString &info );
162 void slotDone();
163
164 protected:
165 void startParseLDIF();
166 void parseLDIF( const TQByteArray& data );
167 void endParseLDIF();
168
169 TQString mHost;
170 TQString mPort;
171 TQString mBase;
172 TQString mScope;
173 TQStringList mAttrs;
174
175 TQGuardedPtr<TDEIO::SimpleJob> mJob;
176 bool mActive;
177
178 LdapObject mCurrentObject;
179 TQCString mBuf;
180 TQCString mLastAttrName;
181 TQCString mLastAttrValue;
182 bool mIsBase64;
183
184 private:
185 class LdapClientPrivate;
186 LdapClientPrivate* d;
187};
188
192struct LdapResult {
193 TQString name;
194 TQString email;
195 int clientNumber;
196};
197typedef TQValueList<LdapResult> LdapResultList;
198
199
207class KABC_EXPORT LdapSearch : public TQObject
208{
209 TQ_OBJECT
210
211 public:
212 LdapSearch();
213
214 void startSearch( const TQString& txt );
215 void cancelSearch();
216 bool isAvailable() const;
217
218 signals:
221 void searchData( const TQStringList& );
224 void searchData( const TDEABC::LdapResultList& );
225 void searchDone();
226
227 private slots:
228 void slotLDAPResult( const TDEABC::LdapObject& );
229 void slotLDAPError( const TQString& );
230 void slotLDAPDone();
231 void slotDataTimer();
232
233 private:
234 void finish();
235 void makeSearchData( TQStringList& ret, LdapResultList& resList );
236 TQValueList< LdapClient* > mClients;
237 TQString mSearchText;
238 TQTimer mDataTimer;
239 int mActiveClients;
240 bool mNoLDAPLookup;
241 TQValueList< LdapObject > mResults;
242
243 private:
244 class LdapSearchPrivate* d;
245};
246
247}
248#endif // KABC_LDAPCLIENT_H
TDEABC::LdapClient
This class is internal.
Definition: ldapclient.h:86
TDEABC::LdapClient::error
void error(const TQString &)
TDEABC::LdapClient::result
void result(const TDEABC::LdapObject &)
TDEABC::LdapClient::done
void done()
TDEABC::LdapClient::isActive
bool isActive() const
Definition: ldapclient.h:94
TDEABC::LdapObject
This class is internal.
Definition: ldapclient.h:50
TDEABC::LdapSearch
This class is internal.
Definition: ldapclient.h:208
TDEABC::LdapSearch::searchData
void searchData(const TQStringList &)
Results, assembled as "Full Name <email>" (This signal can be emitted many times)
TDEABC::LdapSearch::searchData
void searchData(const TDEABC::LdapResultList &)
Another form for the results, with separate fields (This signal can be emitted many times)
TDEABC
static data, shared by ALL addressee objects
Definition: address.h:48
TDEABC::LdapResult
Structure describing one result returned by a LDAP query.
Definition: ldapclient.h:192
TDEABC::LdapResult::clientNumber
int clientNumber
for sorting
Definition: ldapclient.h:195
TDEABC::LdapResult::email
TQString email
email
Definition: ldapclient.h:194
TDEABC::LdapResult::name
TQString name
full name
Definition: ldapclient.h:193

tdeabc

Skip menu "tdeabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.4
This website is maintained by Timothy Pearson.