summaryrefslogtreecommitdiff
path: root/libopie
authoreilers <eilers>2002-10-14 15:55:18 (UTC)
committer eilers <eilers>2002-10-14 15:55:18 (UTC)
commit16caa7343f4190a31bd80a9caa76118d7177ad3f (patch) (unidiff)
tree0f1e71fbe2be969c2620b88e645ad12174b887ef /libopie
parent17e4897122da8089fadb05496d09fb196919f674 (diff)
downloadopie-16caa7343f4190a31bd80a9caa76118d7177ad3f.zip
opie-16caa7343f4190a31bd80a9caa76118d7177ad3f.tar.gz
opie-16caa7343f4190a31bd80a9caa76118d7177ad3f.tar.bz2
Redeactivate SQL.. ;)
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/obackendfactory.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/libopie/pim/obackendfactory.h b/libopie/pim/obackendfactory.h
index 89b8c58..b796fb8 100644
--- a/libopie/pim/obackendfactory.h
+++ b/libopie/pim/obackendfactory.h
@@ -7,24 +7,27 @@
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.4 2002/10/14 15:55:18 eilers
20 * Redeactivate SQL.. ;)
21 *
19 * Revision 1.3 2002/10/10 17:08:58 zecke 22 * Revision 1.3 2002/10/10 17:08:58 zecke
20 * The Cache is finally in place 23 * The Cache is finally in place
21 * I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;) 24 * 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.... 25 * 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 26 * I still have to fully implement read ahead
24 * This change is bic but sc 27 * This change is bic but sc
25 * 28 *
26 * Revision 1.2 2002/10/08 09:27:36 eilers 29 * Revision 1.2 2002/10/08 09:27:36 eilers
27 * Fixed libopie.pro to include the new pim-API. 30 * Fixed libopie.pro to include the new pim-API.
28 * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to 31 * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to
29 * compile itself would need to install libsqlite, libopiesql... 32 * compile itself would need to install libsqlite, libopiesql...
30 * Therefore, the backend currently uses XML only.. 33 * Therefore, the backend currently uses XML only..
@@ -36,66 +39,67 @@
36 * ===================================================================== 39 * =====================================================================
37 */ 40 */
38#ifndef OPIE_BACKENDFACTORY_H_ 41#ifndef OPIE_BACKENDFACTORY_H_
39#define OPIE_BACKENDFACTORY_H_ 42#define OPIE_BACKENDFACTORY_H_
40 43
41#include <qstring.h> 44#include <qstring.h>
42#include <qasciidict.h> 45#include <qasciidict.h>
43#include <qpe/config.h> 46#include <qpe/config.h>
44 47
45#include "otodoaccessxml.h" 48#include "otodoaccessxml.h"
46#include "ocontactaccessbackend_xml.h" 49#include "ocontactaccessbackend_xml.h"
47 50
48/*#ifdef __USE_SQL 51#ifdef __USE_SQL
49#include "otodoaccesssql.h" 52#include "otodoaccesssql.h"
50#endif 53#endif
51*/ 54
52 55
53template<class T> 56template<class T>
54class OBackendFactory 57class OBackendFactory
55{ 58{
56 public: 59 public:
57 OBackendFactory() {}; 60 OBackendFactory() {};
58 61
59 enum BACKENDS { 62 enum BACKENDS {
60 TODO, 63 TODO,
61 CONTACT, 64 CONTACT,
62 DATE 65 DATE
63 }; 66 };
64 67
65 static T* Default( const QString backendName, const QString& appName ){ 68 static T* Default( const QString backendName, const QString& appName ){
66 69
70 // __asm__("int3");
67 71
68 Config config( "pimaccess" ); 72 Config config( "pimaccess" );
69 config.setGroup ( backendName ); 73 config.setGroup ( backendName );
70 QString backend = config.readEntry( "usebackend" ); 74 QString backend = config.readEntry( "usebackend" );
71 75
72 QAsciiDict<int> dict ( 3 ); 76 QAsciiDict<int> dict ( 3 );
73 dict.setAutoDelete ( TRUE ); 77 dict.setAutoDelete ( TRUE );
74 78
75 dict.insert( "todo", new int (TODO) ); 79 dict.insert( "todo", new int (TODO) );
76 dict.insert( "contact", new int (CONTACT) ); 80 dict.insert( "contact", new int (CONTACT) );
77 81
78 qWarning ("TODO is: %d", TODO); 82 qWarning ("TODO is: %d", TODO);
79 qWarning ("CONTACT is: %d", CONTACT); 83 qWarning ("CONTACT is: %d", CONTACT);
80 84
81 switch ( *dict.take( backendName ) ){ 85 switch ( *dict.take( backendName ) ){
82 case TODO: 86 case TODO:
83/*#ifdef __USE_SQL 87#ifdef __USE_SQL
84 if ( backend == "sql" ) 88 if ( backend == "sql" )
85 return (T*) new OTodoAccessBackendSQL(""); 89 return (T*) new OTodoAccessBackendSQL("");
86#else*/ 90#else
87 if ( backend == "sql" ) 91 if ( backend == "sql" )
88 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); 92 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
89//#endif 93#endif
90 94
91 return (T*) new OTodoAccessXML( appName ); 95 return (T*) new OTodoAccessXML( appName );
92 case CONTACT: 96 case CONTACT:
93 if ( backend == "sql" ) 97 if ( backend == "sql" )
94 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); 98 qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
95 99
96 return (T*) new OContactAccessBackend_XML( appName ); 100 return (T*) new OContactAccessBackend_XML( appName );
97 case DATE: 101 case DATE:
98 qWarning ("OBackendFactory:: DATE-Backend not implemented!"); 102 qWarning ("OBackendFactory:: DATE-Backend not implemented!");
99 return NULL; 103 return NULL;
100 default: 104 default:
101 return NULL; 105 return NULL;