summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/obackendfactory.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/obackendfactory.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index f11f029..89b8c58 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -7,49 +7,57 @@
7 *This program is free software; you can redistribute it and/or 7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; 9 * License as published by the Free Software Foundation;
10 * either version 2 of the License, or (at your option) any later 10 * either version 2 of the License, or (at your option) any later
11 * version. 11 * version.
12 * ===================================================================== 12 * =====================================================================
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.3 2002/10/10 17:08:58 zecke
20 * The Cache is finally in place
21 * I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;)
22 * The read ahead functionality does not make sense for XMLs backends because most of the stuff is already in memory. While using readahead on SQL makes things a lot faster....
23 * I still have to fully implement read ahead
24 * This change is bic but sc
25 *
19 * Revision 1.2 2002/10/08 09:27:36 eilers 26 * Revision 1.2 2002/10/08 09:27:36 eilers
20 * Fixed libopie.pro to include the new pim-API. 27 * Fixed libopie.pro to include the new pim-API.
21 * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to 28 * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to
22 * compile itself would need to install libsqlite, libopiesql... 29 * compile itself would need to install libsqlite, libopiesql...
23 * Therefore, the backend currently uses XML only.. 30 * Therefore, the backend currently uses XML only..
24 * 31 *
25 * Revision 1.1 2002/10/07 17:35:01 eilers 32 * Revision 1.1 2002/10/07 17:35:01 eilers
26 * added OBackendFactory for advanced backend access 33 * added OBackendFactory for advanced backend access
27 * 34 *
28 * 35 *
29 * ===================================================================== 36 * =====================================================================
30 */ 37 */
31#ifndef __OPIE_BACKENDFACTORY_H_ 38#ifndef OPIE_BACKENDFACTORY_H_
32#define __OPIE_BACKENDFACTORY_H_ 39#define OPIE_BACKENDFACTORY_H_
33 40
34#include <qstring.h> 41#include <qstring.h>
35#include <qasciidict.h> 42#include <qasciidict.h>
36#include <qpe/config.h> 43#include <qpe/config.h>
37 44
38#include "otodoaccessxml.h" 45#include "otodoaccessxml.h"
39#include "ocontactaccessbackend_xml.h" 46#include "ocontactaccessbackend_xml.h"
40 47
41#ifdef __USE_SQL 48/*#ifdef __USE_SQL
42#include "otodoaccesssql.h" 49#include "otodoaccesssql.h"
43#endif 50#endif
51*/
44 52
45template<class T> 53template<class T>
46class OBackendFactory 54class OBackendFactory
47{ 55{
48 public: 56 public:
49 OBackendFactory() {}; 57 OBackendFactory() {};
50 58
51 enum BACKENDS { 59 enum BACKENDS {
52 TODO, 60 TODO,
53 CONTACT, 61 CONTACT,
54 DATE 62 DATE
55 }; 63 };
@@ -63,31 +71,31 @@ class OBackendFactory
63 71
64 QAsciiDict<int> dict ( 3 ); 72 QAsciiDict<int> dict ( 3 );
65 dict.setAutoDelete ( TRUE ); 73 dict.setAutoDelete ( TRUE );
66 74
67 dict.insert( "todo", new int (TODO) ); 75 dict.insert( "todo", new int (TODO) );
68 dict.insert( "contact", new int (CONTACT) ); 76 dict.insert( "contact", new int (CONTACT) );
69 77
70 qWarning ("TODO is: %d", TODO); 78 qWarning ("TODO is: %d", TODO);
71 qWarning ("CONTACT is: %d", CONTACT); 79 qWarning ("CONTACT is: %d", CONTACT);
72 80
73 switch ( *dict.take( backendName ) ){ 81 switch ( *dict.take( backendName ) ){
74 case TODO: 82 case TODO:
75#ifdef __USE_SQL 83/*#ifdef __USE_SQL
76 if ( backend == "sql" ) 84 if ( backend == "sql" )
77 return (T*) new OTodoAccessBackendSQL(""); 85 return (T*) new OTodoAccessBackendSQL("");
78#else 86#else*/
79 if ( backend == "sql" ) 87 if ( backend == "sql" )
80 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); 88 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
81#endif 89//#endif
82 90
83 return (T*) new OTodoAccessXML( appName ); 91 return (T*) new OTodoAccessXML( appName );
84 case CONTACT: 92 case CONTACT:
85 if ( backend == "sql" ) 93 if ( backend == "sql" )
86 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); 94 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
87 95
88 return (T*) new OContactAccessBackend_XML( appName ); 96 return (T*) new OContactAccessBackend_XML( appName );
89 case DATE: 97 case DATE:
90 qWarning ("OBackendFactory:: DATE-Backend not implemented!"); 98 qWarning ("OBackendFactory:: DATE-Backend not implemented!");
91 return NULL; 99 return NULL;
92 default: 100 default:
93 return NULL; 101 return NULL;