Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > by-pkgid > a4e51422fe1b8d073f47c12205a319a3 > files > 13

kdelibs-3.5.10-4.4mdv2009.0.src.rpm

diff -r -u -N kdelibs-orig/kdecore/configure.in.in kdelibs-3.5.6/kdecore/configure.in.in
--- kdelibs-orig/kdecore/configure.in.in	2005-11-29 16:01:07.000000000 -0200
+++ kdelibs-3.5.6/kdecore/configure.in.in	2006-12-14 14:58:26.000000000 -0200
@@ -231,3 +231,116 @@
       ],
       AC_MSG_RESULT(no)
 )
+
+AC_MSG_CHECKING(for LDAP support)
+AC_ARG_WITH(ldap,
+AC_HELP_STRING([--with-ldap=PATH],[Set path for LDAP files [default=check]]),
+[ case "$withval" in
+  yes)
+    with_ldap=CHECK
+    ;;
+  esac ],
+[ with_ldap=CHECK ]
+)dnl
+
+if test "x$with_ldap" = "xCHECK" ; then
+  with_ldap=NOTFOUND
+  search_incs="$kde_includes /usr/include /usr/local/include"
+  AC_FIND_FILE(ldap.h, $search_incs, ldap_incdir)
+  if test -r $ldap_incdir/ldap.h ; then
+    test "x$ldap_incdir" != "x/usr/include" && LDAP_INCS="-I$ldap_incdir"
+    with_ldap=FOUND
+  fi
+  if test $with_ldap = FOUND ; then
+    with_ldap=NOTFOUND
+    for ext in la so sl a dylib ; do
+      AC_FIND_FILE(libldap.$ext, $kde_libraries /usr/lib /usr/local/lib /usr/lib64,
+        ldap_libdir)
+      if test -r $ldap_libdir/libldap.$ext ; then
+        if test "x$ldap_libdir" != "x/usr/lib" ; then
+          LDAP_LIBS="-L$ldap_libdir "
+          test "$USE_RPATH" = yes && LDAP_RPATH="-R $ldap_libdir"
+        fi
+        LDAP_LIBS="${LDAP_LIBS}-lldap"
+        with_ldap=FOUND
+        break
+      fi
+    done
+  fi
+fi
+
+case "$with_ldap" in
+no) AC_MSG_RESULT(no) ;;
+framework)
+  LDAP_LIBS="-Xlinker -framework -Xlinker LDAP"
+  AC_DEFINE_UNQUOTED(HAVE_LIBLDAP, 1, [Define if you have LDAP libraries])
+  LDAP_SUBDIR="ldap"
+  AC_MSG_RESULT(Apple framework)
+  ;;
+FOUND)
+  AC_MSG_RESULT(incs=$ldap_incdir libs=$ldap_libdir)
+  ;;
+NOTFOUND) AC_MSG_RESULT(searched but not found) ;;
+*)
+  AC_MSG_RESULT($with_ldap)
+  ;;
+esac
+
+AC_MSG_CHECKING(whether LDAP support can be compiled)
+
+  if test "x$with_ldap" != "xFOUND" ; then
+    LDAP_ROOT="$with_ldap"
+    if test "x$LDAP_ROOT" != "x/usr" ; then
+      LDAP_INCS="-I${LDAP_ROOT}/include"
+      LDAP_LIBS="-L${LDAP_ROOT}/lib "
+      if test "$USE_RPATH" = "yes" ; then
+        LDAP_RPATH="-R ${LDAP_ROOT}/lib"
+      fi
+    fi
+    LDAP_LIBS="${LDAP_LIBS}-lldap"
+  fi
+  LDAP_LIBS="${LDAP_LIBS} ${LIB_LBER} ${LIBRESOLV}"
+
+  kde_safe_LIBS="$LIBS"
+  kde_safe_CFLAGS="$CFLAGS"
+  kde_safe_CXXFLAGS="$CXXFLAGS"
+  LIBS="$LIBS $all_libraries $LDAP_LIBS $KRB4_LIBS $X_EXTRA_LIBS"
+  CFLAGS="$CFLAGS $all_includes $LDAP_INCS -DLDAP_DEPRECATED"
+  CXXFLAGS="$CXXFLAGS $all_includes $LDAP_INCS -DLDAP_DEPRECATED"
+
+  AC_LANG_SAVE
+  AC_LANG_C
+  AC_TRY_LINK(dnl
+  [
+  #include <ldap.h>
+  #if LDAP_API_VERSION < 2004
+  #error LDAP version too old, please upgrade to a library supporting API 2004 or higher
+  #endif
+  ],
+  [
+  LDAP *ldap;
+  ],
+  , with_ldap=no
+  )
+  AC_LANG_RESTORE
+  if test "$with_ldap" = "no" ; then
+    LDAP_INCS=
+    LDAP_LIBS=
+    LDAP_RPATH=
+    LDAP_SUBDIR=
+    CFLAGS=$kde_safe_CFLAGS
+    CXXFLAGS=$kde_safe_CXXFLAGS
+    LIBS=$kde_safe_LIBS
+    AC_MSG_RESULT(no (but first try gave $msg))
+  else
+    AC_DEFINE_UNQUOTED(HAVE_LIBLDAP, 1, [Define if you have LDAP libraries])
+    LDAP_SUBDIR="ldap"
+    AC_MSG_RESULT(yes)
+  fi
+
+AC_SUBST(LDAP_INCS)
+AC_SUBST(LDAP_LIBS)
+AC_SUBST(LDAP_RPATH)
+
+
+
diff -r -u -N kdelibs-orig/kdecore/kconfigbackend.cpp kdelibs-3.5.6/kdecore/kconfigbackend.cpp
--- kdelibs-orig/kdecore/kconfigbackend.cpp	2006-06-30 23:11:51.000000000 -0300
+++ kdelibs-3.5.6/kdecore/kconfigbackend.cpp	2006-12-14 14:58:26.000000000 -0200
@@ -579,7 +579,8 @@
          KEntry entry = pConfig->lookupData(groupKey);
          groupSkip = entry.bImmutable;
 
-         if (groupSkip && !bDefault)
+         //if (groupSkip && !bDefault)
+         if (groupSkip)
             continue;
 
          entry.bImmutable |= groupOptionImmutable;
@@ -593,7 +594,8 @@
 
          continue;
       }
