author | alwin <alwin> | 2004-02-20 02:06:52 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-20 02:06:52 (UTC) |
commit | 55f4d502486e01927356908223622e435c975f7e (patch) (unidiff) | |
tree | 824b5c1e8992564677c4f39473bc108a32a2cf2a /libopie2/opiepim/core/ocontactaccess.h | |
parent | 060b4fc7a3fd5c1b5f745167fe084f7486719b7e (diff) | |
download | opie-55f4d502486e01927356908223622e435c975f7e.zip opie-55f4d502486e01927356908223622e435c975f7e.tar.gz opie-55f4d502486e01927356908223622e435c975f7e.tar.bz2 |
moved the opie pim stuff to libopie2 - pim. Tried to resort them, may be someone should take a look for a better file order. but now all applications can start using libopiepim2 instead of libopie1-pim-stuff.
Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.h | 105 |
1 files changed, 35 insertions, 70 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h index bd6da40..505c87b 100644 --- a/libopie2/opiepim/core/ocontactaccess.h +++ b/libopie2/opiepim/core/ocontactaccess.h | |||
@@ -1,134 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | * Class to manage the Contacts. | 2 | This file is part of the Opie Project |
3 | * | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org) | 5 | .=l. |
6 | * | 6 | .>+-= |
7 | * ===================================================================== | 7 | _;:, .> :=|. This program is free software; you can |
8 | *This program is free software; you can redistribute it and/or | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | *modify it under the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | * License as published by the Free Software Foundation; | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * either version 2 of the License, or (at your option) any later | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | /* | ||
13 | * ===================================================================== | 30 | * ===================================================================== |
14 | * ToDo: Define enum for query settings | 31 | * ToDo: Define enum for query settings |
15 | * ===================================================================== | 32 | * ===================================================================== |
16 | * Version: $Id$ | ||
17 | * ===================================================================== | ||
18 | * History: | ||
19 | * $Log$ | ||
20 | * Revision 1.10 2003/12/22 10:19:26 eilers | ||
21 | * Finishing implementation of sql-backend for datebook. But I have to | ||
22 | * port the PIM datebook application to use it, before I could debug the | ||
23 | * whole stuff. | ||
24 | * Thus, PIM-Database backend is finished, but highly experimental. And some | ||
25 | * parts are still generic. For instance, the "queryByExample()" methods are | ||
26 | * not (or not fully) implemented. Todo: custom-entries not stored. | ||
27 | * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular | ||
28 | * expression search in the database, which is not supported by sqlite ! | ||
29 | * Therefore we need either an extended sqlite or a workaround which would | ||
30 | * be very slow and memory consuming.. | ||
31 | * | ||
32 | * Revision 1.9 2003/08/01 12:30:16 eilers | ||
33 | * Merging changes from BRANCH_1_0 to HEAD | ||
34 | * | ||
35 | * Revision 1.8.2.1 2003/06/30 14:34:19 eilers | ||
36 | * Patches from Zecke: | ||
37 | * Fixing and cleaning up extraMap handling | ||
38 | * Adding d_ptr for binary compatibility in the future | ||
39 | * | ||
40 | * Revision 1.8 2003/05/08 13:55:09 tille | ||
41 | * search stuff | ||
42 | * and match, toRichText & toShortText in oevent | ||
43 | * | ||
44 | * Revision 1.7 2003/04/13 18:07:10 zecke | ||
45 | * More API doc | ||
46 | * QString -> const QString& | ||
47 | * QString = 0l -> QString::null | ||
48 | * | ||
49 | * Revision 1.6 2003/01/02 14:27:12 eilers | ||
50 | * Improved query by example: Search by date is possible.. First step | ||
51 | * for a today plugin for birthdays.. | ||
52 | * | ||
53 | * Revision 1.5 2002/11/13 14:14:51 eilers | ||
54 | * Added sorted for Contacts.. | ||
55 | * | ||
56 | * Revision 1.4 2002/11/01 15:10:42 eilers | ||
57 | * Added regExp-search in database for all fields in a contact. | ||
58 | * | ||
59 | * Revision 1.3 2002/10/16 10:52:40 eilers | ||
60 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | ||
61 | * | ||
62 | * Revision 1.2 2002/10/14 16:21:54 eilers | ||
63 | * Some minor interface updates | ||
64 | * | ||
65 | * Revision 1.1 2002/09/27 17:11:44 eilers | ||
66 | * Added API for accessing the Contact-Database ! It is compiling, but | ||
67 | * please do not expect that anything is working ! | ||
68 | * I will debug that stuff in the next time .. | ||
69 | * Please read README_COMPILE for compiling ! | ||
70 | * | ||
71 | * ===================================================================== | ||
72 | */ | 33 | */ |
73 | #ifndef _OCONTACTACCESS_H | 34 | #ifndef _OCONTACTACCESS_H |
74 | #define _OCONTACTACCESS_H | 35 | #define _OCONTACTACCESS_H |
75 | 36 | ||
76 | #include <qobject.h> | 37 | #include <qobject.h> |
77 | 38 | ||
78 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
79 | 40 | ||
80 | #include <qvaluelist.h> | 41 | #include <qvaluelist.h> |
81 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
82 | 43 | ||
83 | #include "ocontact.h" | 44 | #include <opie2/ocontact.h> |
84 | #include "ocontactaccessbackend.h" | 45 | #include <opie2/ocontactaccessbackend.h> |
85 | #include "opimaccesstemplate.h" | 46 | #include <opie2/opimaccesstemplate.h> |
86 | 47 | ||
48 | namespace Opie { | ||
87 | /** | 49 | /** |
88 | * Class to access the contacts database. | 50 | * Class to access the contacts database. |
89 | * This is just a frontend for the real database handling which is | 51 | * This is just a frontend for the real database handling which is |
90 | * done by the backend. | 52 | * done by the backend. |
91 | * This class is used to access the Contacts on a system. This class as any OPIE PIM | 53 | * This class is used to access the Contacts on a system. This class as any OPIE PIM |
92 | * class is backend independent. | 54 | * class is backend independent. |
93 | * @author Stefan Eilers, Holger Freyther | 55 | * @author Stefan Eilers, Holger Freyther |
94 | * @see OPimAccessTemplate | 56 | * @see OPimAccessTemplate |
95 | */ | 57 | */ |
96 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | 58 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> |
97 | { | 59 | { |
98 | Q_OBJECT | 60 | Q_OBJECT |
99 | 61 | ||
100 | public: | 62 | public: |
101 | /** | 63 | /** |
102 | * Create Database with contacts (addressbook). | 64 | * Create Database with contacts (addressbook). |
103 | * @param appname Name of application which wants access to the database | 65 | * @param appname Name of application which wants access to the database |
104 | * (i.e. "todolist") | 66 | * (i.e. "todolist") |
105 | * @param filename The name of the database file. If not set, the default one | 67 | * @param filename The name of the database file. If not set, the default one |
106 | * is used. | 68 | * is used. |
107 | * @param backend Pointer to an alternative Backend. If not set, we will use | 69 | * @param backend Pointer to an alternative Backend. If not set, we will use |
108 | * the default backend. | 70 | * the default backend. |
109 | * @param handlesync If <b>true</b> the database stores the current state | 71 | * @param handlesync If <b>true</b> the database stores the current state |
110 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> | 72 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> |
111 | * which are used before and after synchronisation. If the application wants | 73 | * which are used before and after synchronisation. If the application wants |
112 | * to react itself, it should be disabled by setting it to <b>false</b> | 74 | * to react itself, it should be disabled by setting it to <b>false</b> |
113 | * @see OContactAccessBackend | 75 | * @see OContactAccessBackend |
114 | */ | 76 | */ |
115 | OContactAccess (const QString appname, const QString filename = 0l, | 77 | OContactAccess (const QString appname, const QString filename = 0l, |
116 | OContactAccessBackend* backend = 0l, bool handlesync = true); | 78 | OContactAccessBackend* backend = 0l, bool handlesync = true); |
117 | ~OContactAccess (); | 79 | ~OContactAccess (); |
118 | 80 | ||
119 | /** Constants for query. | 81 | /** Constants for query. |
120 | * Use this constants to set the query parameters. | 82 | * Use this constants to set the query parameters. |
121 | * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! | 83 | * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! |
122 | * @see queryByExample() | 84 | * @see queryByExample() |
123 | */ | 85 | */ |
124 | enum QuerySettings { | 86 | enum QuerySettings { |
125 | WildCards = 0x0001, | 87 | WildCards = 0x0001, |
126 | IgnoreCase = 0x0002, | 88 | IgnoreCase = 0x0002, |
127 | RegExp = 0x0004, | 89 | RegExp = 0x0004, |
128 | ExactMatch = 0x0008, | 90 | ExactMatch = 0x0008, |
129 | MatchOne = 0x0010, // Only one Entry must match | 91 | MatchOne = 0x0010, // Only one Entry must match |
130 | DateDiff = 0x0020, // Find all entries from today until given date | 92 | DateDiff = 0x0020, // Find all entries from today until given date |
131 | DateYear = 0x0040, // The year matches | 93 | DateYear = 0x0040, // The year matches |
132 | DateMonth = 0x0080, // The month matches | 94 | DateMonth = 0x0080, // The month matches |
133 | DateDay = 0x0100, // The day matches | 95 | DateDay = 0x0100, // The day matches |
134 | }; | 96 | }; |
@@ -145,49 +107,52 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | |||
145 | /** Return all possible settings. | 107 | /** Return all possible settings. |
146 | * @return All settings provided by the current backend | 108 | * @return All settings provided by the current backend |
147 | * (i.e.: query_WildCards & query_IgnoreCase) | 109 | * (i.e.: query_WildCards & query_IgnoreCase) |
148 | */ | 110 | */ |
149 | const uint querySettings(); | 111 | const uint querySettings(); |
150 | 112 | ||
151 | /** Check whether settings are correct. | 113 | /** Check whether settings are correct. |
152 | * @return <i>true</i> if the given settings are correct and possible. | 114 | * @return <i>true</i> if the given settings are correct and possible. |
153 | */ | 115 | */ |
154 | bool hasQuerySettings ( int querySettings ) const; | 116 | bool hasQuerySettings ( int querySettings ) const; |
155 | 117 | ||
156 | /** | 118 | /** |
157 | * if the resource was changed externally. | 119 | * if the resource was changed externally. |
158 | * You should use the signal instead of polling possible changes ! | 120 | * You should use the signal instead of polling possible changes ! |
159 | */ | 121 | */ |
160 | bool wasChangedExternally()const; | 122 | bool wasChangedExternally()const; |
161 | 123 | ||
162 | 124 | ||
163 | /** Save contacts database. | 125 | /** Save contacts database. |
164 | * Save is more a "commit". After calling this function, all changes are public available. | 126 | * Save is more a "commit". After calling this function, all changes are public available. |
165 | * @return true if successful | 127 | * @return true if successful |
166 | */ | 128 | */ |
167 | bool save(); | 129 | bool save(); |
168 | 130 | ||
169 | signals: | 131 | signals: |
170 | /* Signal is emitted if the database was changed. Therefore | 132 | /* Signal is emitted if the database was changed. Therefore |
171 | * we may need to reload to stay consistent. | 133 | * we may need to reload to stay consistent. |
172 | * @param which Pointer to the database who created this event. This pointer | 134 | * @param which Pointer to the database who created this event. This pointer |
173 | * is useful if an application has to handle multiple databases at the same time. | 135 | * is useful if an application has to handle multiple databases at the same time. |
174 | * @see reload() | 136 | * @see reload() |
175 | */ | 137 | */ |
176 | void signalChanged ( const OContactAccess *which ); | 138 | void signalChanged ( const OContactAccess *which ); |
177 | 139 | ||
178 | 140 | ||
179 | private: | 141 | private: |
180 | // class OContactAccessPrivate; | 142 | // class OContactAccessPrivate; |
181 | // OContactAccessPrivate* d; | 143 | // OContactAccessPrivate* d; |
182 | OContactAccessBackend *m_backEnd; | 144 | OContactAccessBackend *m_backEnd; |
183 | bool m_loading:1; | 145 | bool m_loading:1; |
184 | 146 | ||
185 | private slots: | 147 | private slots: |
186 | void copMessage( const QCString &msg, const QByteArray &data ); | 148 | void copMessage( const QCString &msg, const QByteArray &data ); |
187 | 149 | ||
188 | private: | 150 | private: |
189 | class Private; | 151 | class Private; |
190 | Private *d; | 152 | Private *d; |
191 | 153 | ||
192 | }; | 154 | }; |
155 | |||
156 | } | ||
157 | |||
193 | #endif | 158 | #endif |