From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkdepim/ldapclient.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'libkdepim/ldapclient.cpp') diff --git a/libkdepim/ldapclient.cpp b/libkdepim/ldapclient.cpp index 359e0356..39d384e8 100644 --- a/libkdepim/ldapclient.cpp +++ b/libkdepim/ldapclient.cpp @@ -349,6 +349,22 @@ LdapSearch::LdapSearch() TQT_SLOT(slotFileChanged(const TQString&))); } +void LdapSearch::readWeighForClient( LdapClient *client, KConfig *config, int clientNumber ) +{ + const int completionWeight = config->readNumEntry( TQString( "SelectedCompletionWeight%1" ).arg( clientNumber ), -1 ); + if ( completionWeight != -1 ) + client->setCompletionWeight( completionWeight ); +} + +void LdapSearch::updateCompletionWeights() +{ + KConfig *config = KPIM::LdapSearch::config(); + config->setGroup( "LDAP" ); + for ( uint i = 0; i < mClients.size(); i++ ) { + readWeighForClient( mClients[i], config, i ); + } +} + void LdapSearch::readConfig() { cancelSearch(); @@ -371,9 +387,7 @@ void LdapSearch::readConfig() if ( !server.host().isEmpty() ) mNoLDAPLookup = false; ldapClient->setServer( server ); - int completionWeight = config->readNumEntry( TQString( "SelectedCompletionWeight%1" ).arg( j ), -1 ); - if ( completionWeight != -1 ) - ldapClient->setCompletionWeight( completionWeight ); + readWeighForClient( ldapClient, config, j ); TQStringList attrs; // note: we need "objectClass" to detect distribution lists @@ -499,7 +513,7 @@ void LdapSearch::makeSearchData( TQStringList& ret, LdapResultList& resList ) bool wasCN = false; bool wasDC = false; - kdDebug(5300) << "\n\nLdapSearch::makeSearchData()\n\n" << endl; + //kdDebug(5300) << "\n\nLdapSearch::makeSearchData()\n\n" << endl; LdapAttrMap::ConstIterator it2; for ( it2 = (*it1).attrs.begin(); it2 != (*it1).attrs.end(); ++it2 ) { @@ -508,7 +522,7 @@ void LdapSearch::makeSearchData( TQStringList& ret, LdapResultList& resList ) if( len > 0 && '\0' == val[len-1] ) --len; const TQString tmp = TQString::fromUtf8( val, len ); - kdDebug(5300) << " key: \"" << it2.key() << "\" value: \"" << tmp << "\"" << endl; + //kdDebug(5300) << " key: \"" << it2.key() << "\" value: \"" << tmp << "\"" << endl; if ( it2.key() == "cn" ) { name = tmp; if( mail.isEmpty() ) @@ -551,7 +565,7 @@ void LdapSearch::makeSearchData( TQStringList& ret, LdapResultList& resList ) if( mails.isEmpty()) { if ( !mail.isEmpty() ) mails.append( mail ); if( isDistributionList ) { - kdDebug(5300) << "\n\nLdapSearch::makeSearchData() found a list: " << name << "\n\n" << endl; + //kdDebug(5300) << "\n\nLdapSearch::makeSearchData() found a list: " << name << "\n\n" << endl; ret.append( name ); // following lines commented out for bugfixing kolab issue #177: // @@ -568,14 +582,14 @@ void LdapSearch::makeSearchData( TQStringList& ret, LdapResultList& resList ) //mail.prepend( name ); //mail = name; } else { - kdDebug(5300) << "LdapSearch::makeSearchData() found BAD ENTRY: \"" << name << "\"" << endl; + //kdDebug(5300) << "LdapSearch::makeSearchData() found BAD ENTRY: \"" << name << "\"" << endl; continue; // nothing, bad entry } } else if ( name.isEmpty() ) { - kdDebug(5300) << "LdapSearch::makeSearchData() mail: \"" << mail << "\"" << endl; + //kdDebug(5300) << "LdapSearch::makeSearchData() mail: \"" << mail << "\"" << endl; ret.append( mail ); } else { - kdDebug(5300) << "LdapSearch::makeSearchData() name: \"" << name << "\" mail: \"" << mail << "\"" << endl; + //kdDebug(5300) << "LdapSearch::makeSearchData() name: \"" << name << "\" mail: \"" << mail << "\"" << endl; ret.append( TQString( "%1 <%2>" ).arg( name ).arg( mail ) ); } -- cgit v1.2.3