summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-02 15:38:16 (UTC)
committer ulf69 <ulf69>2004-07-02 15:38:16 (UTC)
commit30988fc010930d5c43ca7bc51ba64d57210c3985 (patch) (side-by-side diff)
tree360ccd0055cb11d669f03baa350843e864746785
parentead0dcba2c607297137e2b47418eb17864e0caaa (diff)
downloadkdepimpi-30988fc010930d5c43ca7bc51ba64d57210c3985.zip
kdepimpi-30988fc010930d5c43ca7bc51ba64d57210c3985.tar.gz
kdepimpi-30988fc010930d5c43ca7bc51ba64d57210c3985.tar.bz2
bugfix: choosen filenames where not used while import/export and for resources
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.cpp7
-rw-r--r--kaddressbook/xxport/opie/opie_xxport.cpp10
2 files changed, 14 insertions, 3 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index f992301..a4f8d8a 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -41,16 +41,17 @@ $Id$
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
//US #include "formatfactory.h"
//US #include <qpe/qpeapplication.h>
#include <opie/ocontactaccess.h>
+#include <opie/ocontactaccessbackend_xml.h>
#include "resource.h"
#include "resourceopieconfig.h"
#include "stdaddressbook.h"
#include "opieconverter.h"
#include "resourceopie.h"
@@ -175,17 +176,20 @@ void ResourceOpie::doClose()
// qDebug("ResourceOpie::doClose() %s", mFileName.latin1());
}
bool ResourceOpie::load()
{
// qDebug("ResourceOpie::load() %s", mFileName.latin1());
kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl;
- OContactAccess* access = new OContactAccess("KDEPim/Pi", mFileName, 0l, false);
+ 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
@@ -210,16 +214,17 @@ bool ResourceOpie::load()
addressee.setResource( this );
addressBook()->insertAddressee( addressee );
}
// qDebug("found %s", c.fullName().latin1());
}
delete access;
+ delete backend;
return true;
}
bool ResourceOpie::save( Ticket *ticket )
{
qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1());
/*US
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;
}