summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/ldap
Unidiff
Diffstat (limited to 'kabc/plugins/ldap') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/ldap/ldapE.pro2
-rw-r--r--kabc/plugins/ldap/resourceldap.cpp7
-rw-r--r--kabc/plugins/ldap/resourceldap.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro
index f6ca586..2e79fc0 100644
--- a/kabc/plugins/ldap/ldapE.pro
+++ b/kabc/plugins/ldap/ldapE.pro
@@ -1,21 +1,21 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_ldap 5TARGET = microkabc_ldap
6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat $(QPEDIR)/include 6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kresources ../../../qtcompat $(QPEDIR)/include
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde -lmicrokabc 10LIBS += -lmicrokde -lmicrokabc
11LIBS += -L$(QPEDIR)/lib 11LIBS += -L$(QPEDIR)/lib
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 resourceldap.h \ 16 resourceldap.h \
17 resourceldapconfig.h 17 resourceldapconfig.h
18 18
19SOURCES = \ 19SOURCES = \
20 resourceldap.cpp \ 20 resourceldap.cpp \
21 resourceldapconfig.cpp 21 resourceldapconfig.cpp
diff --git a/kabc/plugins/ldap/resourceldap.cpp b/kabc/plugins/ldap/resourceldap.cpp
index 55c43af..4b9dede 100644
--- a/kabc/plugins/ldap/resourceldap.cpp
+++ b/kabc/plugins/ldap/resourceldap.cpp
@@ -15,65 +15,66 @@
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <kdebug.h> 28#include <kdebug.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <klineedit.h> 30#include <klineedit.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <kstringhandler.h> 33#include <kstringhandler.h>
34 34
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37#include "resourceldap.h" 37#include "resourceldap.h"
38#include "resourceldapconfig.h" 38#include "resourceldapconfig.h"
39#include "syncwidget.h"
39 40
40using namespace KABC; 41using namespace KABC;
41 42
42extern "C" 43extern "C"
43{ 44{
44//US void *init_kabc_ldap() 45//US void *init_kabc_ldap()
45 void *init_microkabc_ldap() 46 void *init_microkabc_ldap()
46 { 47 {
47 return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); 48 return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, KRES::SyncWidget>();
48 } 49 }
49} 50}
50 51
51void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); 52void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value );
52 53
53 54
54ResourceLDAP::ResourceLDAP( const KConfig *config ) 55ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable )
55 : Resource( config ), mPort( 389 ), mLdap( 0 ) 56 : Resource( config, syncable ), mPort( 389 ), mLdap( 0 )
56{ 57{
57 KConfig *cfg = (KConfig *)config; 58 KConfig *cfg = (KConfig *)config;
58 if ( cfg ) { 59 if ( cfg ) {
59 mUser = cfg->readEntry( "LdapUser" ); 60 mUser = cfg->readEntry( "LdapUser" );
60 mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); 61 mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) );
61 mDn = cfg->readEntry( "LdapDn" ); 62 mDn = cfg->readEntry( "LdapDn" );
62 mHost = cfg->readEntry( "LdapHost" ); 63 mHost = cfg->readEntry( "LdapHost" );
63 mPort = cfg->readNumEntry( "LdapPort", 389 ); 64 mPort = cfg->readNumEntry( "LdapPort", 389 );
64 mFilter = cfg->readEntry( "LdapFilter" ); 65 mFilter = cfg->readEntry( "LdapFilter" );
65 mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); 66 mAnonymous = cfg->readBoolEntry( "LdapAnonymous" );
66 67
67 QStringList attributes = cfg->readListEntry( "LdapAttributes" ); 68 QStringList attributes = cfg->readListEntry( "LdapAttributes" );
68 for ( uint pos = 0; pos < attributes.count(); pos += 2 ) 69 for ( uint pos = 0; pos < attributes.count(); pos += 2 )
69 mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); 70 mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] );
70 } 71 }
71 72
72 /** 73 /**
73 If you want to add new attributes, append them here, add a 74 If you want to add new attributes, append them here, add a
74 translation string in the ctor of AttributesDialog and 75 translation string in the ctor of AttributesDialog and
75 handle them in the load() method below. 76 handle them in the load() method below.
76 These are the default values from 77 These are the default values from
77 */ 78 */
78 if ( mAttributes.count() == 0 ) { 79 if ( mAttributes.count() == 0 ) {
79 mAttributes.insert( "commonName", "cn" ); 80 mAttributes.insert( "commonName", "cn" );
diff --git a/kabc/plugins/ldap/resourceldap.h b/kabc/plugins/ldap/resourceldap.h
index 0625f30..0aad3c1 100644
--- a/kabc/plugins/ldap/resourceldap.h
+++ b/kabc/plugins/ldap/resourceldap.h
@@ -22,49 +22,49 @@
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#ifndef KABC_RESOURCELDAP_H 28#ifndef KABC_RESOURCELDAP_H
29#define KABC_RESOURCELDAP_H 29#define KABC_RESOURCELDAP_H
30 30
31 31
32#include <lber.h> 32#include <lber.h>
33#include <ldap.h> 33#include <ldap.h>
34 34
35#include "addressbook.h" 35#include "addressbook.h"
36#include "resource.h" 36#include "resource.h"
37 37
38class KConfig; 38class KConfig;
39 39
40namespace KABC { 40namespace KABC {
41 41
42class ResourceLDAP : public Resource 42class ResourceLDAP : public Resource
43{ 43{
44public: 44public:
45 45
46 ResourceLDAP( const KConfig* ); 46 ResourceLDAP( const KConfig*, bool syncable );
47 47
48 virtual void writeConfig( KConfig* ); 48 virtual void writeConfig( KConfig* );
49 49
50 virtual bool doOpen(); 50 virtual bool doOpen();
51 virtual void doClose(); 51 virtual void doClose();
52 52
53 virtual Ticket *requestSaveTicket(); 53 virtual Ticket *requestSaveTicket();
54 54
55 virtual bool load(); 55 virtual bool load();
56 virtual bool save( Ticket * ); 56 virtual bool save( Ticket * );
57 57
58 virtual void removeAddressee( const Addressee& addr ); 58 virtual void removeAddressee( const Addressee& addr );
59 59
60 void setUser( const QString &user ); 60 void setUser( const QString &user );
61 QString user() const; 61 QString user() const;
62 62
63 void setPassword( const QString &password ); 63 void setPassword( const QString &password );
64 QString password() const; 64 QString password() const;
65 65
66 void setDn( const QString &dn ); 66 void setDn( const QString &dn );
67 QString dn() const; 67 QString dn() const;
68 68
69 void setHost( const QString &host ); 69 void setHost( const QString &host );
70 QString host() const; 70 QString host() const;