Diffstat (limited to 'kaddressbook/xxport/opie/opie_xxport.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index 90d05cd..f30a205 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp @@ -29,16 +29,18 @@ $Id$ */ #include <qdir.h> #include <kfiledialog.h> #include <kmessagebox.h> #include <opie/ocontactaccess.h> +#include <opie/ocontactaccessbackend_xml.h> + #include "stdaddressbook.h" /*US #include <qfile.h> #include <qtextstream.h> #include <kabc/vcardconverter.h> #ifndef KAB_EMBEDDED @@ -91,17 +93,18 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString QString fileName = KFileDialog::getSaveFileName( name ); #else //KAB_EMBEDDED QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); #endif //KAB_EMBEDDED if ( fileName.isEmpty() ) return true; - OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); + OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); + OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); if ( !access ) { qDebug("Unable to access file() %s", fileName.latin1()); addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); return false; } //Now check if the file has already entries, and ask the user if he wants to delete them first. @@ -134,16 +137,17 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString { qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } } access->save(); delete access; + delete backend; return true; } KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const { KABC::AddresseeList adrlst; @@ -153,17 +157,18 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const QString fileName = KFileDialog::getOpenFileName( name ); #else //KAB_EMBEDDED QString fileName = KFileDialog::getOpenFileName( name, i18n("Load file"), parentWidget() ); #endif //KAB_EMBEDDED if ( fileName.isEmpty() ) return KABC::AddresseeList(); - OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); + OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); + OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); if ( !access ) { qDebug("Unable to access file() %s", fileName.latin1()); addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); return KABC::AddresseeList(); } access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available @@ -185,12 +190,13 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const if ( !addressee.isEmpty() && res ) { adrlst.append( addressee ); } // qDebug("found %s", c.fullName().latin1()); } delete access; + delete backend; return adrlst; } |