22 #include "resourceldapkio.h"
23 #include "resourceldapkioconfig.h"
25 #include "kldap/ldif.h"
26 #include "kldap/ldapdn.h"
27 #include "kldap/ldapurl.h"
29 #include <kio/netaccess.h>
30 #include <kio/udsentry.h>
34 #include <kstandarddirs.h>
35 #include <klineedit.h>
36 #include <klocalizedstring.h>
38 #include <kstringhandler.h>
39 #include <ktemporaryfile.h>
41 #include <QtCore/QBuffer>
42 #include <QtCore/QEventLoop>
43 #include <QtCore/QFile>
49 class ResourceLDAPKIO::Private
52 Private( ResourceLDAPKIO *parent )
53 : mParent( parent ), mPort( 389 ), mAnonymous( true ), mTLS( false ),
54 mSSL( false ), mSubTree( false ), mSASL( false ), mVer( 3 ),
55 mRDNPrefix( 0 ), mTimeLimit( 0 ), mSizeLimit( 0 ),
56 mCachePolicy( Cache_No ), mAutoCache( true )
58 KGlobal::locale()->insertCatalog(
QLatin1String(
"libkldap" ) );
61 KIO::TransferJob *loadFromCache();
69 ResourceLDAPKIO *mParent;
82 bool mTLS, mSSL, mSubTree;
86 Resource::Iterator mSaveIt;
90 KLDAP::LdapUrl mLDAPUrl;
100 KTemporaryFile *mTmp;
103 ResourceLDAPKIO::ResourceLDAPKIO()
104 :
Resource(), d( new Private( this ) )
106 d->mCacheDst = KGlobal::dirs()->saveLocation(
"cache",
QLatin1String(
"ldapkio" ) ) +
111 ResourceLDAPKIO::ResourceLDAPKIO(
const KConfigGroup &group )
112 :
Resource( group ), d( new Private( this ) )
116 for (
int pos = 0; pos < attributes.
count(); pos += 2 ) {
117 d->mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] );
120 d->mUser = group.readEntry(
"LdapUser" );
121 d->mPassword = KStringHandler::obscure( group.readEntry(
"LdapPassword" ) );
122 d->mDn = group.readEntry(
"LdapDn" );
123 d->mHost = group.readEntry(
"LdapHost" );
124 d->mPort = group.readEntry(
"LdapPort", 389 );
125 d->mFilter = group.readEntry(
"LdapFilter" );
126 d->mAnonymous = group.readEntry(
"LdapAnonymous",
false );
127 d->mTLS = group.readEntry(
"LdapTLS",
false );
128 d->mSSL = group.readEntry(
"LdapSSL",
false );
129 d->mSubTree = group.readEntry(
"LdapSubTree",
false );
130 d->mSASL = group.readEntry(
"LdapSASL",
false );
131 d->mMech = group.readEntry(
"LdapMech" );
132 d->mRealm = group.readEntry(
"LdapRealm" );
133 d->mBindDN = group.readEntry(
"LdapBindDN" );
134 d->mVer = group.readEntry(
"LdapVer", 3 );
135 d->mTimeLimit = group.readEntry(
"LdapTimeLimit", 0 );
136 d->mSizeLimit = group.readEntry(
"LdapSizeLimit", 0 );
137 d->mRDNPrefix = group.readEntry(
"LdapRDNPrefix", 0 );
138 d->mCachePolicy = group.readEntry(
"LdapCachePolicy", 0 );
139 d->mAutoCache = group.readEntry(
"LdapAutoCache",
true );
140 d->mCacheDst = KGlobal::dirs()->saveLocation(
146 ResourceLDAPKIO::~ResourceLDAPKIO()
151 void ResourceLDAPKIO::Private::enter_loop()
154 mParent->
connect( mParent, SIGNAL(leaveModality()), &eventLoop, SLOT(quit()) );
155 eventLoop.
exec( QEventLoop::ExcludeUserInputEvents );
158 void ResourceLDAPKIO::entries( KIO::Job *,
const KIO::UDSEntryList &list )
160 KIO::UDSEntryList::ConstIterator it = list.begin();
161 KIO::UDSEntryList::ConstIterator end = list.end();
162 for ( ; it != end; ++it ) {
163 const QString urlStr = ( *it ).stringValue( KIO::UDSEntry::UDS_URL );
165 KUrl tmpurl( urlStr );
166 d->mResultDn = tmpurl.path();
167 kDebug() <<
"findUid():" << d->mResultDn;
168 if ( d->mResultDn.startsWith(
QLatin1Char(
'/' ) ) ) {
169 d->mResultDn.remove( 0, 1 );
176 void ResourceLDAPKIO::listResult( KJob *job )
178 d->mError = job->error();
179 if ( d->mError && d->mError != KIO::ERR_USER_CANCELED ) {
180 d->mErrorMsg = job->errorString();
182 d->mErrorMsg.clear();
184 emit leaveModality();
189 KLDAP::LdapUrl url( mLDAPUrl );
200 kDebug() << uid <<
"url" << url.prettyUrl();
202 KIO::ListJob *listJob = KIO::listDir( url, KIO::HideProgressInfo );
203 mParent->connect( listJob, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
204 SLOT(entries(KIO::Job*,KIO::UDSEntryList)) );
205 mParent->connect( listJob, SIGNAL(result(KJob*)),
206 mParent, SLOT(listResult(KJob*)) );
217 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"replace" ), attr ) +
'\n';
220 tmp += KLDAP::Ldif::assembleLine( attr, value ) +
'\n';
239 switch ( mRDNPrefix ) {
265 tmp = KLDAP::Ldif::assembleLine(
QLatin1String(
"dn" ), olddn ) +
'\n';
266 tmp +=
"changetype: modrdn\n";
269 tmp +=
"deleteoldrdn: 1\n\n";
273 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"dn" ), dn ) +
'\n';
275 tmp +=
"changetype: modify\n";
278 tmp +=
"objectClass: top\n";
281 QString::SkipEmptyParts );
283 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"objectClass" ), *it ) +
'\n';
295 tmp += addEntry( mAttributes[
QLatin1String(
"phoneNumber" ) ], number.number(), mod );
297 tmp += addEntry( mAttributes[
QLatin1String(
"telephoneNumber" ) ], number.number(), mod );
299 tmp += addEntry( mAttributes[
QLatin1String(
"facsimileTelephoneNumber" ) ],
300 number.number(), mod );
302 tmp += addEntry( mAttributes[
QLatin1String(
"mobile" ) ], number.number(), mod );
304 tmp += addEntry( mAttributes[
QLatin1String(
"pager" ) ], number.number(), mod );
306 tmp += addEntry( mAttributes[
QLatin1String(
"description" ) ], addr.
note(), mod );
311 if ( !ad.isEmpty() ) {
312 tmp += addEntry( mAttributes[
QLatin1String(
"street" ) ], ad.street(), mod );
313 tmp += addEntry( mAttributes[
QLatin1String(
"state" ) ], ad.region(), mod );
314 tmp += addEntry( mAttributes[
QLatin1String(
"city" ) ], ad.locality(), mod );
315 tmp += addEntry( mAttributes[
QLatin1String(
"postalcode" ) ], ad.postalCode(), mod );
323 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"replace" ),
326 if ( mailIt != emails.
constEnd() ) {
327 tmp += KLDAP::Ldif::assembleLine( mAttributes[
QLatin1String(
"mail" ) ], *mailIt ) +
'\n';
336 if ( !mAttributes[
QLatin1String(
"mailAlias" ) ].isEmpty() ) {
339 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"replace" ),
342 for ( ; mailIt != emails.
constEnd(); ++mailIt ) {
343 tmp += KLDAP::Ldif::assembleLine(
344 mAttributes[
QLatin1String(
"mailAlias" ) ], *mailIt ) +
'\n';
351 if ( !mAttributes[
QLatin1String(
"jpegPhoto" ) ].isEmpty() ) {
354 buffer.open( QIODevice::WriteOnly );
358 tmp += KLDAP::Ldif::assembleLine(
QLatin1String(
"replace" ),
361 tmp += KLDAP::Ldif::assembleLine( mAttributes[
QLatin1String(
"jpegPhoto" ) ], pic, 76 ) +
'\n';
373 void ResourceLDAPKIO::setReadOnly(
bool value )
380 void ResourceLDAPKIO::init()
382 if ( d->mPort == 0 ) {
392 if ( !d->mAttributes.contains(
QLatin1String(
"objectClass" ) ) ) {
395 if ( !d->mAttributes.contains(
QLatin1String(
"commonName" ) ) ) {
398 if ( !d->mAttributes.contains(
QLatin1String(
"formattedName" ) ) ) {
401 if ( !d->mAttributes.contains(
QLatin1String(
"familyName" ) ) ) {
404 if ( !d->mAttributes.contains(
QLatin1String(
"givenName" ) ) ) {
410 if ( !d->mAttributes.contains(
QLatin1String(
"mailAlias" ) ) ) {
413 if ( !d->mAttributes.contains(
QLatin1String(
"phoneNumber" ) ) ) {
416 if ( !d->mAttributes.contains(
QLatin1String(
"telephoneNumber" ) ) ) {
419 if ( !d->mAttributes.contains(
QLatin1String(
"facsimileTelephoneNumber" ) ) ) {
420 d->mAttributes.insert(
QLatin1String(
"facsimileTelephoneNumber" ),
423 if ( !d->mAttributes.contains(
QLatin1String(
"mobile" ) ) ) {
426 if ( !d->mAttributes.contains(
QLatin1String(
"pager" ) ) ) {
429 if ( !d->mAttributes.contains(
QLatin1String(
"description" ) ) ) {
432 if ( !d->mAttributes.contains(
QLatin1String(
"title" ) ) ) {
435 if ( !d->mAttributes.contains(
QLatin1String(
"street" ) ) ) {
438 if ( !d->mAttributes.contains(
QLatin1String(
"state" ) ) ) {
444 if ( !d->mAttributes.contains(
QLatin1String(
"organization" ) ) ) {
447 if ( !d->mAttributes.contains(
QLatin1String(
"postalcode" ) ) ) {
453 if ( !d->mAttributes.contains(
QLatin1String(
"jpegPhoto" ) ) ) {
457 d->mLDAPUrl = KLDAP::LdapUrl( KUrl() );
458 if ( !d->mAnonymous ) {
459 d->mLDAPUrl.setExtension(
QLatin1String(
"bindname" ), d->mBindDN );
460 d->mLDAPUrl.setUser( d->mUser );
461 d->mLDAPUrl.setPass( d->mPassword );
464 d->mLDAPUrl.setHost( d->mHost );
465 d->mLDAPUrl.setPort( d->mPort );
466 d->mLDAPUrl.setDn( KLDAP::LdapDN( d->mDn ) );
468 if ( !d->mAttributes.empty() ) {
471 for ( it = d->mAttributes.
begin(); it != d->mAttributes.
end(); ++it ) {
476 d->mLDAPUrl.setAttributes( attr );
479 d->mLDAPUrl.setScope( d->mSubTree ? KLDAP::LdapUrl::Sub : KLDAP::LdapUrl::One );
480 if ( !d->mFilter.isEmpty() && d->mFilter !=
QLatin1String(
"(objectClass=*)" ) ) {
481 d->mLDAPUrl.setFilter( d->mFilter );
488 if ( d->mSizeLimit ) {
491 if ( d->mTimeLimit ) {
496 if ( !d->mMech.isEmpty() ) {
497 d->mLDAPUrl.setExtension(
QLatin1String(
"x-mech" ), d->mMech );
499 if ( !d->mRealm.isEmpty() ) {
500 d->mLDAPUrl.setExtension(
QLatin1String(
"x-realm" ), d->mRealm );
504 d->mReadOnly = readOnly();
506 kDebug() <<
"resource_ldapkio url:" << d->mLDAPUrl.prettyUrl();
509 void ResourceLDAPKIO::writeConfig( KConfigGroup &group )
513 group.writeEntry(
"LdapUser", d->mUser );
514 group.writeEntry(
"LdapPassword", KStringHandler::obscure( d->mPassword ) );
515 group.writeEntry(
"LdapDn", d->mDn );
516 group.writeEntry(
"LdapHost", d->mHost );
517 group.writeEntry(
"LdapPort", d->mPort );
518 group.writeEntry(
"LdapFilter", d->mFilter );
519 group.writeEntry(
"LdapAnonymous", d->mAnonymous );
520 group.writeEntry(
"LdapTLS", d->mTLS );
521 group.writeEntry(
"LdapSSL", d->mSSL );
522 group.writeEntry(
"LdapSubTree", d->mSubTree );
523 group.writeEntry(
"LdapSASL", d->mSASL );
524 group.writeEntry(
"LdapMech", d->mMech );
525 group.writeEntry(
"LdapVer", d->mVer );
526 group.writeEntry(
"LdapTimeLimit", d->mTimeLimit );
527 group.writeEntry(
"LdapSizeLimit", d->mSizeLimit );
528 group.writeEntry(
"LdapRDNPrefix", d->mRDNPrefix );
529 group.writeEntry(
"LdapRealm", d->mRealm );
530 group.writeEntry(
"LdapBindDN", d->mBindDN );
531 group.writeEntry(
"LdapCachePolicy", d->mCachePolicy );
532 group.writeEntry(
"LdapAutoCache", d->mAutoCache );
537 attributes << it.
key() << it.
value();
540 group.writeEntry(
"LdapAttributes", attributes );
543 Ticket *ResourceLDAPKIO::requestSaveTicket()
545 if ( !addressBook() ) {
546 kDebug() <<
"no addressbook";
550 return createTicket(
this );
553 void ResourceLDAPKIO::releaseSaveTicket(
Ticket *ticket )
558 bool ResourceLDAPKIO::doOpen()
563 void ResourceLDAPKIO::doClose()
567 void ResourceLDAPKIO::Private::createCache()
570 if ( mCachePolicy == Cache_NoConnection && mAutoCache ) {
571 mTmp =
new KTemporaryFile;
572 mTmp->setPrefix( mCacheDst );
578 void ResourceLDAPKIO::Private::activateCache()
580 if ( mTmp && mError == 0 ) {
581 QString filename = mTmp->fileName();
588 KIO::TransferJob *ResourceLDAPKIO::Private::loadFromCache()
590 KIO::TransferJob *job = 0;
591 if ( mCachePolicy == Cache_Always ||
592 ( mCachePolicy == Cache_NoConnection &&
593 mError == KIO::ERR_COULD_NOT_CONNECT ) ) {
598 mLdif.startParsing();
600 mParent->Resource::setReadOnly(
true );
602 KUrl url( mCacheDst );
603 job = KIO::get( url, KIO::Reload, KIO::HideProgressInfo );
604 mParent->connect( job, SIGNAL(data(KIO::Job*,
QByteArray)),
611 bool ResourceLDAPKIO::load()
614 KIO::TransferJob *job;
621 d->mLdif.startParsing();
627 if ( d->mCachePolicy != Cache_Always ) {
628 job = KIO::get( d->mLDAPUrl, KIO::Reload, KIO::HideProgressInfo );
629 connect( job, SIGNAL(data(KIO::Job*,
QByteArray)),
631 connect( job, SIGNAL(result(KJob*)),
632 this, SLOT(syncLoadSaveResult(KJob*)) );
636 job = d->loadFromCache();
638 connect( job, SIGNAL(result(KJob*)),
639 this, SLOT(syncLoadSaveResult(KJob*)) );
642 if ( d->mErrorMsg.isEmpty() ) {
643 kDebug() <<
"ResourceLDAPKIO load ok!";
646 kDebug() <<
"ResourceLDAPKIO load finished with error:" << d->mErrorMsg;
647 addressBook()->error( d->mErrorMsg );
652 bool ResourceLDAPKIO::asyncLoad()
659 d->mLdif.startParsing();
664 if ( d->mCachePolicy != Cache_Always ) {
665 KIO::TransferJob *job = KIO::get( d->mLDAPUrl, KIO::Reload, KIO::HideProgressInfo );
666 connect( job, SIGNAL(data(KIO::Job*,
QByteArray)),
668 connect( job, SIGNAL(result(KJob*)),
669 this, SLOT(result(KJob*)) );
676 void ResourceLDAPKIO::data( KIO::Job *job,
const QByteArray &data )
680 d->mLdif.setLdif( data );
682 d->mTmp->write( data );
688 KLDAP::Ldif::ParseValue ret;
692 ret = d->mLdif.nextItem();
694 case KLDAP::Ldif::NewEntry:
695 kDebug() <<
"new entry:" << d->mLdif.dn().toString();
697 case KLDAP::Ldif::Item:
698 name = d->mLdif.attr().
toLower();
699 value = d->mLdif.value();
700 if ( name == d->mAttributes[
QLatin1String(
"commonName" ) ].toLower() ) {
701 if ( !d->mAddr.formattedName().isEmpty() ) {
702 QString fn = d->mAddr.formattedName();
704 d->mAddr.setFormattedName( fn );
719 d->mAddr.insertPhoneNumber( phone );
720 }
else if ( name == d->mAttributes[
QLatin1String(
"telephoneNumber" ) ].toLower() ) {
723 d->mAddr.insertPhoneNumber( phone );
725 d->mAttributes[
QLatin1String(
"facsimileTelephoneNumber" ) ].toLower() ) {
728 d->mAddr.insertPhoneNumber( phone );
729 }
else if ( name == d->mAttributes[
QLatin1String(
"mobile" ) ].toLower() ) {
732 d->mAddr.insertPhoneNumber( phone );
733 }
else if ( name == d->mAttributes[
QLatin1String(
"pager" ) ].toLower() ) {
736 d->mAddr.insertPhoneNumber( phone );
737 }
else if ( name == d->mAttributes[
QLatin1String(
"description" ) ].toLower() ) {
759 d->mAddr.setPhoto( photo );
764 case KLDAP::Ldif::EndEntry:
766 d->mAddr.setResource(
this );
767 d->mAddr.insertAddress( d->mAd );
768 d->mAddr.setChanged(
false );
769 insertAddressee( d->mAddr );
778 }
while ( ret != KLDAP::Ldif::MoreData );
781 void ResourceLDAPKIO::loadCacheResult( KJob *job )
783 d->mErrorMsg.clear();
784 d->mError = job->error();
785 if ( d->mError && d->mError != KIO::ERR_USER_CANCELED ) {
786 d->mErrorMsg = job->errorString();
788 if ( !d->mErrorMsg.isEmpty() ) {
789 emit loadingError(
this, d->mErrorMsg );
791 emit loadingFinished(
this );
795 void ResourceLDAPKIO::result( KJob *job )
797 d->mErrorMsg.clear();
799 d->mError = job->error();
800 if ( d->mError && d->mError != KIO::ERR_USER_CANCELED ) {
801 d->mErrorMsg = job->errorString();
808 KIO::TransferJob *cjob;
809 cjob = d->loadFromCache();
811 connect( cjob, SIGNAL(result(KJob*)),
812 this, SLOT(loadCacheResult(KJob*)) );
814 if ( !d->mErrorMsg.isEmpty() ) {
815 emit loadingError(
this, d->mErrorMsg );
817 emit loadingFinished(
this );
822 bool ResourceLDAPKIO::save(
Ticket *ticket )
827 d->mSaveIt = begin();
828 KIO::TransferJob *job = KIO::put( d->mLDAPUrl, -1, KIO::Overwrite | KIO::HideProgressInfo );
829 connect( job, SIGNAL(dataReq(KIO::Job*,
QByteArray&)),
830 this, SLOT(saveData(KIO::Job*,
QByteArray&)) );
831 connect( job, SIGNAL(result(KJob*)),
832 this, SLOT(syncLoadSaveResult(KJob*)) );
834 if ( d->mErrorMsg.isEmpty() ) {
835 kDebug() <<
"ResourceLDAPKIO save ok!";
838 kDebug() <<
"ResourceLDAPKIO finished with error:" << d->mErrorMsg;
839 addressBook()->error( d->mErrorMsg );
844 bool ResourceLDAPKIO::asyncSave(
Ticket *ticket )
848 d->mSaveIt = begin();
849 KIO::TransferJob *job = KIO::put( d->mLDAPUrl, -1, KIO::Overwrite | KIO::HideProgressInfo );
850 connect( job, SIGNAL(dataReq(KIO::Job*,
QByteArray&)),
851 this, SLOT(saveData(KIO::Job*,
QByteArray&)) );
852 connect( job, SIGNAL(result(KJob*)),
853 this, SLOT(saveResult(KJob*)) );
857 void ResourceLDAPKIO::syncLoadSaveResult( KJob *job )
859 d->mError = job->error();
860 if ( d->mError && d->mError != KIO::ERR_USER_CANCELED ) {
861 d->mErrorMsg = job->errorString();
863 d->mErrorMsg.clear();
867 emit leaveModality();
870 void ResourceLDAPKIO::saveResult( KJob *job )
872 d->mError = job->error();
873 if ( d->mError && d->mError != KIO::ERR_USER_CANCELED ) {
874 emit savingError(
this, job->errorString() );
876 emit savingFinished(
this );
880 void ResourceLDAPKIO::saveData( KIO::Job *job,
QByteArray &data )
883 while ( d->mSaveIt != end() && !( *d->mSaveIt ).changed() ) {
887 if ( d->mSaveIt == end() ) {
888 kDebug() <<
"ResourceLDAPKIO endData";
893 kDebug() <<
"ResourceLDAPKIO saveData:" << ( *d->mSaveIt ).assembledName();
895 d->AddresseeToLDIF( data, *d->mSaveIt, d->findUid( ( *d->mSaveIt ).uid() ) );
898 ( *d->mSaveIt ).setChanged(
false );
903 void ResourceLDAPKIO::removeAddressee(
const Addressee &addr )
909 if ( !d->mErrorMsg.isEmpty() ) {
910 addressBook()->error( d->mErrorMsg );
914 kDebug() <<
"ResourceLDAPKIO: found uid:" << dn;
915 KLDAP::LdapUrl url( d->mLDAPUrl );
918 url.setScope( KLDAP::LdapUrl::Base );
919 if ( KIO::NetAccess::del( url, 0 ) ) {
920 mAddrMap.remove( addr.
uid() );
924 mAddrMap.remove( addr.
uid() );
928 void ResourceLDAPKIO::setUser(
const QString &user )
933 QString ResourceLDAPKIO::user()
const
938 void ResourceLDAPKIO::setPassword(
const QString &password )
940 d->mPassword = password;
943 QString ResourceLDAPKIO::password()
const
948 void ResourceLDAPKIO::setDn(
const QString &dn )
953 QString ResourceLDAPKIO::dn()
const
958 void ResourceLDAPKIO::setHost(
const QString &host )
963 QString ResourceLDAPKIO::host()
const
968 void ResourceLDAPKIO::setPort(
int port )
973 int ResourceLDAPKIO::port()
const
978 void ResourceLDAPKIO::setVer(
int ver )
983 int ResourceLDAPKIO::ver()
const
988 void ResourceLDAPKIO::setSizeLimit(
int sizelimit )
990 d->mSizeLimit = sizelimit;
993 int ResourceLDAPKIO::sizeLimit()
995 return d->mSizeLimit;
998 void ResourceLDAPKIO::setTimeLimit(
int timelimit )
1000 d->mTimeLimit = timelimit;
1003 int ResourceLDAPKIO::timeLimit()
1005 return d->mTimeLimit;
1008 void ResourceLDAPKIO::setFilter(
const QString &filter )
1010 d->mFilter = filter;
1013 QString ResourceLDAPKIO::filter()
const
1018 void ResourceLDAPKIO::setIsAnonymous(
bool value )
1020 d->mAnonymous = value;
1023 bool ResourceLDAPKIO::isAnonymous()
const
1025 return d->mAnonymous;
1028 void ResourceLDAPKIO::setIsTLS(
bool value )
1033 bool ResourceLDAPKIO::isTLS()
const
1037 void ResourceLDAPKIO::setIsSSL(
bool value )
1042 bool ResourceLDAPKIO::isSSL()
const
1047 void ResourceLDAPKIO::setIsSubTree(
bool value )
1049 d->mSubTree = value;
1052 bool ResourceLDAPKIO::isSubTree()
const
1059 d->mAttributes = attributes;
1064 return d->mAttributes;
1067 void ResourceLDAPKIO::setRDNPrefix(
int value )
1069 d->mRDNPrefix = value;
1072 int ResourceLDAPKIO::RDNPrefix()
const
1074 return d->mRDNPrefix;
1077 void ResourceLDAPKIO::setIsSASL(
bool value )
1082 bool ResourceLDAPKIO::isSASL()
const
1087 void ResourceLDAPKIO::setMech(
const QString &mech )
1092 QString ResourceLDAPKIO::mech()
const
1097 void ResourceLDAPKIO::setRealm(
const QString &realm )
1102 QString ResourceLDAPKIO::realm()
const
1107 void ResourceLDAPKIO::setBindDN(
const QString &binddn )
1109 d->mBindDN = binddn;
1112 QString ResourceLDAPKIO::bindDN()
const
1117 void ResourceLDAPKIO::setCachePolicy(
int pol )
1119 d->mCachePolicy = pol;
1122 int ResourceLDAPKIO::cachePolicy()
const
1124 return d->mCachePolicy;
1127 void ResourceLDAPKIO::setAutoCache(
bool value )
1129 d->mAutoCache = value;
1132 bool ResourceLDAPKIO::autoCache()
1134 return d->mAutoCache;
1137 QString ResourceLDAPKIO::cacheDst()
const
1139 return d->mCacheDst;
Postal address information.
Picture photo() const
Return photo.
A class to store a picture of an addressee.
QString title() const
Return title.
bool save(const QString &fileName, const char *format, int quality) const
const_iterator constBegin() const
QString familyName() const
Return family name.
QString formattedName() const
Return formatted name.
QString note() const
Return note.
Helper class for handling coordinated save of address books.
QStringList emails() const
Return list of all email addresses.
void setRawData(const QByteArray &rawData, const QString &type)
Sets the raw data of the picture.
QString assembledName() const
Return the name that consists of all name parts.
QString number(int n, int base)
int count(const T &value) const
void append(const T &value)
QString fromUtf8(const char *str, int size)
PhoneNumber phoneNumber(PhoneNumber::Type type) const
Return phone number, which matches the given type.
QString identifier() const
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
QImage data() const
Returns the image data of this picture.
void setNumber(const QString &number)
Sets the phone number.
const_iterator constEnd() const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QString givenName() const
Return given name.
const Key key(const T &value) const
QString organization() const
Return organization.
QString uid() const
Return unique identifier.
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
virtual void setReadOnly(bool value)
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
const_iterator constEnd() const
const_iterator constBegin() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void writeConfig(KConfigGroup &group)
Writes the resource specific config to file.
QByteArray encodeName(const QString &fileName)
Address address(Address::Type type) const
Return address, which matches the given type.
const T value(const Key &key) const