diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
commit | aa3a1ca934bc541bddd3fa136a85f106f7da266e (patch) | |
tree | 9ad0b795aed8fa4ac30c2fe0fd1aacb8175714c0 /kuser/kuserldap.cpp | |
parent | b10cf7066791a2f362495890cd50c984e8025412 (diff) | |
download | tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.tar.gz tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kuser/kuserldap.cpp')
-rw-r--r-- | kuser/kuserldap.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/kuser/kuserldap.cpp b/kuser/kuserldap.cpp index 9eb6afe..9555cb5 100644 --- a/kuser/kuserldap.cpp +++ b/kuser/kuserldap.cpp @@ -16,7 +16,7 @@ * Boston, MA 02110-1301, USA. **/ -#include <qstring.h> +#include <tqstring.h> #include <kdebug.h> #include <kmdcodec.h> @@ -81,12 +81,12 @@ void KUserLDAP::result( KIO::Job *job ) delete mProg; mCancel = false; if ( job->error() ) { - QString errstr = job->errorString(); + TQString errstr = job->errorString(); if ( !errstr.isEmpty() ) { if ( ldif.isEmpty() ) KMessageBox::error( 0, errstr ); else - KMessageBox::detailedError( 0, errstr, QString::fromUtf8( ldif, ldif.size()-1 ) ); + KMessageBox::detailedError( 0, errstr, TQString::fromUtf8( ldif, ldif.size()-1 ) ); } mOk = false; } else { @@ -94,7 +94,7 @@ void KUserLDAP::result( KIO::Job *job ) } } -void KUserLDAP::data( KIO::Job *, const QByteArray& data ) +void KUserLDAP::data( KIO::Job *, const TQByteArray& data ) { if ( data.size() ) { mParser.setLDIF( data ); @@ -103,15 +103,15 @@ void KUserLDAP::data( KIO::Job *, const QByteArray& data ) } KABC::LDIF::ParseVal ret; - QString name, val; - QByteArray value; + TQString name, val; + TQByteArray value; do { ret = mParser.nextItem(); switch ( ret ) { case KABC::LDIF::Item: name = mParser.attr().lower(); value = mParser.val(); - val = QString::fromUtf8( value, value.size() ); + val = TQString::fromUtf8( value, value.size() ); if ( name == "objectclass" ) { if ( val.lower() == "posixaccount" ) mUser->setCaps( mUser->getCaps() | KU::KUser::Cap_POSIX ); @@ -144,8 +144,8 @@ void KUserLDAP::data( KIO::Job *, const QByteArray& data ) else mUser->setOffice2( val ); } else if ( name == "gecos" ) { - QString name, f1, f2, f3; - parseGecos( QCString( value.data(), value.size()+1 ), name, f1, f2, f3 ); + TQString name, f1, f2, f3; + parseGecos( TQCString( value.data(), value.size()+1 ), name, f1, f2, f3 ); if ( mUser->getFullName().isEmpty() ) mUser->setFullName( val ); if ( mUser->getOffice1().isEmpty() ) mUser->setOffice1( f1 ); if ( mUser->getOffice2().isEmpty() ) mUser->setOffice2( f1 ); @@ -248,10 +248,10 @@ bool KUserLDAP::reload() ldif = ""; KIO::Job *job = KIO::get( mUrl, true, false ); - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - this, SLOT( data( KIO::Job*, const QByteArray& ) ) ); - connect( job, SIGNAL( result( KIO::Job* ) ), - this, SLOT( result( KIO::Job* ) ) ); + connect( job, TQT_SIGNAL( data( KIO::Job*, const TQByteArray& ) ), + this, TQT_SLOT( data( KIO::Job*, const TQByteArray& ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job* ) ), + this, TQT_SLOT( result( KIO::Job* ) ) ); // job->addMetaData( "SERVER_CTRL0", "1.2.840.113556.1.4.473 true: uidNumber"); mProg->exec(); if ( mCancel ) job->kill(); @@ -259,15 +259,15 @@ bool KUserLDAP::reload() return( mOk ); } -QString KUserLDAP::getRDN(KU::KUser *user) +TQString KUserLDAP::getRDN(KU::KUser *user) { switch ( mCfg->ldapuserrdn() ) { case KUserPrefsBase::EnumLdapuserrdn::uid: return "uid=" + user->getName(); case KUserPrefsBase::EnumLdapuserrdn::uidNumber: - return "uidNumber=" + QString::number( user->getUID() ); + return "uidNumber=" + TQString::number( user->getUID() ); case KUserPrefsBase::EnumLdapuserrdn::cn: { - QString cn = mCfg->ldapcnfullname() ? user->getFullName() : user->getName(); + TQString cn = mCfg->ldapcnfullname() ? user->getFullName() : user->getName(); if ( cn.isEmpty() ) cn = user->getName(); return "cn=" + cn; } @@ -275,7 +275,7 @@ QString KUserLDAP::getRDN(KU::KUser *user) return ""; } -void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) +void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) { switch ( mCfg->ldappasswordhash() ) { case KUserPrefsBase::EnumLdappasswordhash::Clear: @@ -290,10 +290,10 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) break; } case KUserPrefsBase::EnumLdappasswordhash::SMD5: { - QCString salt = genSalt( 4 ); - QCString pwd = password.utf8() + salt; + TQCString salt = genSalt( 4 ); + TQCString pwd = password.utf8() + salt; KMD5::Digest digest; - QByteArray hash(20); + TQByteArray hash(20); KMD5 md5( pwd ); md5.rawDigest( digest ); @@ -304,7 +304,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) } case KUserPrefsBase::EnumLdappasswordhash::SHA: { struct sha1_ctx ctx; - QByteArray hash(20); + TQByteArray hash(20); sha1_init( &ctx ); sha1_update( &ctx, (const Q_UINT8*) password.utf8().data(), @@ -315,9 +315,9 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) } case KUserPrefsBase::EnumLdappasswordhash::SSHA: { struct sha1_ctx ctx; - QByteArray hash(24); - QCString salt = genSalt( 4 ); - QCString pwd = password.utf8() + salt; + TQByteArray hash(24); + TQCString salt = genSalt( 4 ); + TQCString pwd = password.utf8() + salt; sha1_init( &ctx ); sha1_update( &ctx, (const Q_UINT8*) pwd.data(), pwd.length() ); @@ -331,7 +331,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) if ( caps & Cap_Samba ) { Q_UINT8 hex[33]; - QByteArray ntlmhash; + TQByteArray ntlmhash; ntlmhash = KNTLM::ntlmHash( password ); unsigned char *hash = (unsigned char*) ntlmhash.data(); @@ -341,11 +341,11 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); - user->setNTPwd( QString::fromLatin1( (const char*) &hex, 32 ) ); + user->setNTPwd( TQString::fromLatin1( (const char*) &hex, 32 ) ); if ( mCfg->lanmanhash() ) { - QByteArray lmhash; + TQByteArray lmhash; lmhash = KNTLM::lmHash( password ); unsigned char *hash = (unsigned char*) lmhash.data(); snprintf( (char*) &hex, 33, @@ -354,7 +354,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); - user->setLMPwd( QString::fromLatin1( (const char*) &hex, 32 ) ); + user->setLMPwd( TQString::fromLatin1( (const char*) &hex, 32 ) ); } else { user->setLMPwd( "" ); } @@ -363,7 +363,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const QString &password ) void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) { - QString gecos, cn, pwd, samflags; + TQString gecos, cn, pwd, samflags; ldif.resize( 0 ); pwd = user->getPwd(); @@ -372,7 +372,7 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) cn = mCfg->ldapcnfullname() ? user->getFullName() : user->getName(); if ( cn.isEmpty() ) cn = user->getName(); - gecos = QString::fromLatin1("%1,%2,%3,%4") + gecos = TQString::fromLatin1("%1,%2,%3,%4") .arg(user->getFullName()) .arg(user->getOffice1()) .arg(user->getOffice2()) @@ -385,8 +385,8 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) ldif = ""; if ( mod ) { - QString oldrdn = getRDN( mUser ); - QString newrdn = getRDN( user ); + TQString oldrdn = getRDN( mUser ); + TQString newrdn = getRDN( user ); if ( oldrdn != newrdn ) { ldif = "dn: " + oldrdn.utf8() + "," + mUrl.dn().utf8() + "\n" + @@ -417,9 +417,9 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) ldif += "objectClass: sambaSamAccount\n"; } if ( mod && mObjectClasses.contains( mUser ) ) { - QStringList ocs = mObjectClasses[ mUser ]; + TQStringList ocs = mObjectClasses[ mUser ]; kdDebug() << user->getName() << " has additional objectclasses: " << ocs.join(",") << endl; - QValueListIterator<QString> it; + TQValueListIterator<TQString> it; for ( it = ocs.begin(); it != ocs.end(); ++it ) { ldif += "objectClass: "; ldif += (*it).utf8(); @@ -447,13 +447,13 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) if ( user->getCaps() & KU::KUser::Cap_POSIX ) { if ( mod ) ldif += "replace: uidnumber\n"; ldif += KABC::LDIF::assembleLine( "uidnumber", - QString::number( user->getUID() ) )+"\n"; + TQString::number( user->getUID() ) )+"\n"; if ( mod ) ldif += "-\nreplace: gidnumber\n"; ldif += KABC::LDIF::assembleLine( "gidnumber", - QString::number( user->getGID() ) )+"\n"; + TQString::number( user->getGID() ) )+"\n"; if ( mod ) ldif += "-\nreplace: gecos\n"; - ldif += KABC::LDIF::assembleLine( "gecos", !mCfg->ldapgecos() ? QCString() : - QCString( gecos.latin1() ) )+"\n"; + ldif += KABC::LDIF::assembleLine( "gecos", !mCfg->ldapgecos() ? TQCString() : + TQCString( gecos.latin1() ) )+"\n"; if ( mod ) ldif += "-\nreplace: homedirectory\n"; ldif += KABC::LDIF::assembleLine( "homedirectory", user->getHomeDir() )+"\n"; @@ -514,11 +514,11 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) user->getPGSID().getSID() ) + "\n"; if ( mod ) ldif += "-\nreplace: sambapwdlastset\n"; ldif += KABC::LDIF::assembleLine( "sambapwdlastset", - QString::number( user->getLastChange() ) ) + "\n"; + TQString::number( user->getLastChange() ) ) + "\n"; if ( mod ) ldif += "-\nreplace: sambakickofftime\n"; if ( user->getExpire() != -1 ) ldif += KABC::LDIF::assembleLine( "sambakickofftime", - QString::number( user->getExpire() ) ) + "\n"; + TQString::number( user->getExpire() ) ) + "\n"; if ( mod ) ldif += "-\n"; } else { if ( mod ) { @@ -556,25 +556,25 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) if ( user->getCaps() & KU::KUser::Cap_POSIX ) { if ( mod ) ldif += "replace: shadowlastchange\n"; //sambapwdlastset ldif += KABC::LDIF::assembleLine( "shadowlastchange", - QString::number( timeToDays( user->getLastChange() ) ) ) + "\n"; + TQString::number( timeToDays( user->getLastChange() ) ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowmin\n"; //sambaPwdCanChange ldif += KABC::LDIF::assembleLine( "shadowmin", - QString::number( user->getMin() ) ) + "\n"; + TQString::number( user->getMin() ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowmax\n"; //sambaPwdMustChange ldif += KABC::LDIF::assembleLine( "shadowmax", - QString::number( user->getMax() ) ) + "\n"; + TQString::number( user->getMax() ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowwarning\n"; ldif += KABC::LDIF::assembleLine( "shadowwarning", - QString::number( user->getWarn() ) ) + "\n"; + TQString::number( user->getWarn() ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowinactive\n"; ldif += KABC::LDIF::assembleLine( "shadowinactive", - QString::number( user->getInactive() ) ) + "\n"; + TQString::number( user->getInactive() ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowexpire\n"; //sambaKickoffTime ldif += KABC::LDIF::assembleLine( "shadowexpire", - QString::number( timeToDays( user->getExpire() ) ) ) + "\n"; + TQString::number( timeToDays( user->getExpire() ) ) ) + "\n"; if ( mod ) ldif += "-\nreplace: shadowflag\n"; ldif += KABC::LDIF::assembleLine( "shadowflag", - QString::number( user->getFlag() ) ) + "\n"; + TQString::number( user->getFlag() ) ) + "\n"; if ( mod ) ldif += "-\n"; } else { if ( mod ) { @@ -610,15 +610,15 @@ bool KUserLDAP::dbcommit() mProg = new KProgressDialog( 0, "", i18n("LDAP Operation"), "", true ); KIO::Job *job = KIO::put( mUrl, -1, false, false, false ); - connect( job, SIGNAL( dataReq( KIO::Job*, QByteArray& ) ), - this, SLOT( putData( KIO::Job*, QByteArray& ) ) ); - connect( job, SIGNAL( result( KIO::Job* ) ), - this, SLOT( result( KIO::Job* ) ) ); + connect( job, TQT_SIGNAL( dataReq( KIO::Job*, TQByteArray& ) ), + this, TQT_SLOT( putData( KIO::Job*, TQByteArray& ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job* ) ), + this, TQT_SLOT( result( KIO::Job* ) ) ); mProg->exec(); return( mOk ); } -void KUserLDAP::putData( KIO::Job *, QByteArray& data ) +void KUserLDAP::putData( KIO::Job *, TQByteArray& data ) { ModIt mit = mMod.begin(); |