[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/libkdepim
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-12-02 16:17:07
Message-ID: 20101202161707.A112DAC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202888 by vkrause:

Add skeleton for in-process LDAP. Unfortunately this simple single-threaded
approach does not work, all the lower level LDAP calls are blocking. A
failing connect thus is able to lock the entire application. So, LdapSession
will have to become a thread tomorrow.


 M  +12 -0     CMakeLists.txt  
 M  +16 -2     ldap/ldapclient.cpp  
 A             ldap/ldapqueryjob.cpp   [License: LGPL (v2+)]
 A             ldap/ldapqueryjob.h   [License: LGPL (v2+)]
 A             ldap/ldapsession.cpp   [License: LGPL (v2+)]
 A             ldap/ldapsession.h   [License: LGPL (v2+)]


--- trunk/KDE/kdepim/libkdepim/CMakeLists.txt #1202887:1202888
@@ -10,6 +10,11 @@
 
 include_directories( ${Boost_INCLUDE_DIR} )
 
+option(KDEPIM_INPROCESS_LDAP FALSE "Use in-process rather than KIO slave LDAP" )
+if (KDEPIM_INPROCESS_LDAP)
+  add_definitions( -DKDEPIM_INPROCESS_LDAP )
+endif ()
+
 ########### next target ###############
 
 set(kdepim_LIB_SRCS
@@ -53,6 +58,13 @@
   )
 endif (KDEPIMLIBS_KRESOURCES_LIBS)
 
+if (KDEPIM_INPROCESS_LDAP)
+  set(kdepim_LIB_SRCS ${kdepim_LIB_SRCS}
+    ldap/ldapsession.cpp
+    ldap/ldapqueryjob.cpp
+  )
+endif ()
+
 kde4_add_library(kdepim ${LIBRARY_TYPE} ${kdepim_LIB_SRCS})
 
 target_link_libraries(kdepim
--- trunk/KDE/kdepim/libkdepim/ldap/ldapclient.cpp #1202887:1202888
@@ -22,6 +22,8 @@
  */
 
 #include "ldapclient.h"
+#include "ldapsession.h"
+#include "ldapqueryjob.h"
 
 #include <kldap/ldapobject.h>
 #include <kldap/ldapserver.h>
@@ -50,7 +52,8 @@
     Private( LdapClient *qq )
       : q( qq ),
         mJob( 0 ),
-        mActive( false )
+        mActive( false ),
+        mSession( 0 )
     {
     }
 
@@ -74,13 +77,15 @@
     QString mScope;
     QStringList mAttrs;
 
-    QPointer<KIO::TransferJob> mJob;
+    QPointer<KJob> mJob;
     bool mActive;
 
     KLDAP::LdapObject mCurrentObject;
     KLDAP::Ldif mLdif;
     int mClientNumber;
     int mCompletionWeight;
+
+    KLDAP::LdapSession *mSession;
 };
 
 LdapClient::LdapClient( int clientNumber, QObject *parent )
@@ -103,6 +108,11 @@
 void LdapClient::setServer( const KLDAP::LdapServer &server )
 {
   d->mServer = server;
+#ifdef KDEPIM_INPROCESS_LDAP
+  if ( !d->mSession )
+    d->mSession = new LdapSession( this );
+  d->mSession->connectToServer( server );
+#endif
 }
 
 const KLDAP::LdapServer LdapClient::server() const
@@ -141,7 +151,11 @@
 
   d->startParseLDIF();
   d->mActive = true;
+#ifndef KDEPIM_INPROCESS_LDAP
   d->mJob = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo );
+#else
+  d->mJob = new LdapQueryJob( url, d->mSession );
+#endif
   connect( d->mJob, SIGNAL( data( KIO::Job*, const QByteArray& ) ),
            this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) );
   connect( d->mJob, SIGNAL( infoMessage( KJob*, const QString&, const QString& ) ),
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic