-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index a4f8d8a..3b2a6b7 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -174,97 +174,98 @@ bool ResourceOpie::doOpen() void ResourceOpie::doClose() { // qDebug("ResourceOpie::doClose() %s", mFileName.latin1()); } bool ResourceOpie::load() { // qDebug("ResourceOpie::load() %s", mFileName.latin1()); kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl; qDebug("ResourceOpie::load: Try to load file() %s", mFileName.latin1()); OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KDEPim/Pi", mFileName ); OContactAccess* access = new OContactAccess("KDEPim/Pi", 0l, backend, false); if ( !access ) { qDebug("Unable to load file() %s", mFileName.latin1()); addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); return false; } access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available if (mConverter == 0) mConverter = new OpieConverter(); OContactAccess::List::Iterator it; OContactAccess::List allList = access->allRecords(); bool res = false; for ( it = allList.begin(); it != allList.end(); ++it ) { OContact c = (*it); KABC::Addressee addressee; res = mConverter->opieToAddressee( c, addressee ); if ( !addressee.isEmpty() && res ) { addressee.setResource( this ); addressBook()->insertAddressee( addressee ); } // qDebug("found %s", c.fullName().latin1()); } delete access; - delete backend; + // it seems so, that deletion of access deletes backend as well + //delete backend; return true; } bool ResourceOpie::save( Ticket *ticket ) { qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1()); /*US qDebug("ResourceOpie::save %s", mFileName.latin1()); kdDebug(5700) << "ResourceOpie::save()" << endl; // create backup file QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); */ /*US we use a simpler method to create a backupfile (void) KSaveFile::backupFile( mFileName, QString::null ,extension ); KSaveFile saveFile( mFileName ); bool ok = false; if ( saveFile.status() == 0 && saveFile.file() ) { mFormat->saveAll( addressBook(), this, saveFile.file() ); ok = saveFile.close(); } */ /*US //US ToDo: write backupfile QFile info; info.setName( mFileName ); bool ok = info.open( IO_WriteOnly ); if ( ok ) { //US mFormat->saveAll( addressBook(), this, &info ); info.close(); ok = true; } else { } if ( !ok ) addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); delete ticket; unlock( mFileName ); |