pull/16/head
Timothy Pearson 12 years ago
parent d1bd46309a
commit c56660aff3

@ -47,7 +47,7 @@ using namespace KABC;
void tqt_enter_modal( TQWidget *widget ); void tqt_enter_modal( TQWidget *widget );
void tqt_leave_modal( TQWidget *widget ); void tqt_leave_modal( TQWidget *widget );
class ResourceLDAPTDEIO::ResourceLDAPKIOPrivate class ResourceLDAPTDEIO::ResourceLDAPTDEIOPrivate
{ {
public: public:
LDIF mLdif; LDIF mLdif;
@ -69,10 +69,10 @@ class ResourceLDAPTDEIO::ResourceLDAPKIOPrivate
KTempFile *mTmp; KTempFile *mTmp;
}; };
ResourceLDAPTDEIO::ResourceLDAPKIO( const TDEConfig *config ) ResourceLDAPTDEIO::ResourceLDAPTDEIO( const TDEConfig *config )
: Resource( config ) : Resource( config )
{ {
d = new ResourceLDAPKIOPrivate; d = new ResourceLDAPTDEIOPrivate;
if ( config ) { if ( config ) {
TQMap<TQString, TQString> attrList; TQMap<TQString, TQString> attrList;
TQStringList attributes = config->readListEntry( "LdapAttributes" ); TQStringList attributes = config->readListEntry( "LdapAttributes" );
@ -115,7 +115,7 @@ ResourceLDAPTDEIO::ResourceLDAPKIO( const TDEConfig *config )
init(); init();
} }
ResourceLDAPTDEIO::~ResourceLDAPKIO() ResourceLDAPTDEIO::~ResourceLDAPTDEIO()
{ {
delete d; delete d;
} }
@ -549,10 +549,10 @@ bool ResourceLDAPTDEIO::load()
enter_loop(); enter_loop();
} }
if ( mErrorMsg.isEmpty() ) { if ( mErrorMsg.isEmpty() ) {
kdDebug(7125) << "ResourceLDAPKIO load ok!" << endl; kdDebug(7125) << "ResourceLDAPTDEIO load ok!" << endl;
return true; return true;
} else { } else {
kdDebug(7125) << "ResourceLDAPKIO load finished with error: " << mErrorMsg << endl; kdDebug(7125) << "ResourceLDAPTDEIO load finished with error: " << mErrorMsg << endl;
addressBook()->error( mErrorMsg ); addressBook()->error( mErrorMsg );
return false; return false;
} }
@ -726,7 +726,7 @@ void ResourceLDAPTDEIO::result( TDEIO::Job *job )
bool ResourceLDAPTDEIO::save( Ticket* ) bool ResourceLDAPTDEIO::save( Ticket* )
{ {
kdDebug(7125) << "ResourceLDAPKIO save" << endl; kdDebug(7125) << "ResourceLDAPTDEIO save" << endl;
d->mSaveIt = begin(); d->mSaveIt = begin();
TDEIO::Job *job = TDEIO::put( d->mLDAPUrl, -1, true, false, false ); TDEIO::Job *job = TDEIO::put( d->mLDAPUrl, -1, true, false, false );
@ -736,10 +736,10 @@ bool ResourceLDAPTDEIO::save( Ticket* )
this, TQT_SLOT( syncLoadSaveResult( TDEIO::Job* ) ) ); this, TQT_SLOT( syncLoadSaveResult( TDEIO::Job* ) ) );
enter_loop(); enter_loop();
if ( mErrorMsg.isEmpty() ) { if ( mErrorMsg.isEmpty() ) {
kdDebug(7125) << "ResourceLDAPKIO save ok!" << endl; kdDebug(7125) << "ResourceLDAPTDEIO save ok!" << endl;
return true; return true;
} else { } else {
kdDebug(7125) << "ResourceLDAPKIO finished with error: " << mErrorMsg << endl; kdDebug(7125) << "ResourceLDAPTDEIO finished with error: " << mErrorMsg << endl;
addressBook()->error( mErrorMsg ); addressBook()->error( mErrorMsg );
return false; return false;
} }
@ -747,7 +747,7 @@ bool ResourceLDAPTDEIO::save( Ticket* )
bool ResourceLDAPTDEIO::asyncSave( Ticket* ) bool ResourceLDAPTDEIO::asyncSave( Ticket* )
{ {
kdDebug(7125) << "ResourceLDAPKIO asyncSave" << endl; kdDebug(7125) << "ResourceLDAPTDEIO asyncSave" << endl;
d->mSaveIt = begin(); d->mSaveIt = begin();
TDEIO::Job *job = TDEIO::put( d->mLDAPUrl, -1, true, false, false ); TDEIO::Job *job = TDEIO::put( d->mLDAPUrl, -1, true, false, false );
connect( job, TQT_SIGNAL( dataReq( TDEIO::Job*, TQByteArray& ) ), connect( job, TQT_SIGNAL( dataReq( TDEIO::Job*, TQByteArray& ) ),
@ -784,15 +784,15 @@ void ResourceLDAPTDEIO::saveData( TDEIO::Job*, TQByteArray& data )
!(*d->mSaveIt).changed() ) d->mSaveIt++; !(*d->mSaveIt).changed() ) d->mSaveIt++;
if ( d->mSaveIt == end() ) { if ( d->mSaveIt == end() ) {
kdDebug(7125) << "ResourceLDAPKIO endData" << endl; kdDebug(7125) << "ResourceLDAPTDEIO endData" << endl;
data.resize(0); data.resize(0);
return; return;
} }
kdDebug(7125) << "ResourceLDAPKIO saveData: " << (*d->mSaveIt).assembledName() << endl; kdDebug(7125) << "ResourceLDAPTDEIO saveData: " << (*d->mSaveIt).assembledName() << endl;
AddresseeToLDIF( data, *d->mSaveIt, findUid( (*d->mSaveIt).uid() ) ); AddresseeToLDIF( data, *d->mSaveIt, findUid( (*d->mSaveIt).uid() ) );
// kdDebug(7125) << "ResourceLDAPKIO save LDIF: " << TQString::fromUtf8(data) << endl; // kdDebug(7125) << "ResourceLDAPTDEIO save LDIF: " << TQString::fromUtf8(data) << endl;
// mark as unchanged // mark as unchanged
(*d->mSaveIt).setChanged( false ); (*d->mSaveIt).setChanged( false );
@ -803,14 +803,14 @@ void ResourceLDAPTDEIO::removeAddressee( const Addressee& addr )
{ {
TQString dn = findUid( addr.uid() ); TQString dn = findUid( addr.uid() );
kdDebug(7125) << "ResourceLDAPKIO: removeAddressee: " << dn << endl; kdDebug(7125) << "ResourceLDAPTDEIO: removeAddressee: " << dn << endl;
if ( !mErrorMsg.isEmpty() ) { if ( !mErrorMsg.isEmpty() ) {
addressBook()->error( mErrorMsg ); addressBook()->error( mErrorMsg );
return; return;
} }
if ( !dn.isEmpty() ) { if ( !dn.isEmpty() ) {
kdDebug(7125) << "ResourceLDAPKIO: found uid: " << dn << endl; kdDebug(7125) << "ResourceLDAPTDEIO: found uid: " << dn << endl;
LDAPUrl url( d->mLDAPUrl ); LDAPUrl url( d->mLDAPUrl );
url.setPath( "/" + dn ); url.setPath( "/" + dn );
url.setExtension( "x-dir", "base" ); url.setExtension( "x-dir", "base" );

@ -30,15 +30,15 @@ class TDEConfig;
namespace KABC { namespace KABC {
class KABC_EXPORT ResourceLDAPKIO : public Resource class KABC_EXPORT ResourceLDAPTDEIO : public Resource
{ {
Q_OBJECT Q_OBJECT
public: public:
enum CachePolicy{ Cache_No, Cache_NoConnection, Cache_Always }; enum CachePolicy{ Cache_No, Cache_NoConnection, Cache_Always };
ResourceLDAPKIO( const TDEConfig* ); ResourceLDAPTDEIO( const TDEConfig* );
virtual ~ResourceLDAPKIO(); virtual ~ResourceLDAPTDEIO();
/** /**
* Call this after you used one of the set... methods * Call this after you used one of the set... methods
*/ */
@ -162,8 +162,8 @@ protected slots:
bool AddresseeToLDIF( TQByteArray &ldif, const Addressee &addr, bool AddresseeToLDIF( TQByteArray &ldif, const Addressee &addr,
const TQString &olddn ); const TQString &olddn );
class ResourceLDAPKIOPrivate; class ResourceLDAPTDEIOPrivate;
ResourceLDAPKIOPrivate *d; ResourceLDAPTDEIOPrivate *d;
}; };
} }

@ -64,7 +64,7 @@ ResourceLDAPTDEIOConfig::ResourceLDAPTDEIOConfig( TQWidget* parent, const char*
void ResourceLDAPTDEIOConfig::loadSettings( KRES::Resource *res ) void ResourceLDAPTDEIOConfig::loadSettings( KRES::Resource *res )
{ {
ResourceLDAPKIO *resource = dynamic_cast<ResourceLDAPKIO*>( res ); ResourceLDAPTDEIO *resource = dynamic_cast<ResourceLDAPTDEIO*>( res );
if ( !resource ) { if ( !resource ) {
kdDebug(5700) << "ResourceLDAPTDEIOConfig::loadSettings(): cast failed" << endl; kdDebug(5700) << "ResourceLDAPTDEIOConfig::loadSettings(): cast failed" << endl;
@ -100,7 +100,7 @@ void ResourceLDAPTDEIOConfig::loadSettings( KRES::Resource *res )
void ResourceLDAPTDEIOConfig::saveSettings( KRES::Resource *res ) void ResourceLDAPTDEIOConfig::saveSettings( KRES::Resource *res )
{ {
ResourceLDAPKIO *resource = dynamic_cast<ResourceLDAPKIO*>( res ); ResourceLDAPTDEIO *resource = dynamic_cast<ResourceLDAPTDEIO*>( res );
if ( !resource ) { if ( !resource ) {
kdDebug(5700) << "ResourceLDAPTDEIOConfig::saveSettings(): cast failed" << endl; kdDebug(5700) << "ResourceLDAPTDEIOConfig::saveSettings(): cast failed" << endl;

@ -31,6 +31,6 @@ extern "C"
KDE_EXPORT void *init_kabc_ldapkio() KDE_EXPORT void *init_kabc_ldapkio()
{ {
TDEGlobal::locale()->insertCatalogue("kabc_ldapkio"); TDEGlobal::locale()->insertCatalogue("kabc_ldapkio");
return new KRES::PluginFactory<ResourceLDAPKIO, ResourceLDAPTDEIOConfig>(); return new KRES::PluginFactory<ResourceLDAPTDEIO, ResourceLDAPTDEIOConfig>();
} }
} }

Loading…
Cancel
Save