-      if (groupSkip && !bDefault)
+      //if (groupSkip && !bDefault)
+      if (groupSkip)
         goto sktoeol; // Skip entry
 
       bool optionImmutable = groupOptionImmutable;
--- kdelibs-3.5.6/kdecore/kconfigbase.cpp.ldap	2005-11-08 20:39:22.000000000 -0200
+++ kdelibs-3.5.6/kdecore/kconfigbase.cpp	2007-04-09 17:04:32.000000000 -0300
@@ -20,12 +20,14 @@
    Boston, MA 02110-1301, USA.
 */
 
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
 
 #include <qfile.h>
 #include <qdir.h>
 #include <qtextstream.h>
+#include <qtextcodec.h>
+#include <qdom.h>
 
 #include <kapplication.h>
 #include <kglobal.h>
@@ -38,25 +40,207 @@
 #include "kstandarddirs.h"
 #include "kstringhandler.h"
 
-class KConfigBase::KConfigBasePrivate
+void KConfigBase::dumpConfig( const QString& ent, const QString& val, const QString& type ) const 
 {
-public:
-     KConfigBasePrivate() : readDefaults(false) { };
+   bool dumpEnabled = getenv( "DUMPCONFIG" ) ? true : false;
 
-public:
-     bool readDefaults;
-};
+   if( backEnd == 0 )
+   {
+      dumpEnabled = false;
+      return;
+   }
+   else if( !dumpEnabled )
+      return;
+
+   QString filename;
+   filename = backEnd->fileName();
+
+   // blacklists some entries to avoid uselless queries
+   if (  filename == "kdebugrc"
+         || filename == "kconf_updaterc"
+         || filename == "kdedrc"
+         || filename == "klauncherrc"
+         || filename == "kdeinitrc"
+         || filename == "kbuildsycocarc"
+         || filename == "drkonqirc"
+         || filename.startsWith( "/" )
+         || filename.endsWith( ".desktop" )
+         )
+      return;
+   
+   QDomDocument *xmldoc;
+   QDomDocument *globalxmldoc;
+  
+   bool globalgroup = false;
+   
+   if ( mGroup == "KDE" || mGroup == "General" )
+      globalgroup = true;
+
+   QDomElement root;
+   QDir bd( getenv( "KCONFIGXMLDIR" ) );
+   
+   QString data = bd.exists() ? bd.absPath() : "/tmp";
+   QString localfile = data + '/' + filename + ".xml"; 
+   QFile file( localfile );
+   if ( !file.open( IO_ReadOnly ) )
+   {
+      xmldoc = new QDomDocument( filename );
+      root = xmldoc->createElement( filename );
+      xmldoc->appendChild( root );
+   }
+   else
+   {
+      xmldoc = new QDomDocument();
+      if ( !xmldoc->setContent( &file ) ) 
+      {
+         file.close();
+         return;
+      }
+      root = xmldoc->documentElement();
+   }
+   file.close();
+   
+   QDomElement globalroot;
+   localfile = data + "/kdeglobals.xml"; 
+   file.setName( localfile );
+   if ( !file.open( IO_ReadOnly ) )
+   {
+      globalxmldoc = new QDomDocument( "kdeglobals" );
+      globalroot = globalxmldoc->createElement( "kdeglobals" );
+      globalxmldoc->appendChild( globalroot );
+   }
+   else
+   {
+      globalxmldoc = new QDomDocument();
+      if ( !globalxmldoc->setContent( &file ) ) 
+      {
+         file.close();
+         return;
+      }
+      globalroot = globalxmldoc->documentElement(); 
+   }
+   file.close();
+   
+
+   bool exists = false;
+
+   QDomNode node;
+   QDomElement grp;
+
+   if( ! globalgroup )
+   {
+      node = xmldoc->documentElement().namedItem( "group" );
+      while ( !node.isNull() )
+      {
+         QString current = node.attributes().item( 0 ).nodeValue();
+         if ( node.attributes().item( 0 ).nodeValue() == QString( mGroup ) )
+         {
+            grp = node.toElement();
+            exists = true;
+            break;
+         }
+         node = node.nextSibling();
+      }
+      
+      if ( ! exists )
+      {
+         grp = xmldoc->createElement( "group" );
+         grp.setAttribute( "name", mGroup ); 
+         root.appendChild( grp );
+      }
+   }
+   else
+   {
+       node = globalxmldoc->documentElement().namedItem( "group" );
+      while ( !node.isNull() )
+      {
+         QString current = node.attributes().item( 0 ).nodeValue();
+         if ( node.attributes().item( 0 ).nodeValue() == QString( mGroup ) )
+         {
+            grp = node.toElement();
+            exists = true;
+            break;
+         }
+         node = node.nextSibling();
+      }
+      
+      if ( ! exists )
+      {
+         grp = globalxmldoc->createElement( "group" );
+         grp.setAttribute( "name", mGroup ); 
+         globalroot.appendChild( grp );
+      }
+   }
+
+     
+   exists = false;
+   QDomElement entry;
+   QDomText t;
+   if ( ! globalgroup )
+      t = xmldoc->createTextNode( val );
+   else
+      t = globalxmldoc->createTextNode( val );
+   node = grp.namedItem( "property" );
+
+   while ( !node.isNull() )
+   {
+      QString current = node.attributes().item( 0 ).nodeValue();
+      if ( node.attributes().namedItem( "name" ).nodeValue() == ent )
+      {
+         entry = node.toElement();
+         exists = true;
+         break;
+      }
+      node = node.nextSibling();
+   }
+   
+   if ( ! exists )
+   {
+
+      if ( ! globalgroup )
+         entry = xmldoc->createElement( "property" );
+      else
+         entry = globalxmldoc->createElement( "property" );
+      entry.setAttribute( "name", ent );
+      entry.setAttribute( "type", type );
+      grp.appendChild( entry );
+      entry.appendChild( t );
+   }
+
+   // Save every time to avoid duplicated root elements
+   filename = data + '/' + backEnd->fileName() + ".xml"; 
+   file.setName( filename );
+   if ( file.open( IO_WriteOnly ) ) 
+   {
+      QTextStream qualquer( &file );
+      qualquer <<  xmldoc->toString() << endl;
+      file.close();
+   }
+   
+   filename = data + "/kdeglobals.xml"; 
+   file.setName( filename );
+   if ( file.open( IO_WriteOnly ) ) 
+   {
+      QTextStream qualquer( &file );
+      qualquer <<  globalxmldoc->toString() << endl;
+      file.close();
+   }
+
+}
 
 KConfigBase::KConfigBase()
   : backEnd(0L), bDirty(false), bLocaleInitialized(false),
