Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.h | 8 |
1 files changed, 6 insertions, 2 deletions
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 | |||
@@ -19,91 +19,95 @@ | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
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 | /* | 29 | /* |
30 | * SQL Backend for the OPIE-Contact Database. | 30 | * SQL Backend for the OPIE-Contact Database. |
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 */ |
43 | namespace Opie { | ||
44 | namespace DB { | ||
43 | class OSQLDriver; | 45 | class OSQLDriver; |
44 | class OSQLResult; | 46 | class OSQLResult; |
45 | class OSQLResultItem; | 47 | class OSQLResultItem; |
48 | } | ||
49 | } | ||
46 | 50 | ||
47 | namespace Opie { | 51 | namespace 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 | */ |
55 | class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { | 59 | class 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 ); |
58 | 62 | ||
59 | ~OPimContactAccessBackend_SQL (); | 63 | ~OPimContactAccessBackend_SQL (); |
60 | 64 | ||
61 | bool save(); | 65 | bool save(); |
62 | 66 | ||
63 | bool load (); | 67 | bool load (); |
64 | 68 | ||
65 | void clear (); | 69 | void clear (); |
66 | 70 | ||
67 | bool wasChangedExternally(); | 71 | bool wasChangedExternally(); |
68 | 72 | ||
69 | QArray<int> allRecords() const; | 73 | QArray<int> allRecords() const; |
70 | 74 | ||
71 | OPimContact find ( int uid ) const; | 75 | OPimContact find ( int uid ) const; |
72 | // FIXME: Add lookahead-cache support ! | 76 | // FIXME: Add lookahead-cache support ! |
73 | //OPimContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; | 77 | //OPimContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; |
74 | 78 | ||
75 | QArray<int> queryByExample ( const OPimContact &query, int settings, | 79 | QArray<int> queryByExample ( const OPimContact &query, int settings, |
76 | const QDateTime& d ); | 80 | const QDateTime& d ); |
77 | 81 | ||
78 | QArray<int> matchRegexp( const QRegExp &r ) const; | 82 | QArray<int> matchRegexp( const QRegExp &r ) const; |
79 | 83 | ||
80 | const uint querySettings(); | 84 | const uint querySettings(); |
81 | 85 | ||
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 |