summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/pimconverter/converter.cpp69
1 files changed, 24 insertions, 45 deletions
diff --git a/noncore/tools/pimconverter/converter.cpp b/noncore/tools/pimconverter/converter.cpp
index 1091f4a..2bd47a4 100644
--- a/noncore/tools/pimconverter/converter.cpp
+++ b/noncore/tools/pimconverter/converter.cpp
@@ -9,17 +9,9 @@
-#include <opie2/ocontactaccess.h>
-#include <opie2/ocontactaccessbackend_xml.h>
-#include <opie2/ocontactaccessbackend_sql.h>
-
-#include <opie2/otodoaccess.h>
-#include <opie2/otodoaccessxml.h>
-#include <opie2/otodoaccesssql.h>
-
-#include <opie2/odatebookaccess.h>
-#include <opie2/odatebookaccessbackend_xml.h>
-#include <opie2/odatebookaccessbackend_sql.h>
-
-// #define _ADDRESSBOOK_ACCESS
+#include <opie2/opimglobal.h>
+// Include SQL related header files
+#define __USE_SQL
+#include <opie2/opimaccessfactory.h>
using namespace Opie;
+using namespace Pim;
@@ -62,4 +54,3 @@ void Converter::start_conversion(){
case ADDRESSBOOK:{
- OPimContactAccessBackend* sourceBackend = new OPimContactAccessBackend_XML( "Converter", QString::null );
- sourceDB = new OPimContactAccess ( "addressbook_xml", QString::null , sourceBackend, true );
+ sourceDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::XML, "converter" );
}
@@ -67,8 +58,6 @@ void Converter::start_conversion(){
case TODOLIST:{
- OPimTodoAccessBackend* sourceBackend = new OPimTodoAccessXML( "Converter" );
- sourceDB = new OPimTodoAccess( sourceBackend );
+ sourceDB = OPimAccessFactory<OPimTodoAccess>::create( OPimGlobal::TODOLIST, OPimGlobal::XML, "converter" );
}break;
case DATEBOOK:{
- ODateBookAccessBackend_XML* sourceBackend = new ODateBookAccessBackend_XML( "Converter", QString::null );
- sourceDB = new ODateBookAccess ( sourceBackend );
+ sourceDB = OPimAccessFactory<ODateBookAccess>::create( OPimGlobal::DATEBOOK, OPimGlobal::XML, "converter" );
}
@@ -84,15 +73,11 @@ void Converter::start_conversion(){
case ADDRESSBOOK:{
- qDebug("SQLSourceDB = %d", m_selectedDatabase);
- OPimContactAccessBackend* sourceBackend = new OPimContactAccessBackend_SQL( QString::null, QString::null );
- sourceDB = new OPimContactAccess ( "Converter", QString::null, sourceBackend, true );
- }
+ sourceDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::SQL, "converter" );
+ }
break;
case TODOLIST:{
- OPimTodoAccessBackend* sourceBackend = new OPimTodoAccessBackendSQL( QString::null );
- sourceDB = new OPimTodoAccess( sourceBackend );
+ sourceDB = OPimAccessFactory<OPimTodoAccess>::create( OPimGlobal::TODOLIST, OPimGlobal::SQL, "converter" );
}break;
- case DATEBOOK: {
- ODateBookAccessBackend_SQL* sourceBackend = new ODateBookAccessBackend_SQL( "Converter", QString::null );
- sourceDB = new ODateBookAccess ( sourceBackend );
- }
+ case DATEBOOK:{
+ sourceDB = OPimAccessFactory<ODateBookAccess>::create( OPimGlobal::DATEBOOK, OPimGlobal::SQL, "converter" );
+ }
break;
@@ -113,14 +98,11 @@ void Converter::start_conversion(){
case ADDRESSBOOK:{
- OPimContactAccessBackend* destBackend = new OPimContactAccessBackend_XML( "Converter", QString::null );
- destDB = new OPimContactAccess ( "Converter", QString::null , destBackend, true );
- }
+ destDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::XML, "converter" );
+ }
break;
case TODOLIST:{
- OPimTodoAccessBackend* destBackend = new OPimTodoAccessXML( "Converter" );
- destDB = new OPimTodoAccess( destBackend );
+ destDB = OPimAccessFactory<OPimTodoAccess>::create( OPimGlobal::TODOLIST, OPimGlobal::XML, "converter" );
}break;
case DATEBOOK:{
- ODateBookAccessBackend_XML* destBackend = new ODateBookAccessBackend_XML( "Converter", QString::null );
- destDB = new ODateBookAccess ( destBackend );
- }
+ destDB = OPimAccessFactory<ODateBookAccess>::create( OPimGlobal::DATEBOOK, OPimGlobal::XML, "converter" );
+ }
break;
@@ -135,14 +117,11 @@ void Converter::start_conversion(){
case ADDRESSBOOK:{
- OPimContactAccessBackend* destBackend = new OPimContactAccessBackend_SQL( QString::null, QString::null );
- destDB = new OPimContactAccess ( "addressbook_xml", QString::null , destBackend, true );
- }
+ destDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::SQL, "converter" );
+ }
break;
case TODOLIST:{
- OPimTodoAccessBackend* destBackend = new OPimTodoAccessBackendSQL( QString::null );
- destDB = new OPimTodoAccess( destBackend );
+ destDB = OPimAccessFactory<OPimTodoAccess>::create( OPimGlobal::TODOLIST, OPimGlobal::SQL, "converter" );
}break;
case DATEBOOK:{
- ODateBookAccessBackend_SQL* destBackend = new ODateBookAccessBackend_SQL( "Converter", QString::null );
- destDB = new ODateBookAccess ( destBackend );
- }
+ destDB = OPimAccessFactory<ODateBookAccess>::create( OPimGlobal::DATEBOOK, OPimGlobal::SQL, "converter" );
+ }
break;