-    bReadOnly(false), bExpand(false), d(0)
+    bReadOnly(false), bExpand(false), m_Private(0)
 {
+    m_Private = m_Private = new KConfigBasePrivate();
+    m_Private->backEnds.setAutoDelete(true);
     setGroup(QString::null);
 }
 
 KConfigBase::~KConfigBase()
 {
-    delete d;
+
+   delete m_Private;
 }
 
 void KConfigBase::setLocale()
@@ -203,7 +387,10 @@
 QString KConfigBase::readEntry( const QString& pKey,
                                 const QString& aDefault ) const
 {
-   return KConfigBase::readEntry(pKey.utf8().data(), aDefault);
+   QString aValue = KConfigBase::readEntry(pKey.utf8().data(), aDefault);
+   if ( ! aValue.isNull() )
+      dumpConfig( pKey, aValue, "String" );
+   return aValue;
 }
 
 QString KConfigBase::readEntry( const char *pKey,
@@ -313,7 +500,7 @@
         nDollarPos = aValue.find( '$', nDollarPos );
       }
     }
-
+ 
   return aValue;
 }
 
@@ -442,7 +629,9 @@
                                 QStrList &list, char sep ) const
 {
   if( !hasKey( pKey ) )
+  {
     return 0;
+  }
 
   QCString str_list = readEntryUtf8( pKey );
   if (str_list.isEmpty())
@@ -488,7 +677,9 @@
 
   QStringList list;
   if( !hasKey( pKey ) )
+  {
     return list;
+  }
   QString str_list = readEntry( pKey );
   if( str_list.isEmpty() )
     return list;
@@ -520,6 +711,7 @@
     value.squeeze();
     list.append( value );
   }
+  dumpConfig( pKey, list.join( "," ), "List" );
   return list;
 }
 
@@ -527,7 +719,9 @@
 		char sep ) const
 {
 	if ( !hasKey( pKey ) )
+   {
 		return aDefault;
+   }
 	else
 		return readListEntry( pKey, sep );
 }
@@ -540,6 +734,8 @@
 QValueList<int> KConfigBase::readIntListEntry( const char *pKey ) const
 {
   QStringList strlist = readListEntry(pKey);
+  dumpConfig( pKey, strlist.join( "," ), "IntList" );
+
   QValueList<int> list;
   QStringList::ConstIterator end(strlist.end());
   for (QStringList::ConstIterator it = strlist.begin(); it != end; ++it)
@@ -560,6 +756,7 @@
   const bool bExpandSave = bExpand;
   bExpand = true;
   QString aValue = readEntry( pKey, pDefault );
+  dumpConfig( pKey, aValue, "Path" );
   bExpand = bExpandSave;
   return aValue;
 }
@@ -574,6 +771,8 @@
   const bool bExpandSave = bExpand;
   bExpand = true;
   QStringList aValue = readListEntry( pKey, sep );
+
+  dumpConfig( pKey, aValue.join( "," ), "PathList" );
   bExpand = bExpandSave;
   return aValue;
 }
@@ -585,6 +784,7 @@
 
 int KConfigBase::readNumEntry( const char *pKey, int nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "Num" );
   QCString aValue = readEntryUtf8( pKey );
   if( aValue.isNull() )
     return nDefault;
@@ -606,6 +806,7 @@
 
 unsigned int KConfigBase::readUnsignedNumEntry( const char *pKey, unsigned int nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "UnsignedNum" );
   QCString aValue = readEntryUtf8( pKey );
   if( aValue.isNull() )
     return nDefault;
@@ -625,6 +826,7 @@
 
 long KConfigBase::readLongNumEntry( const char *pKey, long nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "LongNum" );
   QCString aValue = readEntryUtf8( pKey );
   if( aValue.isNull() )
     return nDefault;
@@ -644,6 +846,7 @@
 
 unsigned long KConfigBase::readUnsignedLongNumEntry( const char *pKey, unsigned long nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "UnsignedLongNum" );
   QCString aValue = readEntryUtf8( pKey );
   if( aValue.isNull() )
     return nDefault;
@@ -662,6 +865,7 @@
 
 Q_INT64 KConfigBase::readNum64Entry( const char *pKey, Q_INT64 nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "Num64" );
   // Note that QCString::toLongLong() is missing, we muse use a QString instead.
   QString aValue = readEntry( pKey );
   if( aValue.isNull() )
@@ -682,6 +886,7 @@
 
 Q_UINT64 KConfigBase::readUnsignedNum64Entry( const char *pKey, Q_UINT64 nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "UnsignedNum64" );
   // Note that QCString::toULongLong() is missing, we muse use a QString instead.
   QString aValue = readEntry( pKey );
   if( aValue.isNull() )
