summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/backends.pro6
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp2
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.h8
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp3
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp2
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.h8
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.h12
8 files changed, 31 insertions, 12 deletions
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro
index 4231a00..d4867ba 100644
--- a/libopie2/opiepim/backend/backends.pro
+++ b/libopie2/opiepim/backend/backends.pro
@@ -1,31 +1,33 @@
1SOURCES += core/backends/ocontactaccessbackend_sql.cpp \ 1SOURCES += core/backends/ocontactaccessbackend_sql.cpp \
2 core/backends/ocontactaccessbackend_vcard.cpp \ 2 core/backends/ocontactaccessbackend_vcard.cpp \
3 core/backends/ocontactaccessbackend_xml.cpp \ 3 core/backends/ocontactaccessbackend_xml.cpp \
4 core/backends/ocontactaccess.cpp \ 4 core/backends/ocontactaccess.cpp \
5 core/backends/odatebookaccessbackend.cpp \ 5 core/backends/odatebookaccessbackend.cpp \
6 core/backends/odatebookaccessbackend_xml.cpp \ 6 core/backends/odatebookaccessbackend_xml.cpp \
7 core/backends/otodoaccessbackend.cpp \ 7 core/backends/otodoaccessbackend.cpp \
8 core/backends/otodoaccess.cpp \ 8 core/backends/otodoaccess.cpp \
9 core/backends/otodoaccesssql.cpp \ 9 core/backends/otodoaccesssql.cpp \
10 core/backends/otodoaccessvcal.cpp \ 10 core/backends/otodoaccessvcal.cpp \
11 core/backends/otodoaccessxml.cpp \ 11 core/backends/otodoaccessxml.cpp \
12 core/backends/odatebookaccess.cpp \ 12 core/backends/odatebookaccess.cpp \
13 core/backends/odatebookaccessbackend_sql.cpp 13 core/backends/odatebookaccessbackend_sql.cpp \
14 core/backends/private/xmltree.cc
14 15
15HEADERS += core/backends/obackendfactory.h \ 16HEADERS += core/backends/obackendfactory.h \
16 core/backends/ocontactaccessbackend.h \ 17 core/backends/ocontactaccessbackend.h \
17 core/backends/ocontactaccessbackend_sql.h \ 18 core/backends/ocontactaccessbackend_sql.h \
18 core/backends/ocontactaccessbackend_vcard.h \ 19 core/backends/ocontactaccessbackend_vcard.h \
19 core/backends/ocontactaccessbackend_xml.h \ 20 core/backends/ocontactaccessbackend_xml.h \
20 core/backends/ocontactaccess.h \ 21 core/backends/ocontactaccess.h \
21 core/backends/odatebookaccessbackend.h \ 22 core/backends/odatebookaccessbackend.h \
22 core/backends/odatebookaccessbackend_sql.h \ 23 core/backends/odatebookaccessbackend_sql.h \
23 core/backends/odatebookaccessbackend_xml.h \ 24 core/backends/odatebookaccessbackend_xml.h \
24 core/backends/opimaccessbackend.h \ 25 core/backends/opimaccessbackend.h \
25 core/backends/opimaccesstemplate.h \ 26 core/backends/opimaccesstemplate.h \
26 core/backends/otodoaccessbackend.h \ 27 core/backends/otodoaccessbackend.h \
27 core/backends/otodoaccess.h \ 28 core/backends/otodoaccess.h \
28 core/backends/otodoaccesssql.h \ 29 core/backends/otodoaccesssql.h \
29 core/backends/otodoaccessvcal.h \ 30 core/backends/otodoaccessvcal.h \
30 core/backends/otodoaccessxml.h \ 31 core/backends/otodoaccessxml.h \
31 core/backends/odatebookaccess.h 32 core/backends/odatebookaccess.h \
33 core/backends/private/xmltree.h
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
index f121cc2..d16d692 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
@@ -37,25 +37,25 @@
37#include <qstringlist.h> 37#include <qstringlist.h>
38 38
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/recordfields.h> 40#include <qpe/recordfields.h>
41 41
42#include <opie2/opimcontactfields.h> 42#include <opie2/opimcontactfields.h>
43#include <opie2/opimdateconversion.h> 43#include <opie2/opimdateconversion.h>
44#include <opie2/osqldriver.h> 44#include <opie2/osqldriver.h>
45#include <opie2/osqlresult.h> 45#include <opie2/osqlresult.h>
46#include <opie2/osqlmanager.h> 46#include <opie2/osqlmanager.h>
47#include <opie2/osqlquery.h> 47#include <opie2/osqlquery.h>
48 48
49 49using namespace Opie::DB;
50 50
51 51
52// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead 52// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead
53// vertical like "uid, type, value". 53// vertical like "uid, type, value".
54// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! 54// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !!
55#define __STORE_HORIZONTAL_ 55#define __STORE_HORIZONTAL_
56 56
57// Distinct loading is not very fast. If I expect that every person has just 57// Distinct loading is not very fast. If I expect that every person has just
58// one (and always one) 'Last Name', I can request all uid's for existing lastnames, 58// one (and always one) 'Last Name', I can request all uid's for existing lastnames,
59// which is faster.. 59// which is faster..
60// But this may not be true for all entries, like company contacts.. 60// But this may not be true for all entries, like company contacts..
61// The current AddressBook application handles this problem, but other may not.. (eilers) 61// The current AddressBook application handles this problem, but other may not.. (eilers)
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
index 58ae2ae..ba122ec 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h
@@ -31,27 +31,31 @@
31 */ 31 */
32 32
33#ifndef _OPimContactAccessBackend_SQL_ 33#ifndef _OPimContactAccessBackend_SQL_
34#define _OPimContactAccessBackend_SQL_ 34#define _OPimContactAccessBackend_SQL_
35 35
36#include <opie2/ocontactaccessbackend.h> 36#include <opie2/ocontactaccessbackend.h>
37#include <opie2/ocontactaccess.h> 37#include <opie2/ocontactaccess.h>
38 38
39#include <qlist.h> 39#include <qlist.h>
40#include <qdict.h> 40#include <qdict.h>
41 41
42/* aren't in namespace Opie yet - alwin */ 42/* aren't in namespace Opie yet - alwin */
43namespace Opie {
44namespace DB {
43class OSQLDriver; 45class OSQLDriver;
44class OSQLResult; 46class OSQLResult;
45class OSQLResultItem; 47class OSQLResultItem;
48}
49}
46 50
47namespace Opie { 51namespace Opie {
48 52
49/* the default xml implementation */ 53/* the default xml implementation */
50/** 54/**
51 * This class is the SQL implementation of a Contact backend 55 * This class is the SQL implementation of a Contact backend
52 * it does implement everything available for OPimContact. 56 * it does implement everything available for OPimContact.
53 * @see OPimAccessBackend for more information of available methods 57 * @see OPimAccessBackend for more information of available methods
54 */ 58 */
55class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { 59class OPimContactAccessBackend_SQL : public OPimContactAccessBackend {
56 public: 60 public:
57 OPimContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); 61 OPimContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null );
@@ -82,28 +86,28 @@ class OPimContactAccessBackend_SQL : public OPimContactAccessBackend {
82 bool hasQuerySettings (uint querySettings) const; 86 bool hasQuerySettings (uint querySettings) const;
83 87
84 // Currently only asc implemented.. 88 // Currently only asc implemented..
85 QArray<int> sorted( bool asc, int , int , int ); 89 QArray<int> sorted( bool asc, int , int , int );
86 bool add ( const OPimContact &newcontact ); 90 bool add ( const OPimContact &newcontact );
87 91
88 bool replace ( const OPimContact &contact ); 92 bool replace ( const OPimContact &contact );
89 93
90 bool remove ( int uid ); 94 bool remove ( int uid );
91 bool reload(); 95 bool reload();
92 96
93 private: 97 private:
94 QArray<int> extractUids( OSQLResult& res ) const; 98 QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
95 QMap<int, QString> requestNonCustom( int uid ) const; 99 QMap<int, QString> requestNonCustom( int uid ) const;
96 QMap<QString, QString> requestCustom( int uid ) const; 100 QMap<QString, QString> requestCustom( int uid ) const;
97 void update(); 101 void update();
98 102
99 protected: 103 protected:
100 bool m_changed; 104 bool m_changed;
101 QString m_fileName; 105 QString m_fileName;
102 QArray<int> m_uids; 106 QArray<int> m_uids;
103 107
104 OSQLDriver* m_driver; 108 Opie::DB::OSQLDriver* m_driver;
105}; 109};
106 110
107} 111}
108 112
109#endif 113#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index 5d92b8f..f5e76d5 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -32,32 +32,33 @@
32 32
33#include <opie2/ocontactaccessbackend_xml.h> 33#include <opie2/ocontactaccessbackend_xml.h>
34 34
35#include <qasciidict.h> 35#include <qasciidict.h>
36#include <qfile.h> 36#include <qfile.h>
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qarray.h> 39#include <qarray.h>
40#include <qmap.h> 40#include <qmap.h>
41 41
42#include <qpe/global.h> 42#include <qpe/global.h>
43 43
44#include <opie2/xmltree.h> 44#include "private/xmltree.h"
45#include <opie2/ocontactaccessbackend.h> 45#include <opie2/ocontactaccessbackend.h>
46#include <opie2/ocontactaccess.h> 46#include <opie2/ocontactaccess.h>
47 47
48#include <stdlib.h> 48#include <stdlib.h>
49#include <errno.h> 49#include <errno.h>
50 50
51using namespace Opie; 51using namespace Opie;
52using namespace Opie::Pim::Private;
52 53
53 54
54namespace Opie { 55namespace Opie {
55OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ): 56OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ):
56 m_changed( false ) 57 m_changed( false )
57{ 58{
58 // Just m_contactlist should call delete if an entry 59 // Just m_contactlist should call delete if an entry
59 // is removed. 60 // is removed.
60 m_contactList.setAutoDelete( true ); 61 m_contactList.setAutoDelete( true );
61 m_uidToContact.setAutoDelete( false ); 62 m_uidToContact.setAutoDelete( false );
62 63
63 m_appName = appname; 64 m_appName = appname;
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 2ee76cc..a779dc1 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -37,24 +37,26 @@
37#include <qarray.h> 37#include <qarray.h>
38#include <qstringlist.h> 38#include <qstringlist.h>
39 39
40#include <qpe/global.h> 40#include <qpe/global.h>
41 41
42#include <opie2/osqldriver.h> 42#include <opie2/osqldriver.h>
43#include <opie2/osqlmanager.h> 43#include <opie2/osqlmanager.h>
44#include <opie2/osqlquery.h> 44#include <opie2/osqlquery.h>
45 45
46#include <opie2/opimrecurrence.h> 46#include <opie2/opimrecurrence.h>
47#include <opie2/odatebookaccessbackend_sql.h> 47#include <opie2/odatebookaccessbackend_sql.h>
48 48
49using namespace Opie::DB;
50
49namespace Opie { 51namespace Opie {
50 52
51 53
52ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , 54ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
53 const QString& fileName ) 55 const QString& fileName )
54 : ODateBookAccessBackend(), m_driver( NULL ) 56 : ODateBookAccessBackend(), m_driver( NULL )
55{ 57{
56 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; 58 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
57 59
58 // Get the standart sql-driver from the OSQLManager.. 60 // Get the standart sql-driver from the OSQLManager..
59 OSQLManager man; 61 OSQLManager man;
60 m_driver = man.standard(); 62 m_driver = man.standard();
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
index cbfeb97..60d7f21 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
@@ -25,25 +25,29 @@
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
30#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 30#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
31 31
32#include <qmap.h> 32#include <qmap.h>
33#include <opie2/osqlresult.h> 33#include <opie2/osqlresult.h>
34 34
35#include <opie2/odatebookaccessbackend.h> 35#include <opie2/odatebookaccessbackend.h>
36 36
37namespace Opie {
38namespace DB {
37class OSQLDriver; 39class OSQLDriver;
40}
41}
38 42
39namespace Opie { 43namespace Opie {
40/** 44/**
41 * This is the default SQL implementation for DateBoook SQL storage 45 * This is the default SQL implementation for DateBoook SQL storage
42 * It fully implements the interface 46 * It fully implements the interface
43 * @see ODateBookAccessBackend 47 * @see ODateBookAccessBackend
44 * @see OPimAccessBackend 48 * @see OPimAccessBackend
45 */ 49 */
46class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { 50class ODateBookAccessBackend_SQL : public ODateBookAccessBackend {
47public: 51public:
48 ODateBookAccessBackend_SQL( const QString& appName, 52 ODateBookAccessBackend_SQL( const QString& appName,
49 const QString& fileName = QString::null); 53 const QString& fileName = QString::null);
@@ -68,26 +72,26 @@ public:
68 72
69 OPimEvent::ValueList directNonRepeats(); 73 OPimEvent::ValueList directNonRepeats();
70 OPimEvent::ValueList directRawRepeats(); 74 OPimEvent::ValueList directRawRepeats();
71 75
72private: 76private:
73 bool loadFile(); 77 bool loadFile();
74 QString m_fileName; 78 QString m_fileName;
75 QArray<int> m_uids; 79 QArray<int> m_uids;
76 80
77 QMap<int, QString> m_fieldMap; 81 QMap<int, QString> m_fieldMap;
78 QMap<QString, int> m_reverseFieldMap; 82 QMap<QString, int> m_reverseFieldMap;
79 83
80 OSQLDriver* m_driver; 84 Opie::DB::OSQLDriver* m_driver;
81 85
82 class Private; 86 class Private;
83 Private *d; 87 Private *d;
84 88
85 void initFields(); 89 void initFields();
86 void update(); 90 void update();
87 QArray<int> extractUids( OSQLResult& res ) const; 91 QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
88 92
89}; 93};
90 94
91} 95}
92 96
93#endif 97#endif
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 72232e5..d218090 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -32,24 +32,26 @@
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#include <opie2/osqldriver.h> 34#include <opie2/osqldriver.h>
35#include <opie2/osqlresult.h> 35#include <opie2/osqlresult.h>
36#include <opie2/osqlmanager.h> 36#include <opie2/osqlmanager.h>
37#include <opie2/osqlquery.h> 37#include <opie2/osqlquery.h>
38 38
39#include <opie2/otodoaccesssql.h> 39#include <opie2/otodoaccesssql.h>
40#include <opie2/opimstate.h> 40#include <opie2/opimstate.h>
41#include <opie2/opimnotifymanager.h> 41#include <opie2/opimnotifymanager.h>
42#include <opie2/opimrecurrence.h> 42#include <opie2/opimrecurrence.h>
43 43
44using namespace Opie::DB;
45
44using namespace Opie; 46using namespace Opie;
45/* 47/*
46 * first some query 48 * first some query
47 * CREATE query 49 * CREATE query
48 * LOAD query 50 * LOAD query
49 * INSERT 51 * INSERT
50 * REMOVE 52 * REMOVE
51 * CLEAR 53 * CLEAR
52 */ 54 */
53namespace { 55namespace {
54 /** 56 /**
55 * CreateQuery for the Todolist Table 57 * CreateQuery for the Todolist Table
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h
index e945863..0ae2591 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.h
+++ b/libopie2/opiepim/backend/otodoaccesssql.h
@@ -24,27 +24,31 @@
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#ifndef OPIE_PIM_ACCESS_SQL_H 29#ifndef OPIE_PIM_ACCESS_SQL_H
30#define OPIE_PIM_ACCESS_SQL_H 30#define OPIE_PIM_ACCESS_SQL_H
31 31
32#include <qasciidict.h> 32#include <qasciidict.h>
33 33
34#include <opie2/otodoaccessbackend.h> 34#include <opie2/otodoaccessbackend.h>
35 35
36namespace Opie {
37namespace DB {
36class OSQLDriver; 38class OSQLDriver;
37class OSQLResult; 39class OSQLResult;
38class OSQLResultItem; 40class OSQLResultItem;
41}
42}
39 43
40namespace Opie { 44namespace Opie {
41 45
42class OPimTodoAccessBackendSQL : public OPimTodoAccessBackend { 46class OPimTodoAccessBackendSQL : public OPimTodoAccessBackend {
43public: 47public:
44 OPimTodoAccessBackendSQL( const QString& file ); 48 OPimTodoAccessBackendSQL( const QString& file );
45 ~OPimTodoAccessBackendSQL(); 49 ~OPimTodoAccessBackendSQL();
46 50
47 bool load(); 51 bool load();
48 bool reload(); 52 bool reload();
49 bool save(); 53 bool save();
50 QArray<int> allRecords()const; 54 QArray<int> allRecords()const;
@@ -62,27 +66,27 @@ public:
62 const QDate& end, bool includeNoDates ); 66 const QDate& end, bool includeNoDates );
63 QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); 67 QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat );
64 68
65 QBitArray supports()const; 69 QBitArray supports()const;
66 QArray<int> matchRegexp( const QRegExp &r ) const; 70 QArray<int> matchRegexp( const QRegExp &r ) const;
67 void removeAllCompleted(); 71 void removeAllCompleted();
68 72
69 73
70private: 74private:
71 void update()const; 75 void update()const;
72 void fillDict(); 76 void fillDict();
73 inline bool date( QDate& date, const QString& )const; 77 inline bool date( QDate& date, const QString& )const;
74 inline OPimTodo todo( const OSQLResult& )const; 78 inline OPimTodo todo( const Opie::DB::OSQLResult& )const;
75 inline OPimTodo todo( OSQLResultItem& )const; 79 inline OPimTodo todo( Opie::DB::OSQLResultItem& )const;
76 inline QArray<int> uids( const OSQLResult& )const; 80 inline QArray<int> uids( const Opie::DB::OSQLResult& )const;
77 OPimTodo todo( int uid )const; 81 OPimTodo todo( int uid )const;
78 QBitArray sup() const; 82 QBitArray sup() const;
79 83
80 QAsciiDict<int> m_dict; 84 QAsciiDict<int> m_dict;
81 OSQLDriver* m_driver; 85 Opie::DB::OSQLDriver* m_driver;
82 QArray<int> m_uids; 86 QArray<int> m_uids;
83 bool m_dirty : 1; 87 bool m_dirty : 1;
84}; 88};
85 89
86} 90}
87 91
88#endif 92#endif