summaryrefslogtreecommitdiffstats
path: root/libkdepim/ldapclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdepim/ldapclient.cpp')
-rw-r--r--libkdepim/ldapclient.cpp186
1 files changed, 93 insertions, 93 deletions
diff --git a/libkdepim/ldapclient.cpp b/libkdepim/ldapclient.cpp
index 34e8044f..359e0356 100644
--- a/libkdepim/ldapclient.cpp
+++ b/libkdepim/ldapclient.cpp
@@ -22,12 +22,12 @@
-#include <qfile.h>
-#include <qimage.h>
-#include <qlabel.h>
-#include <qpixmap.h>
-#include <qtextstream.h>
-#include <qurl.h>
+#include <tqfile.h>
+#include <tqimage.h>
+#include <tqlabel.h>
+#include <tqpixmap.h>
+#include <tqtextstream.h>
+#include <tqurl.h>
#include <kabc/ldapurl.h>
#include <kabc/ldif.h>
@@ -47,13 +47,13 @@ using namespace KPIM;
KConfig *KPIM::LdapSearch::s_config = 0L;
static KStaticDeleter<KConfig> configDeleter;
-QString LdapObject::toString() const
+TQString LdapObject::toString() const
{
- QString result = QString::fromLatin1( "\ndn: %1\n" ).arg( dn );
+ TQString result = TQString::fromLatin1( "\ndn: %1\n" ).arg( dn );
for ( LdapAttrMap::ConstIterator it = attrs.begin(); it != attrs.end(); ++it ) {
- QString attr = it.key();
+ TQString attr = it.key();
for ( LdapAttrValue::ConstIterator it2 = (*it).begin(); it2 != (*it).end(); ++it2 ) {
- result += QString::fromUtf8( KABC::LDIF::assembleLine( attr, *it2, 76 ) ) + "\n";
+ result += TQString::fromUtf8( KABC::LDIF::assembleLine( attr, *it2, 76 ) ) + "\n";
}
}
@@ -62,8 +62,8 @@ QString LdapObject::toString() const
void LdapObject::clear()
{
- dn = QString::null;
- objectClass = QString::null;
+ dn = TQString::null;
+ objectClass = TQString::null;
attrs.clear();
}
@@ -76,8 +76,8 @@ void LdapObject::assign( const LdapObject& that )
}
}
-LdapClient::LdapClient( int clientNumber, QObject* parent, const char* name )
- : QObject( parent, name ), mJob( 0 ), mActive( false ), mReportObjectClass( false )
+LdapClient::LdapClient( int clientNumber, TQObject* parent, const char* name )
+ : TQObject( parent, name ), mJob( 0 ), mActive( false ), mReportObjectClass( false )
{
// d = new LdapClientPrivate;
mClientNumber = clientNumber;
@@ -90,10 +90,10 @@ LdapClient::~LdapClient()
// delete d; d = 0;
}
-void LdapClient::setAttrs( const QStringList& attrs )
+void LdapClient::setAttrs( const TQStringList& attrs )
{
mAttrs = attrs;
- for ( QStringList::Iterator it = mAttrs.begin(); it != mAttrs.end(); ++it )
+ for ( TQStringList::Iterator it = mAttrs.begin(); it != mAttrs.end(); ++it )
if( (*it).lower() == "objectclass" ){
mReportObjectClass = true;
return;
@@ -102,7 +102,7 @@ void LdapClient::setAttrs( const QStringList& attrs )
mReportObjectClass = false;
}
-void LdapClient::startQuery( const QString& filter )
+void LdapClient::startQuery( const TQString& filter )
{
cancelQuery();
KABC::LDAPUrl url;
@@ -114,7 +114,7 @@ void LdapClient::startQuery( const QString& filter )
}
url.setHost( mServer.host() );
url.setPort( mServer.port() );
- url.setExtension( "x-ver", QString::number( mServer.version() ) );
+ url.setExtension( "x-ver", TQString::number( mServer.version() ) );
url.setDn( mServer.baseDN() );
url.setDn( mServer.baseDN() );
if ( mServer.security() == LdapServer::TLS ) url.setExtension( "x-tls","" );
@@ -124,9 +124,9 @@ void LdapClient::startQuery( const QString& filter )
if ( !mServer.mech().isEmpty() ) url.setExtension( "x-mech", mServer.mech() );
}
if ( mServer.timeLimit() != 0 ) url.setExtension( "x-timelimit",
- QString::number( mServer.timeLimit() ) );
+ TQString::number( mServer.timeLimit() ) );
if ( mServer.sizeLimit() != 0 ) url.setExtension( "x-sizelimit",
- QString::number( mServer.sizeLimit() ) );
+ TQString::number( mServer.sizeLimit() ) );
url.setAttributes( mAttrs );
url.setScope( mScope == "one" ? KABC::LDAPUrl::One : KABC::LDAPUrl::Sub );
@@ -137,12 +137,12 @@ void LdapClient::startQuery( const QString& filter )
startParseLDIF();
mActive = true;
mJob = KIO::get( url, false, false );
- connect( mJob, SIGNAL( data( KIO::Job*, const QByteArray& ) ),
- this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) );
- connect( mJob, SIGNAL( infoMessage( KIO::Job*, const QString& ) ),
- this, SLOT( slotInfoMessage( KIO::Job*, const QString& ) ) );
- connect( mJob, SIGNAL( result( KIO::Job* ) ),
- this, SLOT( slotDone() ) );
+ connect( mJob, TQT_SIGNAL( data( KIO::Job*, const TQByteArray& ) ),
+ this, TQT_SLOT( slotData( KIO::Job*, const TQByteArray& ) ) );
+ connect( mJob, TQT_SIGNAL( infoMessage( KIO::Job*, const TQString& ) ),
+ this, TQT_SLOT( slotInfoMessage( KIO::Job*, const TQString& ) ) );
+ connect( mJob, TQT_SIGNAL( result( KIO::Job* ) ),
+ this, TQT_SLOT( slotDone() ) );
}
void LdapClient::cancelQuery()
@@ -155,12 +155,12 @@ void LdapClient::cancelQuery()
mActive = false;
}
-void LdapClient::slotData( KIO::Job*, const QByteArray& data )
+void LdapClient::slotData( KIO::Job*, const TQByteArray& data )
{
parseLDIF( data );
}
-void LdapClient::slotInfoMessage( KIO::Job*, const QString & )
+void LdapClient::slotInfoMessage( KIO::Job*, const TQString & )
{
//qDebug("Job said \"%s\"", info.latin1());
}
@@ -170,7 +170,7 @@ void LdapClient::slotDone()
endParseLDIF();
mActive = false;
#if 0
- for ( QValueList<LdapObject>::Iterator it = mObjects.begin(); it != mObjects.end(); ++it ) {
+ for ( TQValueList<LdapObject>::Iterator it = mObjects.begin(); it != mObjects.end(); ++it ) {
qDebug( (*it).toString().latin1() );
}
#endif
@@ -194,14 +194,14 @@ void LdapClient::endParseLDIF()
void LdapClient::finishCurrentObject()
{
mCurrentObject.dn = mLdif.dn();
- const QString sClass( mCurrentObject.objectClass.lower() );
+ const TQString sClass( mCurrentObject.objectClass.lower() );
if( sClass == "groupofnames" || sClass == "kolabgroupofnames" ){
LdapAttrMap::ConstIterator it = mCurrentObject.attrs.find("mail");
if( it == mCurrentObject.attrs.end() ){
// No explicit mail address found so far?
// Fine, then we use the address stored in the DN.
- QString sMail;
- QStringList lMail = QStringList::split(",dc=", mCurrentObject.dn);
+ TQString sMail;
+ TQStringList lMail = TQStringList::split(",dc=", mCurrentObject.dn);
const int n = lMail.count();
if( n ){
if( lMail.first().lower().startsWith("cn=") ){
@@ -223,9 +223,9 @@ void LdapClient::finishCurrentObject()
mCurrentObject.clear();
}
-void LdapClient::parseLDIF( const QByteArray& data )
+void LdapClient::parseLDIF( const TQByteArray& data )
{
- //kdDebug(5300) << "LdapClient::parseLDIF( " << QCString(data.data(), data.size()+1) << " )" << endl;
+ //kdDebug(5300) << "LdapClient::parseLDIF( " << TQCString(data.data(), data.size()+1) << " )" << endl;
if ( data.size() ) {
mLdif.setLDIF( data );
} else {
@@ -233,21 +233,21 @@ void LdapClient::parseLDIF( const QByteArray& data )
}
KABC::LDIF::ParseVal ret;
- QString name;
+ TQString name;
do {
ret = mLdif.nextItem();
switch ( ret ) {
case KABC::LDIF::Item:
{
name = mLdif.attr();
- // Must make a copy! QByteArray is explicitely shared
- QByteArray value = mLdif.val().copy();
+ // Must make a copy! TQByteArray is explicitely shared
+ TQByteArray value = mLdif.val().copy();
bool bIsObjectClass = name.lower() == "objectclass";
if( bIsObjectClass )
- mCurrentObject.objectClass = QString::fromUtf8( value, value.size() );
+ mCurrentObject.objectClass = TQString::fromUtf8( value, value.size() );
if( mReportObjectClass || !bIsObjectClass )
mCurrentObject.attrs[ name ].append( value );
- //kdDebug(5300) << "LdapClient::parseLDIF(): name=" << name << " value=" << QCString(value.data(), value.size()+1) << endl;
+ //kdDebug(5300) << "LdapClient::parseLDIF(): name=" << name << " value=" << TQCString(value.data(), value.size()+1) << endl;
}
break;
case KABC::LDIF::EndEntry:
@@ -276,55 +276,55 @@ void LdapClient::setCompletionWeight( int weight )
void LdapSearch::readConfig( LdapServer &server, KConfig *config, int j, bool active )
{
- QString prefix;
+ TQString prefix;
if ( active ) prefix = "Selected";
- QString host = config->readEntry( prefix + QString( "Host%1" ).arg( j ), "" ).stripWhiteSpace();
+ TQString host = config->readEntry( prefix + TQString( "Host%1" ).arg( j ), "" ).stripWhiteSpace();
if ( !host.isEmpty() )
server.setHost( host );
- int port = config->readNumEntry( prefix + QString( "Port%1" ).arg( j ), 389 );
+ int port = config->readNumEntry( prefix + TQString( "Port%1" ).arg( j ), 389 );
server.setPort( port );
- QString base = config->readEntry( prefix + QString( "Base%1" ).arg( j ), "" ).stripWhiteSpace();
+ TQString base = config->readEntry( prefix + TQString( "Base%1" ).arg( j ), "" ).stripWhiteSpace();
if ( !base.isEmpty() )
server.setBaseDN( base );
- QString user = config->readEntry( prefix + QString( "User%1" ).arg( j ) ).stripWhiteSpace();
+ TQString user = config->readEntry( prefix + TQString( "User%1" ).arg( j ) ).stripWhiteSpace();
if ( !user.isEmpty() )
server.setUser( user );
- QString bindDN = config->readEntry( prefix + QString( "Bind%1" ).arg( j ) ).stripWhiteSpace();
+ TQString bindDN = config->readEntry( prefix + TQString( "Bind%1" ).arg( j ) ).stripWhiteSpace();
if ( !bindDN.isEmpty() )
server.setBindDN( bindDN );
- QString pwdBindDN = config->readEntry( prefix + QString( "PwdBind%1" ).arg( j ) );
+ TQString pwdBindDN = config->readEntry( prefix + TQString( "PwdBind%1" ).arg( j ) );
if ( !pwdBindDN.isEmpty() )
server.setPwdBindDN( pwdBindDN );
- server.setTimeLimit( config->readNumEntry( prefix + QString( "TimeLimit%1" ).arg( j ) ) );
- server.setSizeLimit( config->readNumEntry( prefix + QString( "SizeLimit%1" ).arg( j ) ) );
- server.setVersion( config->readNumEntry( prefix + QString( "Version%1" ).arg( j ), 3 ) );
- server.setSecurity( config->readNumEntry( prefix + QString( "Security%1" ).arg( j ) ) );
- server.setAuth( config->readNumEntry( prefix + QString( "Auth%1" ).arg( j ) ) );
- server.setMech( config->readEntry( prefix + QString( "Mech%1" ).arg( j ) ) );
+ server.setTimeLimit( config->readNumEntry( prefix + TQString( "TimeLimit%1" ).arg( j ) ) );
+ server.setSizeLimit( config->readNumEntry( prefix + TQString( "SizeLimit%1" ).arg( j ) ) );
+ server.setVersion( config->readNumEntry( prefix + TQString( "Version%1" ).arg( j ), 3 ) );
+ server.setSecurity( config->readNumEntry( prefix + TQString( "Security%1" ).arg( j ) ) );
+ server.setAuth( config->readNumEntry( prefix + TQString( "Auth%1" ).arg( j ) ) );
+ server.setMech( config->readEntry( prefix + TQString( "Mech%1" ).arg( j ) ) );
}
void LdapSearch::writeConfig( const LdapServer &server, KConfig *config, int j, bool active )
{
- QString prefix;
+ TQString prefix;
if ( active ) prefix = "Selected";
- config->writeEntry( prefix + QString( "Host%1" ).arg( j ), server.host() );
- config->writeEntry( prefix + QString( "Port%1" ).arg( j ), server.port() );
- config->writeEntry( prefix + QString( "Base%1" ).arg( j ), server.baseDN() );
- config->writeEntry( prefix + QString( "User%1" ).arg( j ), server.user() );
- config->writeEntry( prefix + QString( "Bind%1" ).arg( j ), server.bindDN() );
- config->writeEntry( prefix + QString( "PwdBind%1" ).arg( j ), server.pwdBindDN() );
- config->writeEntry( prefix + QString( "TimeLimit%1" ).arg( j ), server.timeLimit() );
- config->writeEntry( prefix + QString( "SizeLimit%1" ).arg( j ), server.sizeLimit() );
- config->writeEntry( prefix + QString( "Version%1" ).arg( j ), server.version() );
- config->writeEntry( prefix + QString( "Security%1" ).arg( j ), server.security() );
- config->writeEntry( prefix + QString( "Auth%1" ).arg( j ), server.auth() );
- config->writeEntry( prefix + QString( "Mech%1" ).arg( j ), server.mech() );
+ config->writeEntry( prefix + TQString( "Host%1" ).arg( j ), server.host() );
+ config->writeEntry( prefix + TQString( "Port%1" ).arg( j ), server.port() );
+ config->writeEntry( prefix + TQString( "Base%1" ).arg( j ), server.baseDN() );
+ config->writeEntry( prefix + TQString( "User%1" ).arg( j ), server.user() );
+ config->writeEntry( prefix + TQString( "Bind%1" ).arg( j ), server.bindDN() );
+ config->writeEntry( prefix + TQString( "PwdBind%1" ).arg( j ), server.pwdBindDN() );
+ config->writeEntry( prefix + TQString( "TimeLimit%1" ).arg( j ), server.timeLimit() );
+ config->writeEntry( prefix + TQString( "SizeLimit%1" ).arg( j ), server.sizeLimit() );
+ config->writeEntry( prefix + TQString( "Version%1" ).arg( j ), server.version() );
+ config->writeEntry( prefix + TQString( "Security%1" ).arg( j ), server.security() );
+ config->writeEntry( prefix + TQString( "Auth%1" ).arg( j ), server.auth() );
+ config->writeEntry( prefix + TQString( "Mech%1" ).arg( j ), server.mech() );
}
KConfig* LdapSearch::config()
@@ -345,14 +345,14 @@ LdapSearch::LdapSearch()
}
readConfig();
- connect(KDirWatch::self(), SIGNAL(dirty (const QString&)),this,
- SLOT(slotFileChanged(const QString&)));
+ connect(KDirWatch::self(), TQT_SIGNAL(dirty (const TQString&)),this,
+ TQT_SLOT(slotFileChanged(const TQString&)));
}
void LdapSearch::readConfig()
{
cancelSearch();
- QValueList< LdapClient* >::Iterator it;
+ TQValueList< LdapClient* >::Iterator it;
for ( it = mClients.begin(); it != mClients.end(); ++it )
delete *it;
mClients.clear();
@@ -371,38 +371,38 @@ void LdapSearch::readConfig()
if ( !server.host().isEmpty() ) mNoLDAPLookup = false;
ldapClient->setServer( server );
- int completionWeight = config->readNumEntry( QString( "SelectedCompletionWeight%1" ).arg( j ), -1 );
+ int completionWeight = config->readNumEntry( TQString( "SelectedCompletionWeight%1" ).arg( j ), -1 );
if ( completionWeight != -1 )
ldapClient->setCompletionWeight( completionWeight );
- QStringList attrs;
+ TQStringList attrs;
// note: we need "objectClass" to detect distribution lists
attrs << "cn" << "mail" << "givenname" << "sn" << "objectClass";
ldapClient->setAttrs( attrs );
- connect( ldapClient, SIGNAL( result( const KPIM::LdapObject& ) ),
- this, SLOT( slotLDAPResult( const KPIM::LdapObject& ) ) );
- connect( ldapClient, SIGNAL( done() ),
- this, SLOT( slotLDAPDone() ) );
- connect( ldapClient, SIGNAL( error( const QString& ) ),
- this, SLOT( slotLDAPError( const QString& ) ) );
+ connect( ldapClient, TQT_SIGNAL( result( const KPIM::LdapObject& ) ),
+ this, TQT_SLOT( slotLDAPResult( const KPIM::LdapObject& ) ) );
+ connect( ldapClient, TQT_SIGNAL( done() ),
+ this, TQT_SLOT( slotLDAPDone() ) );
+ connect( ldapClient, TQT_SIGNAL( error( const TQString& ) ),
+ this, TQT_SLOT( slotLDAPError( const TQString& ) ) );
mClients.append( ldapClient );
}
- connect( &mDataTimer, SIGNAL( timeout() ), SLOT( slotDataTimer() ) );
+ connect( &mDataTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotDataTimer() ) );
}
mConfigFile = locateLocal( "config", "kabldaprc" );
KDirWatch::self()->addFile( mConfigFile );
}
-void LdapSearch::slotFileChanged( const QString& file )
+void LdapSearch::slotFileChanged( const TQString& file )
{
if ( file == mConfigFile )
readConfig();
}
-void LdapSearch::startSearch( const QString& txt )
+void LdapSearch::startSearch( const TQString& txt )
{
if ( mNoLDAPLookup )
return;
@@ -427,10 +427,10 @@ void LdapSearch::startSearch( const QString& txt )
* This allows both resource accounts with an email address which are not a person and
* person entries without an email address to show up, while still not showing things
* like structural entries in the ldap tree. */
- QString filter = QString( "&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))(|(cn=%1*)(mail=%2*)(mail=*@%3*)(givenName=%4*)(sn=%5*))" )
+ TQString filter = TQString( "&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))(|(cn=%1*)(mail=%2*)(mail=*@%3*)(givenName=%4*)(sn=%5*))" )
.arg( mSearchText ).arg( mSearchText ).arg( mSearchText ).arg( mSearchText ).arg( mSearchText );
- QValueList< LdapClient* >::Iterator it;
+ TQValueList< LdapClient* >::Iterator it;
for ( it = mClients.begin(); it != mClients.end(); ++it ) {
(*it)->startQuery( filter );
kdDebug(5300) << "LdapSearch::startSearch() " << filter << endl;
@@ -440,7 +440,7 @@ void LdapSearch::startSearch( const QString& txt )
void LdapSearch::cancelSearch()
{
- QValueList< LdapClient* >::Iterator it;
+ TQValueList< LdapClient* >::Iterator it;
for ( it = mClients.begin(); it != mClients.end(); ++it )
(*it)->cancelQuery();
@@ -455,7 +455,7 @@ void LdapSearch::slotLDAPResult( const KPIM::LdapObject& obj )
mDataTimer.start( 500, true );
}
-void LdapSearch::slotLDAPError( const QString& )
+void LdapSearch::slotLDAPError( const TQString& )
{
slotLDAPDone();
}
@@ -470,7 +470,7 @@ void LdapSearch::slotLDAPDone()
void LdapSearch::slotDataTimer()
{
- QStringList lst;
+ TQStringList lst;
LdapResultList reslist;
makeSearchData( lst, reslist );
if ( !lst.isEmpty() )
@@ -487,14 +487,14 @@ void LdapSearch::finish()
emit searchDone();
}
-void LdapSearch::makeSearchData( QStringList& ret, LdapResultList& resList )
+void LdapSearch::makeSearchData( TQStringList& ret, LdapResultList& resList )
{
- QString search_text_upper = mSearchText.upper();
+ TQString search_text_upper = mSearchText.upper();
- QValueList< KPIM::LdapObject >::ConstIterator it1;
+ TQValueList< KPIM::LdapObject >::ConstIterator it1;
for ( it1 = mResults.begin(); it1 != mResults.end(); ++it1 ) {
- QString name, mail, givenname, sn;
- QStringList mails;
+ TQString name, mail, givenname, sn;
+ TQStringList mails;
bool isDistributionList = false;
bool wasCN = false;
bool wasDC = false;
@@ -503,11 +503,11 @@ void LdapSearch::makeSearchData( QStringList& ret, LdapResultList& resList )
LdapAttrMap::ConstIterator it2;
for ( it2 = (*it1).attrs.begin(); it2 != (*it1).attrs.end(); ++it2 ) {
- QByteArray val = (*it2).first();
+ TQByteArray val = (*it2).first();
int len = val.size();
if( len > 0 && '\0' == val[len-1] )
--len;
- const QString tmp = QString::fromUtf8( val, len );
+ const TQString tmp = TQString::fromUtf8( val, len );
kdDebug(5300) << " key: \"" << it2.key() << "\" value: \"" << tmp << "\"" << endl;
if ( it2.key() == "cn" ) {
name = tmp;
@@ -536,7 +536,7 @@ void LdapSearch::makeSearchData( QStringList& ret, LdapResultList& resList )
mail = tmp;
LdapAttrValue::ConstIterator it3 = it2.data().begin();
for ( ; it3 != it2.data().end(); ++it3 ) {
- mails.append( QString::fromUtf8( (*it3).data(), (*it3).size() ) );
+ mails.append( TQString::fromUtf8( (*it3).data(), (*it3).size() ) );
}
} else if( it2.key() == "givenName" )
givenname = tmp;
@@ -576,7 +576,7 @@ void LdapSearch::makeSearchData( QStringList& ret, LdapResultList& resList )
ret.append( mail );
} else {
kdDebug(5300) << "LdapSearch::makeSearchData() name: \"" << name << "\" mail: \"" << mail << "\"" << endl;
- ret.append( QString( "%1 <%2>" ).arg( name ).arg( mail ) );
+ ret.append( TQString( "%1 <%2>" ).arg( name ).arg( mail ) );
}
LdapResult sr;