summaryrefslogtreecommitdiff
path: root/libopie/pim/ocontactaccess.h
Unidiff
Diffstat (limited to 'libopie/pim/ocontactaccess.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccess.h193
1 files changed, 0 insertions, 193 deletions
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
deleted file mode 100644
index bd6da40..0000000
--- a/libopie/pim/ocontactaccess.h
+++ b/dev/null
@@ -1,193 +0,0 @@
1/*
2 * Class to manage the Contacts.
3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org)
6 *
7 * =====================================================================
8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation;
11 * either version 2 of the License, or (at your option) any later
12 * version.
13 * =====================================================================
14 * ToDo: Define enum for query settings
15 * =====================================================================
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 */
73#ifndef _OCONTACTACCESS_H
74#define _OCONTACTACCESS_H
75
76#include <qobject.h>
77
78#include <qpe/qcopenvelope_qws.h>
79
80#include <qvaluelist.h>
81#include <qfileinfo.h>
82
83#include "ocontact.h"
84#include "ocontactaccessbackend.h"
85#include "opimaccesstemplate.h"
86
87/**
88 * Class to access the contacts database.
89 * This is just a frontend for the real database handling which is
90 * done by the backend.
91 * This class is used to access the Contacts on a system. This class as any OPIE PIM
92 * class is backend independent.
93 * @author Stefan Eilers, Holger Freyther
94 * @see OPimAccessTemplate
95 */
96class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
97{
98 Q_OBJECT
99
100 public:
101 /**
102 * Create Database with contacts (addressbook).
103 * @param appname Name of application which wants access to the database
104 * (i.e. "todolist")
105 * @param filename The name of the database file. If not set, the default one
106 * is used.
107 * @param backend Pointer to an alternative Backend. If not set, we will use
108 * the default backend.
109 * @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>
111 * 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>
113 * @see OContactAccessBackend
114 */
115 OContactAccess (const QString appname, const QString filename = 0l,
116 OContactAccessBackend* backend = 0l, bool handlesync = true);
117 ~OContactAccess ();
118
119 /** Constants for query.
120 * Use this constants to set the query parameters.
121 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes !
122 * @see queryByExample()
123 */
124 enum QuerySettings {
125 WildCards = 0x0001,
126 IgnoreCase = 0x0002,
127 RegExp = 0x0004,
128 ExactMatch = 0x0008,
129 MatchOne = 0x0010, // Only one Entry must match
130 DateDiff = 0x0020, // Find all entries from today until given date
131 DateYear = 0x0040, // The year matches
132 DateMonth = 0x0080, // The month matches
133 DateDay = 0x0100, // The day matches
134 };
135
136
137 /** Return all Contacts in a sorted manner.
138 * @param ascending true: Sorted in acending order.
139 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
140 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
141 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
142 */
143 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const;
144
145 /** Return all possible settings.
146 * @return All settings provided by the current backend
147 * (i.e.: query_WildCards & query_IgnoreCase)
148 */
149 const uint querySettings();
150
151 /** Check whether settings are correct.
152 * @return <i>true</i> if the given settings are correct and possible.
153 */
154 bool hasQuerySettings ( int querySettings ) const;
155
156 /**
157 * if the resource was changed externally.
158 * You should use the signal instead of polling possible changes !
159 */
160 bool wasChangedExternally()const;
161
162
163 /** Save contacts database.
164 * Save is more a "commit". After calling this function, all changes are public available.
165 * @return true if successful
166 */
167 bool save();
168
169 signals:
170 /* Signal is emitted if the database was changed. Therefore
171 * we may need to reload to stay consistent.
172 * @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.
174 * @see reload()
175 */
176 void signalChanged ( const OContactAccess *which );
177
178
179 private:
180 // class OContactAccessPrivate;
181 // OContactAccessPrivate* d;
182 OContactAccessBackend *m_backEnd;
183 bool m_loading:1;
184
185 private slots:
186 void copMessage( const QCString &msg, const QByteArray &data );
187
188 private:
189 class Private;
190 Private *d;
191
192};
193#endif