22 #include <tqstringlist.h>
35 :
KURL(_url), m_extensions()
38 if ( !TQDir::isRelativePath(m_dn) )
50 if ( !TQDir::isRelativePath(m_dn) )
61 return m_extensions.contains( key );
66 TQMap<TQString, Extension>::const_iterator it;
68 it = m_extensions.find( key );
69 if ( it != m_extensions.constEnd() )
84 critical = ext.critical;
90 m_extensions[ key ] = ext;
98 ext.critical = critical;
104 m_extensions.remove( key );
111 TQMap<TQString, Extension>::iterator it;
115 if ( m_attributes.count() > 0 ) q += m_attributes.join(
",");
133 if ( m_filter !=
"(objectClass=*)" && !m_filter.isEmpty() )
138 for ( it = m_extensions.begin(); it != m_extensions.end(); ++it ) {
139 if ( it.data().critical ) q +=
"!";
141 if ( !it.data().value.isEmpty() )
142 q +=
"=" + it.data().value;
145 while ( q.endsWith(
"?") || q.endsWith(
",") )
146 q.remove( q.length() - 1, 1 );
152 void LDAPUrl::parseQuery()
155 TQStringList extensions;
156 TQString q =
query();
158 if (q.startsWith(
"?"))
162 TQStringList url_items = TQStringList::split(
"?", q,
true);
164 m_attributes.clear();
166 m_filter =
"(objectClass=*)";
167 m_extensions.clear();
170 for ( TQStringList::Iterator it = url_items.begin(); it != url_items.end(); ++it, i++ ) {
173 m_attributes = TQStringList::split(
",", (*it),
false);
176 if ( (*it) ==
"sub" ) m_scope = Sub;
else
177 if ( (*it) ==
"one") m_scope = One;
183 extensions = TQStringList::split(
",", (*it),
false);
189 for ( TQStringList::Iterator it = extensions.begin(); it != extensions.end(); ++it ) {
190 ext.critical =
false;
193 if ( name.startsWith(
"!") ) {
197 kdDebug(5700) <<
"LDAPUrl extensions name= " << name <<
" value: " << value <<
endl;
198 ext.value = value.replace(
"%2",
"," );
void setQuery(const TQString &_txt, int encoding_hint=0)
kdbgstream kdDebug(int area=0)
void setExtension(const TQString &key, const Extension &ext)
Sets the specified extension key with the value and criticality in ext.
static data, shared by ALL addressee objects
bool hasExtension(const TQString &key) const
Returns if the specified extension exists in the LDAP Url.
void setPath(const TQString &path)
const TQString & dn() const
Returns the dn part of the LDAP Url (same as path(), but slash removed from the beginning).
static TQString decode_string(const TQString &str, int encoding_hint=0)
Extension extension(const TQString &key) const
Returns the specified extension.
void removeExtension(const TQString &key)
Removes the specified extension.
kndbgstream & endl(kndbgstream &s)
void updateQuery()
Updates the query component from the attributes, scope, filter and extensions.
LDAPUrl()
Constructs an empty KLDAPUrl.
TQString name(StdAccel id)
void setDn(const TQString &dn)
Sets the the dn part of the LDAP Url.
TQString prettyURL(int _trailing=0) const