@@ -701,6 +906,8 @@
 
 double KConfigBase::readDoubleNumEntry( const char *pKey, double nDefault) const
 {
+  dumpConfig( pKey, QString::number( nDefault ), "Double" );
+  
   QCString aValue = readEntryUtf8( pKey );
   if( aValue.isNull() )
     return nDefault;
@@ -720,6 +927,8 @@
 
 bool KConfigBase::readBoolEntry( const char *pKey, bool bDefault ) const
 {
+  dumpConfig( pKey, QString::number( bDefault ), "Bool" );
+
   QCString aValue = readEntryUtf8( pKey );
 
   if( aValue.isNull() )
@@ -747,6 +956,11 @@
 
 QFont KConfigBase::readFontEntry( const char *pKey, const QFont* pDefault ) const
 {
+   if ( pDefault )
+      dumpConfig( pKey, pDefault->toString(), "Font" );
+   else
+      dumpConfig( pKey, "", "Font" );
+
   QFont aRetFont;
 
   QString aValue = readEntry( pKey );
@@ -844,7 +1058,16 @@
 
 QRect KConfigBase::readRectEntry( const char *pKey, const QRect* pDefault ) const
 {
-  QCString aValue = readEntryUtf8(pKey);
+   if ( pDefault )
+      dumpConfig( pKey, QString::number( pDefault->left() ) + "," + 
+            QString::number( pDefault->top() ) + "," + 
+            QString::number( pDefault->right() ) + "," +
+            QString::number( pDefault->bottom() ), 
+            "Rect" );
+   else
+      dumpConfig( pKey, "", "Rect" );
+
+   QCString aValue = readEntryUtf8(pKey);
 
   if (!aValue.isEmpty())
   {
@@ -870,6 +1093,11 @@
 QPoint KConfigBase::readPointEntry( const char *pKey,
                                     const QPoint* pDefault ) const
 {
+   if ( pDefault )
+      dumpConfig( pKey, QString::number( pDefault->x() ) + "," + QString::number( pDefault->y() ), "Point" );
+   else
+      dumpConfig( pKey, "", "Point" );
+  
   QCString aValue = readEntryUtf8(pKey);
 
   if (!aValue.isEmpty())
@@ -895,6 +1123,10 @@
 QSize KConfigBase::readSizeEntry( const char *pKey,
                                   const QSize* pDefault ) const
 {
+   if ( pDefault )
+      dumpConfig( pKey, QString::number( pDefault->width() ) + "x" + QString::number( pDefault->height() ), "Size" );
+   else
+      dumpConfig( pKey, "", "Size" );
   QCString aValue = readEntryUtf8(pKey);
 
   if (!aValue.isEmpty())
@@ -914,13 +1146,17 @@
 
 QColor KConfigBase::readColorEntry( const QString& pKey,
                                     const QColor* pDefault ) const
-{
-  return readColorEntry(pKey.utf8().data(), pDefault);
+{ 
+   return readColorEntry(pKey.utf8().data(), pDefault);
 }
 
 QColor KConfigBase::readColorEntry( const char *pKey,
                                     const QColor* pDefault ) const
 {
+   if ( pDefault )
+      dumpConfig( pKey, pDefault->name(), "Color" );
+   else
+      dumpConfig( pKey, "", "Color" );
   QColor aRetColor;
   int nRed = 0, nGreen = 0, nBlue = 0;
 
@@ -987,6 +1223,11 @@
 QDateTime KConfigBase::readDateTimeEntry( const char *pKey,
                                           const QDateTime* pDefault ) const
 {
+   if ( pDefault )
+      dumpConfig( pKey, pDefault->toString(), "DateTime" );
+   else
+      dumpConfig( pKey, "", "DateTime" );
+
   if( !hasKey( pKey ) )
     {
       if( pDefault )
@@ -1665,14 +1906,23 @@
 
 void KConfigBase::parseConfigFiles()
 {
+
   if (!bLocaleInitialized && KGlobal::_locale) {
     setLocale();
   }
+
+  for ( KConfigBackEnd* backend = m_Private->backEnds.first();
+        backend;
+        backend = m_Private->backEnds.next() )
+  {
+      backend->parseConfigFiles();
+  }
+
   if (backEnd)
   {
-     backEnd->parseConfigFiles();
-     bReadOnly = (backEnd->getConfigState() == ReadOnly);
+      bReadOnly = (backEnd->getConfigState() == ReadOnly);
   }
+
 }
 
 void KConfigBase::sync()
@@ -1700,18 +1950,12 @@
 
 void KConfigBase::setReadDefaults(bool b)
 {
-  if (!d)
-  {
-     if (!b) return;
-     d = new KConfigBasePrivate();
-  }
-
-  d->readDefaults = b;
+  m_Private->readDefaults = b;
 }
 
 bool KConfigBase::readDefaults() const
 {
-  return (d && d->readDefaults);
+  return (m_Private && m_Private->readDefaults);
 }
 
 void KConfigBase::revertToDefault(const QString &key)
diff -r -u -N kdelibs-orig/kdecore/kconfigldapbackend.cpp kdelibs-3.5.6/kdecore/kconfigldapbackend.cpp
--- kdelibs-orig/kdecore/kconfigldapbackend.cpp	1969-12-31 21:00:00.000000000 -0300
+++ kdelibs-3.5.6/kdecore/kconfigldapbackend.cpp	2006-12-14 14:58:26.000000000 -0200
@@ -0,0 +1,196 @@
+/*
+  This file is part of the KDE libraries
+  Copyright (c) 2005 Willem Verschuur <willverschuur@yahoo.com>
+  Copyright (c) 2006 Helio Chissini de Castro <helio@kde.org>
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; see the file COPYING.LIB.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+*/
+
+#include <iostream>
+
+#include "kconfigldapbackend.h"
+#include "kconfigdata.h"
+#include "kuser.h"
+#include "xldaplite.h"
+
+KConfigLDAPBackEnd::KConfigLDAPBackEnd( KConfigBase *config, 
+                                        const QString &fileName,
+                                        const char * resType, 
+                                        bool useKDEGlobals )
+
+    :   KConfigBackEnd(config, fileName, resType, useKDEGlobals)
+
+{
+   _fileImmutable = false;
+}
+
+
+
+
+KConfigLDAPBackEnd::~KConfigLDAPBackEnd()
+{
+}
+
+
+
+bool KConfigLDAPBackEnd::parseConfigFiles()
+{
+    // will result in an invalid search anyway..
+    if (mfileName.isEmpty()) 
+       return false;
+
+    // blacklists some entries to avoid uselless queries
+    if (  mfileName == "kdebugrc" 
+          || mfileName == "kconf_updaterc" 
+          || mfileName == "kdedrc"
+          || mfileName == "kdeinitrc"
+          || mfileName == "kbuildsycocarc"
+          || mfileName.startsWith( "/" ) )
+       return false;
+
+    // connect to ldap server
+    xLDAPconnection ldap;
+    if (!ldap.connect()) return false;
+
+    // User and profilelist
+    KUser user;
+    QString basedn = QString( "cn=%1,ou=default,ou=KDEConfig,%2" ).arg( mfileName ).arg( ldap.base() );
+    QStringList profiles( basedn );
+
+    // Query group profile
+    basedn = QString("uid=%1,ou=People,%2").arg(user.loginName()).arg(ldap.base());
+    char *attrs[] = { "kdeConfigEntry", 0 };
+    xLDAPquery query( ldap, "(objectClass=posixAccount)", basedn, attrs );
+
+    for ( xLDAPiterator section(query); section; ++section )
+    {
+		 for ( xLDAPattribute gattr(section); gattr; ++gattr )
+		 {
+          basedn = QString( "cn=%1,%2" ).arg( mfileName ).arg( gattr.firstValue() );
+          profiles.push_front( basedn );
+		 }
+    }
+    
+    for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it ) 
+    {
+       // File immutable
+       xLDAPquery filequery( ldap, "(objectClass=appConfig)", *it );
+       for ( xLDAPiterator section( filequery ); section; ++section )
+       {
+          for ( xLDAPattribute gattr(section); gattr; ++gattr )
+          {
+             if (!strcmp(gattr.attribute(), "immutable")) // immutable
+                setFileImmutable(0 == strcmp(gattr.firstValue(), "TRUE"));
+          }
+       }
+       
+       xLDAPquery query( ldap, "(objectClass=appConfigSection)", *it );
+       
+       // write results to application settings 
+       // iterate through sections/groups
+       for ( xLDAPiterator section(query); section; ++section )
+       {
+          QCString aCurrentGroup = "<default>";
+          bool groupimmutable = false;
+          // find out group name and flags
+          for ( xLDAPattribute gattr(section); gattr; ++gattr )
+          {
+             // section name
+             if (!strcmp(gattr.attribute(), "cn"))
+                aCurrentGroup = gattr.firstValue();
+             else if (!strcmp(gattr.attribute(), "immutable"))
+             {
+                if ( getFileImmutable() )
+                   groupimmutable = true;
+                else
+                   groupimmutable = (0 == strcmp(gattr.firstValue(), "TRUE"));
+             }
+             if ( groupimmutable )
+                setGroupImmutable( aCurrentGroup, true );
+          }
+          
+          // backwards compatibility
+          if (aCurrentGroup == "KDE Desktop Entry")
+             aCurrentGroup = "Desktop Entry";
+          
+          KEntryKey groupKey(aCurrentGroup, 0);
+          KEntry entry = pConfig->lookupData(groupKey);
+          bool groupSkip = entry.bImmutable;
+          
+          if (groupSkip)
+             continue;
+          
+          entry.bImmutable |= groupimmutable;
+          pConfig->putData(groupKey, entry, false);
+  
+          // set attribute values
+          //std::cout << "LDAP: " << "[ " << aCurrentGroup << " ] " <<  std::endl;
+          for ( xLDAPattribute attr(section);  attr; ++attr )
+          {
+             if (strcmp(attr.attribute(), "appconfigentry")) continue;
+             for ( char* cattr = (char*) attr.firstValue();
+                   cattr;
+                   cattr = (char*) attr.nextValue() )
+             {
+                QCString cattribute((const char*) cattr); 
+                cattr = cattribute.data();
+                char* ceq = (char*) strchr(cattr, '=');
+                if (!ceq) 
+                   continue;
+                
+                *ceq = 0;
+                char* cvalue = ++ceq;
+                
+                // insert the key/value line
+                KEntryKey aEntryKey(aCurrentGroup, cattr);
+                aEntryKey.bLocal = false; //(locale != 0);
+                aEntryKey.bDefault = false; //bDefault; meep?
+                
+                //std::cout << "LDAP: " << cattr << " = " << cvalue <<  std::endl;
+                
+                KEntry aEntry;
+                aEntry.mValue = cvalue;
+                aEntry.bGlobal = true; //bGlobal;
+                aEntry.bImmutable = false; //optionImmutable;
+                aEntry.bDeleted = false; // optionDeleted;
+                aEntry.bExpand = false; // optionExpand;
+                aEntry.bNLS = false; //(locale != 0);
+                
+                pConfig->putData( aEntryKey, // group
+                      aEntry,    // entry
+                      false );   
+             }
+          }
+       }
+    }
+    // return successful
+    return true;
+}
+
+
+
+void KConfigLDAPBackEnd::sync(bool bMerge)
+{
+    // write back to ldap server..
+}
+
+
+
+void KConfigLDAPBackEnd::virtual_hook(int id, void* data)
+{
+    KConfigBackEnd::virtual_hook( id, data );
+}
+
diff -r -u -N kdelibs-orig/kdecore/kconfigldapbackend.h kdelibs-3.5.6/kdecore/kconfigldapbackend.h
--- kdelibs-orig/kdecore/kconfigldapbackend.h	1969-12-31 21:00:00.000000000 -0300
+++ kdelibs-3.5.6/kdecore/kconfigldapbackend.h	2006-12-14 14:58:26.000000000 -0200
@@ -0,0 +1,53 @@
+/*
+  This file is part of the KDE libraries
+  Copyright (c) 2005 Willem Verschuur <willverschuur@yahoo.com>
+  Copyright (c) 2006 Helio Chissini de Castro <helio@kde.org>
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; see the file COPYING.LIB.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KCONFIGLDAPBACKEND_H
+#define KCONFIGLDAPBACKEND_H
+
+#include "kconfigbackend.h"
+
+/**
+ * Class for KDE INI-style configuration file loading/saving from LDAP
+ *
+ * @author Willem Verschuur <willverschuur@yahoo.com>
+ * @author Helio Chissini de Castro <helio@kde.org>
+ */
+
+class KDECORE_EXPORT KConfigLDAPBackEnd : public KConfigBackEnd
+{
+   public:
+      KConfigLDAPBackEnd( KConfigBase *_config, const QString &_fileName, const char * _resType, bool _useKDEGlobals = true );
+      virtual ~KConfigLDAPBackEnd();
+      bool parseConfigFiles();
+      virtual void sync(bool bMerge = true);
+      inline void setFileImmutable( bool mt ) { _fileImmutable = mt; }
+      inline bool getFileImmutable() { return _fileImmutable; }
+      inline void setGroupImmutable( QString str, bool mt ) { _groupImmutable[ str ] = mt; }
+      QMap< QString, bool > getGroupImmutable() { return _groupImmutable; }
+
+   protected:
+      virtual void virtual_hook(int id, void* data);
+      bool _fileImmutable;
+      QMap< QString, bool > _groupImmutable;
+};
+
+#endif
+
diff -r -u -N kdelibs-orig/kdecore/Makefile.am kdelibs-3.5.6/kdecore/Makefile.am
--- kdelibs-orig/kdecore/Makefile.am	2006-09-11 11:47:04.000000000 -0300
+++ kdelibs-3.5.6/kdecore/Makefile.am	2006-12-14 14:58:26.000000000 -0200
@@ -39,7 +39,8 @@
 include_HEADERS = kconfig.h kconfigskeleton.h \
 	kconfigdata.h ksimpleconfig.h kconfigdialogmanager.h \
 	kconfigbase.h kdesktopfile.h kurl.h ksock.h kaboutdata.h \
-	kcmdlineargs.h kconfigbackend.h kapp.h kapplication.h kuniqueapp.h \
+	kcmdlineargs.h kconfigbackend.h kconfigldapbackend.h \
+	xldaplite.h kapp.h kapplication.h kuniqueapp.h \
 	kuniqueapplication.h kcharsets.h kdeversion.h kpty.h kprocess.h \
 	kprocctrl.h klocale.h kicontheme.h kiconloader.h kdebug.h \
 	kwinmodule.h kwin.h krootprop.h kshortcut.h kkeynative.h kaccel.h \
@@ -85,7 +86,8 @@
 
 libkdecore_la_SOURCES = libintl.cpp kapplication.cpp \
 	kdebug.cpp netwm.cpp kconfigbase.cpp kconfig.cpp  ksimpleconfig.cpp \
-	kconfigbackend.cpp kmanagerselection.cpp kdesktopfile.cpp \
+	kconfigbackend.cpp kconfigldapbackend.cpp xldaplite.cpp \
+	kmanagerselection.cpp kdesktopfile.cpp \
 	kstandarddirs.cpp ksock.cpp kpty.cpp kprocess.cpp kprocctrl.cpp \
 	klocale.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp \
 	kiconloader.cpp kwin.cpp kwinmodule.cpp krootprop.cpp kcharsets.cpp \
@@ -116,7 +118,7 @@
 	kqiodevicegzip_p.cpp ktimezones.cpp
 
 libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined
-libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la
+libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la $(LDAP_LIBS)
 libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck
 libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \
 	$(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck
diff -r -u -N kdelibs-orig/kdecore/xldaplite.cpp kdelibs-3.5.6/kdecore/xldaplite.cpp
--- kdelibs-orig/kdecore/xldaplite.cpp	1969-12-31 21:00:00.000000000 -0300
+++ kdelibs-3.5.6/kdecore/xldaplite.cpp	2006-12-14 14:58:26.000000000 -0200
@@ -0,0 +1,404 @@
+/*
+  This file is part of the KDE libraries
+  Copyright (c) 2005 Willem Verschuur <willverschuur@yahoo.com>
+  Copyright (c) 2006 Helio Chissini de Castro <helio@kde.org>
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; see the file COPYING.LIB.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+*/
+
+#include <qfile.h>
+#include <qmap.h>
+#include <qregexp.h>
+#include <unistd.h>
+#include <iostream>
+
+#include "xldaplite.h"
+
+#ifndef LDAP_CONF
+#define LDAP_CONF "/etc/ldap.conf"
+#endif
+
+#ifndef LDAP_SECRET
+#define LDAP_SECRET "/etc/ldap.secret"
+#endif
+
+xLDAPconnection::xLDAPconnection()
+{
+    
+    m_Connection = 0;
+    
+}
+
+
+
+xLDAPconnection::~xLDAPconnection()
+{
+    if (m_Connection)
+    {
+        disconnect();
+    }
+}
+
+
+
+bool xLDAPconnection::connect()
+{
+
+    // close existing connection
+    if (m_Connection)
+    {
+        disconnect();
+    }
+
+    QFile conf(LDAP_CONF);
+    QMap<QString,QString> config;
+  
+    if (!conf.open(IO_ReadOnly)) 
+    {
+        //std::cerr << "Cannot open " << LDAP_CONF << std::endl;
+        return false;
+    }
+
+    QTextStream confs(&conf);
+    
+    while (!confs.atEnd()) 
+    {
+        QString line = confs.readLine();
+        if (line.contains(QRegExp("^\\s*[a-z]+\\s+.+"))) 
+        {
+            QStringList strs=QStringList::split(QRegExp("\\s+"),line);
+            config[strs[0]] = strs[1];
+        }
+    }
+    
+    if (geteuid()==0) 
+    {
+        
+        QFile secretFile( LDAP_SECRET );
+        
+        if (!secretFile.open(IO_ReadOnly)) 
+        {
+            std::cerr << "Cannot find " << LDAP_SECRET << std::endl; 
+            return false;
+        }
+        
+        QTextStream secretStream(&secretFile);
+        m_RootPassword = secretStream.readLine();
+        
+    }
+
+    // configure parameters 
+    QString host = config["host"];
+    int port = 389;
+    
+    if (config.contains("port")) 
+    {
+        port = config["port"].toInt();
+    }
+    
+    // create ldap connection
+    m_Connection = ldap_init(host.latin1(), port);
+
+    if (!m_Connection) return false;
+
+    int version = LDAP_VERSION3;
+    
+    if (config.contains("ldap_version"))
+        version = config["ldap_version"].toInt();
+   
+    // configure connection
+    int ret;
+    if ((ret = ldap_set_option(m_Connection, LDAP_OPT_PROTOCOL_VERSION, &version)) != LDAP_SUCCESS) 
+    {
+        std::cerr << "ldap_set_option" << ldap_err2string(ret) << std::endl;
+        return false;
+    } 
+
+    // root binding
+    if (getuid==0 && config.contains("rootbinddn")) 
+    {
+        if ( LDAP_SUCCESS != ldap_bind_s( m_Connection,
+                                          config["rootbinddn"].latin1(),
+                                          m_RootPassword.latin1(), 
+                                          LDAP_AUTH_SIMPLE ) )
+        {
+            std::cerr << "Root bind failed" << std::endl;
+            return false;
+        }
+        // should be utf8....
+    } 
+    else 
+    {
+        if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(m_Connection,NULL,NULL)))
+        {
+            std::cerr << "Anonymous bind failed" << std::endl;
+            return false;
+        }
+        // there are also SASL, and kerberos
+    }
+    
+    // configure scope
+    m_Scope = LDAP_SCOPE_SUBTREE;
+    
+    if (config.contains("scope")) 
+    {
+        if (config["scope"] == "sub");
+        else if (config["scope"] == "one")
+            m_Scope = LDAP_SCOPE_ONELEVEL;
+        else if (config["scope"] == "base")
+            m_Scope = LDAP_SCOPE_BASE;
+        else 
+        {
+            std::cerr << "bad value for scope in ldap.conf: " << config["scope"].latin1() << std::endl;
+            return false;
+        }
+    }
+    
+    // configure base
+    if (!config.contains("base")) 
+    {
+        std::cerr << "base is not defined in ldap.conf" << std::endl;
+        return false;
+    }
+    
+    m_Base = config["base"];
+
+    // return successful
+    return true;
+
+}
+
+
+
+void xLDAPconnection::disconnect()
+{
+
+    // the connection doesnt exist
+    if (!m_Connection) return;
+
+    // drop connection
+    ldap_unbind(m_Connection);
+    m_Connection = 0;
+
+    return;
+
+}
+
+
+
+xLDAPquery::xLDAPquery( xLDAPconnection& connection,
+                        const QString& filter,
+                        const QString& pbasedn,
+                        char** attributes )
+{
+
+    // initialize vars
+    QString basedn;
+    
+    if (pbasedn.isNull())
+    {
+        basedn = connection.m_Base;
+    }
+    else
+    {
+        basedn = pbasedn;
+    }
+    
+    m_Connection = &connection;
+
+    // execute search
+    m_Result = ldap_search_s(   m_Connection->m_Connection,
+                                basedn.latin1(),
+                                m_Connection->m_Scope,
+                                filter.latin1(),   
+                                attributes,
+                                0, // return attrs & values
+                                &m_Query   );
+
+    // output an error if query failed
+    //if (m_Result != LDAP_SUCCESS) 
+  	    //std::cerr << "ldap_search: " << ldap_err2string(m_Result) << std::endl;
+
+}
+
+
+
+xLDAPquery::~xLDAPquery()
+{
+    if (m_Query)
+    {
+        ldap_msgfree(m_Query);
+        m_Query = 0;
+    }
+}
+
+
+
+xLDAPiterator::xLDAPiterator(xLDAPquery& query)
+{
+    
+    // initialize vars
+    m_Query = &query;
+    m_Entry = 0;   // used by element iterator (this)
+    m_Element = 0; // used by attribute iterator
+
+    // fix error handling 
+    // if (!m_Connection) return false;
+    // if (!m_Message) return false;
+    
+    // point to first element in query result
+    m_Entry = ldap_first_entry(m_Query->m_Connection->m_Connection, m_Query->m_Query);
+    
+}
+
+
+
+xLDAPiterator::~xLDAPiterator()
+{
+
+    clearElement();
+}
+
+
+
+void xLDAPiterator::clearElement()
+{
+
+    if (m_Element)
+    {
+        ber_free(m_Element, 0);
+        m_Element = 0;
+    }
+
+}
+
+
+
+xLDAPiterator::operator bool ()
+{
+    return (m_Entry != 0);
+}
+
+
+
+void xLDAPiterator::operator ++ ()
+{
+    m_Entry = ldap_next_entry(m_Query->m_Connection->m_Connection, m_Entry);
+}
+
+
+
+xLDAPattribute::xLDAPattribute(xLDAPiterator& iter)
+{
+
+    // initialize class vars
+    m_Iterator = &iter;
+    m_Attribute = 0;
+    m_Values = 0;
+    m_CurrentValue = 0;
+
+    // free previous element's attribute data 
+    if (m_Iterator->m_Element)
+    {
+        m_Iterator->clearElement();
+    }
+
+    // get first attribute
+    m_Attribute = ldap_first_attribute( m_Iterator->m_Query->m_Connection->m_Connection, 
+                                        m_Iterator->m_Entry, 
+                                        &m_Iterator->m_Element);
+
+}
+
+
+
+xLDAPattribute::~xLDAPattribute()
+{
+    clearAttribute();
+}
+
+
+
+void xLDAPattribute::clearAttribute()
+{
+
+    if (m_Attribute)
+    {
+        ldap_memfree(m_Attribute);
+        m_Attribute = 0;
+    }
+    
+    if (m_Values)
+    {
+        clearValues();
+    }
+
+}
+
+
+
+xLDAPattribute::operator bool ()
+{
+    return (m_Attribute != 0);
+}
+
+
+
+void xLDAPattribute::operator ++ ()
+{
+
+    clearAttribute();
+    m_Attribute = ldap_next_attribute( m_Iterator->m_Query->m_Connection->m_Connection, 
+                                       m_Iterator->m_Entry, 
+                                       m_Iterator->m_Element );
+
+}
+
+
+
+const char* xLDAPattribute::firstValue()
+{
+    if (m_Values)
+    {
+        clearValues();
+    }
+
+    m_Values = ldap_get_values (  m_Iterator->m_Query->m_Connection->m_Connection, 
+                                  m_Iterator->m_Entry, 
+                                  m_Attribute );
+
+    m_CurrentValue = m_Values;
+    return *m_CurrentValue;
+}
+
+
+const char* xLDAPattribute::nextValue()
+{
+    m_CurrentValue++;
+    return *m_CurrentValue;
+}
+
+
+
+void xLDAPattribute::clearValues()
+{
+    if (m_Values)
+    {
+        ldap_value_free(m_Values);
+        m_Values = 0;
+    }
+}
+
diff -r -u -N kdelibs-orig/kdecore/xldaplite.h kdelibs-3.5.6/kdecore/xldaplite.h
--- kdelibs-orig/kdecore/xldaplite.h	1969-12-31 21:00:00.000000000 -0300
+++ kdelibs-3.5.6/kdecore/xldaplite.h	2006-12-14 14:58:26.000000000 -0200
@@ -0,0 +1,217 @@
+/*
+  This file is part of the KDE libraries
+  Copyright (c) 2005 Willem Verschuur <willverschuur@yahoo.com>
+  Copyright (c) 2006 Helio Chissini de Castro <helio@kde.org>
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; see the file COPYING.LIB.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+*/
+
+/*
+ * Lightweight openldap api wrappers, just makes the
+ * whole memory management schlep so much easier
+ *
+ * test: exception handling.. try to break it
+ *
+ * note: dont pass these classes as results for functions..
+ * for that you need to pull the variables into a counter
+ * referenced core structure.
+ *
+ * todo: ldapnode class for a truer in-memory representation
+ * of LDAP tree.. and easier query coding
+ */
+
+#ifndef _XLDAPLITE_H
+#define _XLDAPLITE_H
+
+
+
+#include <ldap.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qptrlist.h>
+
+
+
+class xLDAPquery;
+class xLDAPiterator;
+class xLDAPattribute;
+
+
+
+class xLDAPconnection
+{
+
+    
+    friend class xLDAPquery;
+    friend class xLDAPiterator;
+    friend class xLDAPattribute;
+
+    
+    public:
+
+
+        // read /etc/ldap.conf 
+        xLDAPconnection();
+
+
+        // free resources on object destruction
+        ~xLDAPconnection();
+
+
+        // connect to ldap server
+        bool connect();
+
+
+        // free resources
+        void disconnect();
+
+
+        // accessor
+        const LDAP* connection()  { return m_Connection; }
+        const QString& base() { return m_Base; }
+        const QString& password() { return m_RootPassword; }
+
+
+    protected:
+
+
+        LDAP*           m_Connection;
+        QString         m_RootPassword;
+        ber_int_t       m_Scope;
+        QString         m_Base;
+       
+
+};
+
+
+
+class xLDAPquery
+{
+
+
+    // iterator should have access to members
+    friend class xLDAPiterator;
+    friend class xLDAPattribute;
+
+    
+    public:
+
+
+        // execute a query
+        xLDAPquery( xLDAPconnection&, 
+                    const QString& filter, 
+                    const QString& base = 0, 
+                    char** attrs = 0 );
+
+
+        // free resources on object destruction
+        ~xLDAPquery();
+
+        
+    protected:
+
+
+        xLDAPconnection*    m_Connection;
+        LDAPMessage*        m_Query;
+        int                 m_Result;
+
+        
+};
+
+
+
+class xLDAPiterator
+{
+
+
+    friend class xLDAPattribute;
+
+    
+    public:
+
+
+        xLDAPiterator(xLDAPquery&);
+
+
+        ~xLDAPiterator();
+
+
+        operator bool(void);
+
+
+        void operator ++ (void);
+
+
+    protected:
+
+
+        void clearElement();
+
+        
+        xLDAPquery*     m_Query;
+        LDAPMessage*    m_Entry;
+        BerElement*     m_Element; // used by attribute functions
+
+
+};
+
+
+
+class xLDAPattribute
+{
+
+    
+    public:
+
+
+        xLDAPattribute(xLDAPiterator&);
+
+
+        ~xLDAPattribute();
+
+
+        operator bool(void);
+
+
+        void operator ++ (void);
+
+
+        const char* attribute() { return m_Attribute; }
+
+
+        const char* firstValue();
+        const char* nextValue();
+
+        
+    protected:
+
+
+        void clearAttribute();
+        void clearValues();
+
+
+        xLDAPiterator*          m_Iterator;
+        char*                   m_Attribute;    // attribute
+        char**                  m_Values;
+        char**                  m_CurrentValue;
+
+       
+};
+
+
+
+#endif
+
--- kdelibs-3.5.6/kdecore/kconfig.cpp.ldap	2006-10-01 14:33:38.000000000 -0300
+++ kdelibs-3.5.6/kdecore/kconfig.cpp	2007-02-28 14:03:45.000000000 -0300
@@ -34,6 +34,7 @@
 
 #include <kapplication.h>
 #include "kconfigbackend.h"
+#include "kconfigldapbackend.h"
 
 #include "kconfig.h"
 #include "kglobal.h"
@@ -49,17 +50,32 @@
   // set the object's read-only status.
   setReadOnly(bReadOnly);
 
-  // for right now we will hardcode that we are using the INI
-  // back end driver.  In the future this should be converted over to
-  // a object factory of some sorts.
-  KConfigINIBackEnd *aBackEnd = new KConfigINIBackEnd(this,
+  QString ldapenv( getenv( "KDELDAP" ) );
+
+  if ( ! ldapenv.isEmpty() )
+  {
+      // for right now we will hardcode that we are using the INI & LDAP
+      // back end driver.  In the future this should be converted over to
+      // a object factory of some sorts.
+      // and to configure precedence and exclusion
+      KConfigLDAPBackEnd *ldapBackEnd = new KConfigLDAPBackEnd(this,
+              fileName,
+              resType,
+              bUseKderc);
+      
+      m_Private->backEnds.append(ldapBackEnd);
+  }
+
+  KConfigINIBackEnd *iniBackEnd = new KConfigINIBackEnd(this,
 						      fileName,
-                                                      resType,
+                              resType,
 						      bUseKderc);
 
+  m_Private->backEnds.append(iniBackEnd);
+          
   // set the object's back end pointer to this new backend
-  backEnd = aBackEnd;
-
+  backEnd = iniBackEnd;
+  
   // read initial information off disk
   reparseConfiguration();
 
@@ -88,7 +104,8 @@
 {
   sync();
 
-  delete backEnd;
+  // delete taken care of by destruction of kconfibase's private class
+  //delete backEnd;
 }
 
 void KConfig::rollback(bool bDeep)
diff -u -r kdelibs-3.5.8/kdecore/kconfigbase.h kdelibs-3.5.8.new/kdecore/kconfigbase.h
--- kdelibs-3.5.8/kdecore/kconfigbase.h	2007-10-29 15:31:31.000000000 -0200
+++ kdelibs-3.5.8.new/kdecore/kconfigbase.h	2007-12-21 23:18:55.000000000 -0200
@@ -74,6 +74,7 @@
   friend class KConfigBackEnd;
   friend class KConfigINIBackEnd;
   friend class KConfigGroup;
+  friend class KConfigLDAPBackEnd;
 
 public:
   /**
@@ -87,6 +88,11 @@
   virtual ~KConfigBase();
 
   /**
+  *    * Dump Config on an XML file
+   *       */
+  void dumpConfig(  const QString& ent, const QString& val, const QString& type ) const;
+
+  /**
    * Specifies the group in which keys will be read and written.
    *
    *  Subsequent
@@ -2005,9 +2011,18 @@
 
 protected:
   virtual void virtual_hook( int id, void* data );
-private:
-  class KConfigBasePrivate;
-  KConfigBasePrivate *d;
+protected:
+  class KConfigBasePrivate
+  {
+  public:
+     KConfigBasePrivate() : readDefaults(false) { };
+
+  public:
+     bool                       readDefaults;
+     QPtrList<KConfigBackEnd>   backEnds;
+  };
+
+  KConfigBasePrivate *m_Private;
 
   void writeEntry( const char *pKey, const QString &rValue,
     bool bPersistent, bool bGlobal, bool bNLS, bool bExpand );
Only in kdelibs-3.5.8.new/kdecore: kconfigbase.h~