-rw-r--r-- | libopie/pim/obackendfactory.h | 17 | ||||
-rw-r--r-- | libopie/pim/otodoaccess.cpp | 9 |
2 files changed, 20 insertions, 6 deletions
diff --git a/libopie/pim/obackendfactory.h b/libopie/pim/obackendfactory.h index 599fbf2..f11f029 100644 --- a/libopie/pim/obackendfactory.h +++ b/libopie/pim/obackendfactory.h | |||
@@ -13,12 +13,18 @@ | |||
13 | * ToDo: Use plugins | 13 | * ToDo: Use plugins |
14 | * ===================================================================== | 14 | * ===================================================================== |
15 | * Version: $Id$ | 15 | * Version: $Id$ |
16 | * ===================================================================== | 16 | * ===================================================================== |
17 | * History: | 17 | * History: |
18 | * $Log$ | 18 | * $Log$ |
19 | * Revision 1.2 2002/10/08 09:27:36 eilers | ||
20 | * Fixed libopie.pro to include the new pim-API. | ||
21 | * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to | ||
22 | * compile itself would need to install libsqlite, libopiesql... | ||
23 | * Therefore, the backend currently uses XML only.. | ||
24 | * | ||
19 | * Revision 1.1 2002/10/07 17:35:01 eilers | 25 | * Revision 1.1 2002/10/07 17:35:01 eilers |
20 | * added OBackendFactory for advanced backend access | 26 | * added OBackendFactory for advanced backend access |
21 | * | 27 | * |
22 | * | 28 | * |
23 | * ===================================================================== | 29 | * ===================================================================== |
24 | */ | 30 | */ |
@@ -28,14 +34,16 @@ | |||
28 | #include <qstring.h> | 34 | #include <qstring.h> |
29 | #include <qasciidict.h> | 35 | #include <qasciidict.h> |
30 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
31 | 37 | ||
32 | #include "otodoaccessxml.h" | 38 | #include "otodoaccessxml.h" |
33 | #include "ocontactaccessbackend_xml.h" | 39 | #include "ocontactaccessbackend_xml.h" |
34 | #include "otodoaccesssql.h" | ||
35 | 40 | ||
41 | #ifdef __USE_SQL | ||
42 | #include "otodoaccesssql.h" | ||
43 | #endif | ||
36 | 44 | ||
37 | template<class T> | 45 | template<class T> |
38 | class OBackendFactory | 46 | class OBackendFactory |
39 | { | 47 | { |
40 | public: | 48 | public: |
41 | OBackendFactory() {}; | 49 | OBackendFactory() {}; |
@@ -61,15 +69,20 @@ class OBackendFactory | |||
61 | 69 | ||
62 | qWarning ("TODO is: %d", TODO); | 70 | qWarning ("TODO is: %d", TODO); |
63 | qWarning ("CONTACT is: %d", CONTACT); | 71 | qWarning ("CONTACT is: %d", CONTACT); |
64 | 72 | ||
65 | switch ( *dict.take( backendName ) ){ | 73 | switch ( *dict.take( backendName ) ){ |
66 | case TODO: | 74 | case TODO: |
75 | #ifdef __USE_SQL | ||
67 | if ( backend == "sql" ) | 76 | if ( backend == "sql" ) |
68 | return (T*) new OTodoAccessBackendSQL(""); | 77 | return (T*) new OTodoAccessBackendSQL(""); |
69 | 78 | #else | |
79 | if ( backend == "sql" ) | ||
80 | qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); | ||
81 | #endif | ||
82 | |||
70 | return (T*) new OTodoAccessXML( appName ); | 83 | return (T*) new OTodoAccessXML( appName ); |
71 | case CONTACT: | 84 | case CONTACT: |
72 | if ( backend == "sql" ) | 85 | if ( backend == "sql" ) |
73 | qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); | 86 | qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); |
74 | 87 | ||
75 | return (T*) new OContactAccessBackend_XML( appName ); | 88 | return (T*) new OContactAccessBackend_XML( appName ); |
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp index 4468812..80424d9 100644 --- a/libopie/pim/otodoaccess.cpp +++ b/libopie/pim/otodoaccess.cpp | |||
@@ -6,17 +6,18 @@ | |||
6 | #include "otodoaccess.h" | 6 | #include "otodoaccess.h" |
7 | #include "obackendfactory.h" | 7 | #include "obackendfactory.h" |
8 | 8 | ||
9 | OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) | 9 | OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) |
10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) | 10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) |
11 | { | 11 | { |
12 | if (end == 0l ) | 12 | // if (end == 0l ) |
13 | m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); | 13 | // m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); |
14 | 14 | ||
15 | // if (end == 0l ) | 15 | // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben ! |
16 | // m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); | 16 | if (end == 0l ) |
17 | m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); | ||
17 | 18 | ||
18 | setBackEnd( m_todoBackEnd ); | 19 | setBackEnd( m_todoBackEnd ); |
19 | } | 20 | } |
20 | OTodoAccess::~OTodoAccess() { | 21 | OTodoAccess::~OTodoAccess() { |
21 | // qWarning("~OTodoAccess"); | 22 | // qWarning("~OTodoAccess"); |
22 | } | 23 | } |