summaryrefslogtreecommitdiff
path: root/libopie/pim
authorzecke <zecke>2003-04-13 18:07:10 (UTC)
committer zecke <zecke>2003-04-13 18:07:10 (UTC)
commit6f610544d3db6198c90105b70fab1cc84f5a1fbd (patch) (unidiff)
tree964d18f0a4cca7383a31810aa922876751c4a22c /libopie/pim
parent0b311079ff19798866291034663757103c6ba935 (diff)
downloadopie-6f610544d3db6198c90105b70fab1cc84f5a1fbd.zip
opie-6f610544d3db6198c90105b70fab1cc84f5a1fbd.tar.gz
opie-6f610544d3db6198c90105b70fab1cc84f5a1fbd.tar.bz2
More API doc
QString -> const QString& QString = 0l -> QString::null
Diffstat (limited to 'libopie/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/obackendfactory.h26
-rw-r--r--libopie/pim/ocontact.h11
-rw-r--r--libopie/pim/ocontactaccess.h16
-rw-r--r--libopie/pim/ocontactaccessbackend.h32
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp7
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.h18
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.cpp171
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h46
-rw-r--r--libopie/pim/odatebookaccess.cpp28
-rw-r--r--libopie/pim/odatebookaccess.h15
-rw-r--r--libopie/pim/odatebookaccessbackend.h45
-rw-r--r--libopie/pim/odatebookaccessbackend_xml.h6
-rw-r--r--libopie/pim/oevent.h17
13 files changed, 315 insertions, 123 deletions
diff --git a/libopie/pim/obackendfactory.h b/libopie/pim/obackendfactory.h
index 3a73210..ad6cf5a 100644
--- a/libopie/pim/obackendfactory.h
+++ b/libopie/pim/obackendfactory.h
@@ -18,2 +18,7 @@
18 * $Log$ 18 * $Log$
19 * Revision 1.6 2003/04/13 18:07:10 zecke
20 * More API doc
21 * QString -> const QString&
22 * QString = 0l -> QString::null
23 *
19 * Revision 1.5 2003/02/21 23:31:52 zecke 24 * Revision 1.5 2003/02/21 23:31:52 zecke
@@ -65,3 +70,17 @@
65 70
66 71/**
72 * This class is our factory. It will give us the default implementations
73 * of at least Todolist, Contacts and Datebook. In the future this class will
74 * allow users to switch the backend with ( XML->SQLite ) without the need
75 * to recompile.#
76 * This class as the whole PIM Api is making use of templates
77 *
78 * <pre>
79 * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
80 * backend->load();
81 * </pre>
82 *
83 * @author Stefan Eilers
84 * @version 0.1
85 */
67template<class T> 86template<class T>
@@ -78,2 +97,7 @@ class OBackendFactory
78 97
98 /**
99 * Returns a backend implementation for backendName
100 * @param backendName the type of the backend
101 * @param appName will be passed on to the backend
102 */
79 static T* Default( const QString backendName, const QString& appName ){ 103 static T* Default( const QString backendName, const QString& appName ){
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 1fd1c75..25fa0e7 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -36,4 +36,11 @@ QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
36 36
37class ContactPrivate; 37class ContactPrivate;
38 38
39/**
40 * OContact class represents a specialised PIM Record for contacts.
41 * It does store all kind of persopn related information.
42 *
43 * @short Contact Container
44 * @author TT, Stefan Eiler, Holger Freyther
45 */
39class QPC_EXPORT OContact : public OPimRecord 46class QPC_EXPORT OContact : public OPimRecord
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index 32b2dcb..d7ceaf2 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -19,2 +19,7 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.7 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.6 2003/01/02 14:27:12 eilers 25 * Revision 1.6 2003/01/02 14:27:12 eilers
@@ -57,5 +62,9 @@
57 62
58/** Class to access the contacts database. 63/**
64 * Class to access the contacts database.
59 * This is just a frontend for the real database handling which is 65 * This is just a frontend for the real database handling which is
60 * done by the backend. 66 * done by the backend.
67 * This class is used to access the Contacts on a system. This class as any OPIE PIM
68 * class is backend independent.
69
61 * @see OPimAccessTemplate 70 * @see OPimAccessTemplate
@@ -67,3 +76,4 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
67 public: 76 public:
68 /** Create Database with contacts (addressbook). 77 /**
78 * Create Database with contacts (addressbook).
69 * @param appname Name of application which wants access to the database 79 * @param appname Name of application which wants access to the database
@@ -101,3 +111,3 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
101 111
102 112
103 ORecordList<OContact> matchRegexp( const QRegExp &r )const; 113 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
diff --git a/libopie/pim/ocontactaccessbackend.h b/libopie/pim/ocontactaccessbackend.h
index 821f5bf..ebeb42d 100644
--- a/libopie/pim/ocontactaccessbackend.h
+++ b/libopie/pim/ocontactaccessbackend.h
@@ -21,2 +21,7 @@
21 * $Log$ 21 * $Log$
22 * Revision 1.5 2003/04/13 18:07:10 zecke
23 * More API doc
24 * QString -> const QString&
25 * QString = 0l -> QString::null
26 *
22 * Revision 1.4 2002/11/13 14:14:51 eilers 27 * Revision 1.4 2002/11/13 14:14:51 eilers
@@ -46,4 +51,14 @@
46 51
47#include "qregexp.h" 52#include <qregexp.h>
48 53
54/**
55 * This class represents the interface of all Contact Backends.
56 * Derivates of this class will be used to access the contacts.
57 * As implementation currently XML and vCard exist. This class needs to be implemented
58 * if you want to provide your own storage.
59 * In all queries a list of uids is passed on instead of loading the actual record!
60 *
61 * @see OContactAccessBackend_VCard
62 * @see OContactAccessBackend_XML
63 */
49class OContactAccessBackend: public OPimAccessBackend<OContact> { 64class OContactAccessBackend: public OPimAccessBackend<OContact> {
@@ -54,3 +69,4 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
54 69
55 /** Return if database was changed externally. 70 /**
71 * Return if database was changed externally.
56 * This may just make sense on file based databases like a XML-File. 72 * This may just make sense on file based databases like a XML-File.
@@ -70,3 +86,4 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
70 86
71 /** Return all possible settings. 87 /**
88 * Return all possible settings.
72 * @return All settings provided by the current backend 89 * @return All settings provided by the current backend
@@ -76,3 +93,4 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
76 93
77 /** Check whether settings are correct. 94 /**
95 * Check whether settings are correct.
78 * @return <i>true</i> if the given settings are correct and possible. 96 * @return <i>true</i> if the given settings are correct and possible.
@@ -81,3 +99,7 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
81 99
82 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0; 100 /**
101 * FIXME!!!
102 * Returns a sorted list of records either ascendinf or descending for a giving criteria and category
103 */
104 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
83 105
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index f24523f..270bef3 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -19,2 +19,7 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.10 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.9 2003/03/21 10:33:09 eilers 25 * Revision 1.9 2003/03/21 10:33:09 eilers
@@ -78,3 +83,3 @@
78 83
79OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ): 84OContactAccessBackend_VCard::OContactAccessBackend_VCard ( const QString& , const QString& filename ):
80 m_dirty( false ), 85 m_dirty( false ),
diff --git a/libopie/pim/ocontactaccessbackend_vcard.h b/libopie/pim/ocontactaccessbackend_vcard.h
index 93e2da3..712d769 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.h
+++ b/libopie/pim/ocontactaccessbackend_vcard.h
@@ -19,2 +19,7 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.6 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.5 2003/03/21 10:33:09 eilers 25 * Revision 1.5 2003/03/21 10:33:09 eilers
@@ -49,5 +54,10 @@ class VObject;
49 54
55/**
56 * This is the vCard 2.1 implementation of the Contact Storage
57 * @see OContactAccessBackend_XML
58 * @see OPimAccessBackend
59 */
50class OContactAccessBackend_VCard : public OContactAccessBackend { 60class OContactAccessBackend_VCard : public OContactAccessBackend {
51 public: 61 public:
52 OContactAccessBackend_VCard ( QString appname, QString filename = 0l ); 62 OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
53 63
@@ -61,3 +71,3 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
61 bool replace ( const OContact& contact ); 71 bool replace ( const OContact& contact );
62 72
63 OContact find ( int uid ) const; 73 OContact find ( int uid ) const;
@@ -71,3 +81,3 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
71 bool wasChangedExternally(); 81 bool wasChangedExternally();
72 82
73private: 83private:
@@ -79,3 +89,3 @@ private:
79 VObject *safeAddProp( VObject* o, const char* prop); 89 VObject *safeAddProp( VObject* o, const char* prop);
80 90
81 bool m_dirty : 1; 91 bool m_dirty : 1;
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/libopie/pim/ocontactaccessbackend_xml.cpp
index c5a7820..661cd51 100644
--- a/libopie/pim/ocontactaccessbackend_xml.cpp
+++ b/libopie/pim/ocontactaccessbackend_xml.cpp
@@ -19,2 +19,7 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.5 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.4 2003/03/21 14:32:54 mickeyl 25 * Revision 1.4 2003/03/21 14:32:54 mickeyl
@@ -95,3 +100,3 @@
95#include <qmap.h> 100#include <qmap.h>
96#include <qdatetime.h> 101#include <qdatetime.h>
97 102
@@ -109,3 +114,3 @@ using namespace Opie;
109 114
110OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString filename ): 115OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ):
111 m_changed( false ) 116 m_changed( false )
@@ -118,3 +123,3 @@ OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString
118 m_appName = appname; 123 m_appName = appname;
119 124
120 /* Set journalfile name ... */ 125 /* Set journalfile name ... */
@@ -122,3 +127,3 @@ OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString
122 m_journalName +="/.abjournal" + appname; 127 m_journalName +="/.abjournal" + appname;
123 128
124 /* Expecting to access the default filename if nothing else is set */ 129 /* Expecting to access the default filename if nothing else is set */
@@ -128,3 +133,3 @@ OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString
128 m_fileName = filename; 133 m_fileName = filename;
129 134
130 /* Load Database now */ 135 /* Load Database now */
@@ -133,8 +138,8 @@ OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString
133 138
134bool OContactAccessBackend_XML::save() 139bool OContactAccessBackend_XML::save()
135{ 140{
136 141
137 if ( !m_changed ) 142 if ( !m_changed )
138 return true; 143 return true;
139 144
140 QString strNewFile = m_fileName + ".new"; 145 QString strNewFile = m_fileName + ".new";
@@ -143,3 +148,3 @@ bool OContactAccessBackend_XML::save()
143 return false; 148 return false;
144 149
145 int total_written; 150 int total_written;
@@ -176,3 +181,3 @@ bool OContactAccessBackend_XML::save()
176 out += " </Contacts>\n</AddressBook>\n"; 181 out += " </Contacts>\n</AddressBook>\n";
177 182
178 // Write Footer 183 // Write Footer
@@ -186,3 +191,3 @@ bool OContactAccessBackend_XML::save()
186 f.close(); 191 f.close();
187 192
188 // move the file over, I'm just going to use the system call 193 // move the file over, I'm just going to use the system call
@@ -195,6 +200,6 @@ bool OContactAccessBackend_XML::save()
195 } 200 }
196 201
197 /* The journalfile should be removed now... */ 202 /* The journalfile should be removed now... */
198 removeJournal(); 203 removeJournal();
199 204
200 m_changed = false; 205 m_changed = false;
@@ -203,3 +208,3 @@ bool OContactAccessBackend_XML::save()
203 208
204bool OContactAccessBackend_XML::load () 209bool OContactAccessBackend_XML::load ()
205{ 210{
@@ -207,3 +212,3 @@ bool OContactAccessBackend_XML::load ()
207 m_uidToContact.clear(); 212 m_uidToContact.clear();
208 213
209 /* Load XML-File and journal if it exists */ 214 /* Load XML-File and journal if it exists */
@@ -218,3 +223,3 @@ bool OContactAccessBackend_XML::load ()
218 load (m_journalName, true); 223 load (m_journalName, true);
219 224
220 return true; 225 return true;
@@ -222,3 +227,3 @@ bool OContactAccessBackend_XML::load ()
222 227
223void OContactAccessBackend_XML::clear () 228void OContactAccessBackend_XML::clear ()
224{ 229{
@@ -233,5 +238,5 @@ bool OContactAccessBackend_XML::wasChangedExternally()
233 QFileInfo fi( m_fileName ); 238 QFileInfo fi( m_fileName );
234 239
235 QDateTime lastmod = fi.lastModified (); 240 QDateTime lastmod = fi.lastModified ();
236 241
237 return (lastmod != m_readtime); 242 return (lastmod != m_readtime);
@@ -239,7 +244,7 @@ bool OContactAccessBackend_XML::wasChangedExternally()
239 244
240QArray<int> OContactAccessBackend_XML::allRecords() const 245QArray<int> OContactAccessBackend_XML::allRecords() const
241{ 246{
242 QArray<int> uid_list( m_contactList.count() ); 247 QArray<int> uid_list( m_contactList.count() );
243 248
244 uint counter = 0; 249 uint counter = 0;
245 QListIterator<OContact> it( m_contactList ); 250 QListIterator<OContact> it( m_contactList );
@@ -248,3 +253,3 @@ QArray<int> OContactAccessBackend_XML::allRecords() const
248 } 253 }
249 254
250 return ( uid_list ); 255 return ( uid_list );
@@ -255,3 +260,3 @@ OContact OContactAccessBackend_XML::find ( int uid ) const
255 OContact foundContact; //Create empty contact 260 OContact foundContact; //Create empty contact
256 261
257 OContact* found = m_uidToContact.find( QString().setNum( uid ) ); 262 OContact* found = m_uidToContact.find( QString().setNum( uid ) );
@@ -261,3 +266,3 @@ OContact OContactAccessBackend_XML::find ( int uid ) const
261 } 266 }
262 267
263 return ( foundContact ); 268 return ( foundContact );
@@ -265,6 +270,6 @@ OContact OContactAccessBackend_XML::find ( int uid ) const
265 270
266QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, int settings, 271QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, int settings,
267 const QDateTime& d ) 272 const QDateTime& d )
268{ 273{
269 274
270 QArray<int> m_currentQuery( m_contactList.count() ); 275 QArray<int> m_currentQuery( m_contactList.count() );
@@ -272,3 +277,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
272 uint arraycounter = 0; 277 uint arraycounter = 0;
273 278
274 for( ; it.current(); ++it ){ 279 for( ; it.current(); ++it ){
@@ -292,3 +297,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
292 } 297 }
293 298
294 if ( queryDate->isValid() ){ 299 if ( queryDate->isValid() ){
@@ -298,3 +303,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
298 allcorrect = false; 303 allcorrect = false;
299 } 304 }
300 if ( settings & OContactAccess::DateMonth ){ 305 if ( settings & OContactAccess::DateMonth ){
@@ -302,3 +307,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
302 allcorrect = false; 307 allcorrect = false;
303 } 308 }
304 if ( settings & OContactAccess::DateDay ){ 309 if ( settings & OContactAccess::DateDay ){
@@ -306,3 +311,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
306 allcorrect = false; 311 allcorrect = false;
307 } 312 }
308 if ( settings & OContactAccess::DateDiff ) { 313 if ( settings & OContactAccess::DateDiff ) {
@@ -311,3 +316,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
311 // will take this date instead of 316 // will take this date instead of
312 // the current one.. 317 // the current one..
313 if ( !d.date().isValid() ) 318 if ( !d.date().isValid() )
@@ -319,8 +324,8 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
319 // the search will fail.. 324 // the search will fail..
320 checkDate->setYMD( current.year(), 325 checkDate->setYMD( current.year(),
321 checkDate->month(), 326 checkDate->month(),
322 checkDate->day() ); 327 checkDate->day() );
323 if ( *checkDate < current ) 328 if ( *checkDate < current )
324 checkDate->setYMD( current.year()+1, 329 checkDate->setYMD( current.year()+1,
325 checkDate->month(), 330 checkDate->month(),
326 checkDate->day() ); 331 checkDate->day() );
@@ -330,8 +335,8 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
330 // ( maximum time range ) ! 335 // ( maximum time range ) !
331 qWarning("Checking if %s is between %s and %s ! ", 336 qWarning("Checking if %s is between %s and %s ! ",
332 checkDate->toString().latin1(), 337 checkDate->toString().latin1(),
333 current.toString().latin1(), 338 current.toString().latin1(),
334 queryDate->toString().latin1() ); 339 queryDate->toString().latin1() );
335 if ( current.daysTo( *queryDate ) >= 0 ){ 340 if ( current.daysTo( *queryDate ) >= 0 ){
336 if ( !( ( *checkDate >= current ) && 341 if ( !( ( *checkDate >= current ) &&
337 ( *checkDate <= *queryDate ) ) ){ 342 ( *checkDate <= *queryDate ) ) ){
@@ -347,3 +352,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
347 } 352 }
348 353
349 delete queryDate; 354 delete queryDate;
@@ -361,5 +366,5 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
361 | OContactAccess::DateDay 366 | OContactAccess::DateDay
362 | OContactAccess::MatchOne 367 | OContactAccess::MatchOne
363 ) ){ 368 ) ){
364 369
365 case OContactAccess::RegExp:{ 370 case OContactAccess::RegExp:{
@@ -399,6 +404,6 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i
399 } 404 }
400 405
401 // Shrink to fit.. 406 // Shrink to fit..
402 m_currentQuery.resize(arraycounter); 407 m_currentQuery.resize(arraycounter);
403 408
404 return m_currentQuery; 409 return m_currentQuery;
@@ -411,3 +416,3 @@ QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const
411 uint arraycounter = 0; 416 uint arraycounter = 0;
412 417
413 for( ; it.current(); ++it ){ 418 for( ; it.current(); ++it ){
@@ -416,3 +421,3 @@ QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const
416 } 421 }
417 422
418 } 423 }
@@ -420,3 +425,3 @@ QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const
420 m_currentQuery.resize(arraycounter); 425 m_currentQuery.resize(arraycounter);
421 426
422 return m_currentQuery; 427 return m_currentQuery;
@@ -429,3 +434,3 @@ const uint OContactAccessBackend_XML::querySettings()
429 | OContactAccess::RegExp 434 | OContactAccess::RegExp
430 | OContactAccess::ExactMatch 435 | OContactAccess::ExactMatch
431 | OContactAccess::DateDiff 436 | OContactAccess::DateDiff
@@ -439,3 +444,3 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
439{ 444{
440 /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay 445 /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
441 * may be added with any of the other settings. IgnoreCase should never used alone. 446 * may be added with any of the other settings. IgnoreCase should never used alone.
@@ -443,6 +448,6 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
443 */ 448 */
444 449
445 if ( querySettings == OContactAccess::IgnoreCase ) 450 if ( querySettings == OContactAccess::IgnoreCase )
446 return false; 451 return false;
447 452
448 switch ( querySettings & ~( OContactAccess::IgnoreCase 453 switch ( querySettings & ~( OContactAccess::IgnoreCase
@@ -452,3 +457,3 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
452 | OContactAccess::DateDay 457 | OContactAccess::DateDay
453 ) 458 )
454 ){ 459 ){
@@ -465,4 +470,4 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
465 470
466// Currently only asc implemented.. 471// Currently only asc implemented..
467QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int ) 472QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int )
468{ 473{
@@ -471,4 +476,4 @@ QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int )
471 QArray<int> m_currentQuery( m_contactList.count() ); 476 QArray<int> m_currentQuery( m_contactList.count() );
472 477
473 // First fill map and StringList with all Names 478 // First fill map and StringList with all Names
474 // Afterwards sort namelist and use map to fill array to return.. 479 // Afterwards sort namelist and use map to fill array to return..
@@ -480,3 +485,3 @@ QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int )
480 names.sort(); 485 names.sort();
481 486
482 int i = 0; 487 int i = 0;
@@ -489,5 +494,5 @@ QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int )
489 } 494 }
490 495
491 return m_currentQuery; 496 return m_currentQuery;
492 497
493} 498}
@@ -499,5 +504,5 @@ bool OContactAccessBackend_XML::add ( const OContact &newcontact )
499 addContact_p( newcontact ); 504 addContact_p( newcontact );
500 505
501 m_changed = true; 506 m_changed = true;
502 507
503 return true; 508 return true;
@@ -508,3 +513,3 @@ bool OContactAccessBackend_XML::replace ( const OContact &contact )
508 m_changed = true; 513 m_changed = true;
509 514
510 OContact* found = m_uidToContact.find ( QString().setNum( contact.uid() ) ); 515 OContact* found = m_uidToContact.find ( QString().setNum( contact.uid() ) );
@@ -530,3 +535,3 @@ bool OContactAccessBackend_XML::remove ( int uid )
530 m_changed = true; 535 m_changed = true;
531 536
532 OContact* found = m_uidToContact.find ( QString().setNum( uid ) ); 537 OContact* found = m_uidToContact.find ( QString().setNum( uid ) );
@@ -557,5 +562,5 @@ void OContactAccessBackend_XML::addContact_p( const OContact &newcontact )
557/* This function loads the xml-database and the journalfile */ 562/* This function loads the xml-database and the journalfile */
558bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) 563bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
559{ 564{
560 565
561 /* We use the time of the last read to check if the file was 566 /* We use the time of the last read to check if the file was
@@ -567,6 +572,6 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
567 } 572 }
568 573
569 const int JOURNALACTION = Qtopia::Notes + 1; 574 const int JOURNALACTION = Qtopia::Notes + 1;
570 const int JOURNALROW = JOURNALACTION + 1; 575 const int JOURNALROW = JOURNALACTION + 1;
571 576
572 bool foundAction = false; 577 bool foundAction = false;
@@ -578,3 +583,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
578 QAsciiDict<int> dict( 47 ); 583 QAsciiDict<int> dict( 47 );
579 584
580 dict.setAutoDelete( TRUE ); 585 dict.setAutoDelete( TRUE );
@@ -625,5 +630,5 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
625 dict.insert( "actionrow", new int(JOURNALROW) ); 630 dict.insert( "actionrow", new int(JOURNALROW) );
626 631
627 //qWarning( "OContactDefaultBackEnd::loading %s", filename.latin1() ); 632 //qWarning( "OContactDefaultBackEnd::loading %s", filename.latin1() );
628 633
629 XMLElement *root = XMLElement::load( filename ); 634 XMLElement *root = XMLElement::load( filename );
@@ -636,3 +641,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
636 element = element->firstChild(); 641 element = element->firstChild();
637 642
638 /* Search Tag "Contacts" which is the parent of all Contacts */ 643 /* Search Tag "Contacts" which is the parent of all Contacts */
@@ -663,3 +668,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
663 foundAction = false; 668 foundAction = false;
664 669
665 XMLElement::AttributeMap aMap = element->attributes(); 670 XMLElement::AttributeMap aMap = element->attributes();
@@ -670,3 +675,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
670 // qWarning ("Read Attribute: %s=%s", it.key().latin1(),it.data().latin1()); 675 // qWarning ("Read Attribute: %s=%s", it.key().latin1(),it.data().latin1());
671 676
672 int *find = dict[ it.key() ]; 677 int *find = dict[ it.key() ];
@@ -679,3 +684,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
679 } 684 }
680 685
681 /* Check if special conversion is needed and add attribute 686 /* Check if special conversion is needed and add attribute
@@ -707,3 +712,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
707 OContact contact( contactMap ); 712 OContact contact( contactMap );
708 713
709 for (customIt = customMap.begin(); customIt != customMap.end(); ++customIt ) { 714 for (customIt = customMap.begin(); customIt != customMap.end(); ++customIt ) {
@@ -711,3 +716,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
711 } 716 }
712 717
713 if (foundAction){ 718 if (foundAction){
@@ -736,3 +741,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
736 } 741 }
737 742
738 /* Move to next element */ 743 /* Move to next element */
@@ -750,3 +755,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal )
750void OContactAccessBackend_XML::updateJournal( const OContact& cnt, 755void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
751 journal_action action ) 756 journal_action action )
752{ 757{
@@ -756,6 +761,6 @@ void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
756 return; 761 return;
757 762
758 QString buf; 763 QString buf;
759 QCString str; 764 QCString str;
760 765
761 // if the file was created, we have to set the Tag "<CONTACTS>" to 766 // if the file was created, we have to set the Tag "<CONTACTS>" to
@@ -768,3 +773,3 @@ void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
768 } 773 }
769 774
770 buf = "<Contact "; 775 buf = "<Contact ";
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index 4d6a7ef..7b5365b 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -19,2 +19,7 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.14 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.13 2003/03/21 10:33:09 eilers 25 * Revision 1.13 2003/03/21 10:33:09 eilers
@@ -86,8 +91,13 @@
86/* the default xml implementation */ 91/* the default xml implementation */
92/**
93 * This class is the XML implementation of a Contact backend
94 * it does implement everything available for OContact.
95 * @see OPimAccessBackend for more information of available methods
96 */
87class OContactAccessBackend_XML : public OContactAccessBackend { 97class OContactAccessBackend_XML : public OContactAccessBackend {
88 public: 98 public:
89 OContactAccessBackend_XML ( QString appname, QString filename = 0l ); 99 OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null );
90 100
91 bool save(); 101 bool save();
92 102
93 bool load (); 103 bool load ();
@@ -95,9 +105,9 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
95 void clear (); 105 void clear ();
96 106
97 bool wasChangedExternally(); 107 bool wasChangedExternally();
98 108
99 QArray<int> allRecords() const; 109 QArray<int> allRecords() const;
100 110
101 OContact find ( int uid ) const; 111 OContact find ( int uid ) const;
102 112
103 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ); 113 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
@@ -105,16 +115,16 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
105 QArray<int> matchRegexp( const QRegExp &r ) const; 115 QArray<int> matchRegexp( const QRegExp &r ) const;
106 116
107 const uint querySettings(); 117 const uint querySettings();
108 118
109 bool hasQuerySettings (uint querySettings) const; 119 bool hasQuerySettings (uint querySettings) const;
110 120
111 // Currently only asc implemented.. 121 // Currently only asc implemented..
112 QArray<int> sorted( bool asc, int , int , int ); 122 QArray<int> sorted( bool asc, int , int , int );
113 bool add ( const OContact &newcontact ); 123 bool add ( const OContact &newcontact );
114 124
115 bool replace ( const OContact &contact ); 125 bool replace ( const OContact &contact );
116 126
117 bool remove ( int uid ); 127 bool remove ( int uid );
118 bool reload(); 128 bool reload();
119 129
120 private: 130 private:
@@ -124,10 +134,10 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
124 void addContact_p( const OContact &newcontact ); 134 void addContact_p( const OContact &newcontact );
125 135
126 /* This function loads the xml-database and the journalfile */ 136 /* This function loads the xml-database and the journalfile */
127 bool load( const QString filename, bool isJournal ); 137 bool load( const QString filename, bool isJournal );
128 138
129 139
130 void updateJournal( const OContact& cnt, journal_action action ); 140 void updateJournal( const OContact& cnt, journal_action action );
131 void removeJournal(); 141 void removeJournal();
132 142
133 protected: 143 protected:
diff --git a/libopie/pim/odatebookaccess.cpp b/libopie/pim/odatebookaccess.cpp
index 08e61ff..a3661a3 100644
--- a/libopie/pim/odatebookaccess.cpp
+++ b/libopie/pim/odatebookaccess.cpp
@@ -3,2 +3,9 @@
3 3
4/**
5 * Simple constructor
6 * It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation
7 * will be used!
8 * @param back The backend to be used or 0 for the default backend
9 * @param ac What kind of access is intended
10 */
4ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac ) 11ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac )
@@ -14,2 +21,6 @@ ODateBookAccess::~ODateBookAccess() {
14} 21}
22
23/**
24 * @return all events available
25 */
15ODateBookAccess::List ODateBookAccess::rawEvents()const { 26ODateBookAccess::List ODateBookAccess::rawEvents()const {
@@ -20,2 +31,6 @@ ODateBookAccess::List ODateBookAccess::rawEvents()const {
20} 31}
32
33/**
34 * @return all repeating events
35 */
21ODateBookAccess::List ODateBookAccess::rawRepeats()const { 36ODateBookAccess::List ODateBookAccess::rawRepeats()const {
@@ -26,2 +41,6 @@ ODateBookAccess::List ODateBookAccess::rawRepeats()const {
26} 41}
42
43/**
44 * @return all non repeating events
45 */
27ODateBookAccess::List ODateBookAccess::nonRepeats()const { 46ODateBookAccess::List ODateBookAccess::nonRepeats()const {
@@ -32,2 +51,8 @@ ODateBookAccess::List ODateBookAccess::nonRepeats()const {
32} 51}
52
53/**
54 * @return dates in the time span between from and to
55 * @param from Include all events from...
56 * @param to Include all events to...
57 */
33OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDate& from, const QDate& to ) { 58OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDate& from, const QDate& to ) {
@@ -35,2 +60,5 @@ OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDate& from,
35} 60}
61/**
62 * @return all events at a given datetime
63 */
36OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDateTime& start ) { 64OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDateTime& start ) {
diff --git a/libopie/pim/odatebookaccess.h b/libopie/pim/odatebookaccess.h
index 7047039..7c7a63f 100644
--- a/libopie/pim/odatebookaccess.h
+++ b/libopie/pim/odatebookaccess.h
@@ -8,2 +8,11 @@
8 8
9/**
10 * This is the object orientated datebook database. It'll use OBackendFactory
11 * to query for a backend.
12 * All access to the datebook should be done via this class.
13 * Make sure to load and save the datebook this is not part of
14 * destructing and creating the object
15 *
16 * @author Holger Freyther
17 */
9class ODateBookAccess : public OPimAccessTemplate<OEvent> { 18class ODateBookAccess : public OPimAccessTemplate<OEvent> {
@@ -13,9 +22,9 @@ public:
13 22
14 /** return all events */ 23 /* return all events */
15 List rawEvents()const; 24 List rawEvents()const;
16 25
17 /** return repeating events */ 26 /* return repeating events */
18 List rawRepeats()const; 27 List rawRepeats()const;
19 28
20 /** return non repeating events */ 29 /* return non repeating events */
21 List nonRepeats()const; 30 List nonRepeats()const;
diff --git a/libopie/pim/odatebookaccessbackend.h b/libopie/pim/odatebookaccessbackend.h
index eb6e8fb..86ff298 100644
--- a/libopie/pim/odatebookaccessbackend.h
+++ b/libopie/pim/odatebookaccessbackend.h
@@ -8,2 +8,7 @@
8 8
9/**
10 * This class is the interface to the storage of Events.
11 * @see OPimAccessBackend
12 *
13 */
9class ODateBookAccessBackend : public OPimAccessBackend<OEvent> { 14class ODateBookAccessBackend : public OPimAccessBackend<OEvent> {
@@ -11,2 +16,6 @@ public:
11 typedef int UID; 16 typedef int UID;
17
18 /**
19 * c'tor without parameter
20 */
12 ODateBookAccessBackend(); 21 ODateBookAccessBackend();
@@ -14,4 +23,21 @@ public:
14 23
24 /**
25 * This method should return a list of UIDs containing
26 * all events. No filter should be applied
27 * @return list of events
28 */
15 virtual QArray<UID> rawEvents()const = 0; 29 virtual QArray<UID> rawEvents()const = 0;
30
31 /**
32 * This method should return a list of UIDs containing
33 * all repeating events. No filter should be applied
34 * @return list of repeating events
35 */
16 virtual QArray<UID> rawRepeats()const = 0; 36 virtual QArray<UID> rawRepeats()const = 0;
37
38 /**
39 * This mthod should return a list of UIDs containing all non
40 * repeating events. No filter should be applied
41 * @return list of nonrepeating events
42 */
17 virtual QArray<UID> nonRepeats() const = 0; 43 virtual QArray<UID> nonRepeats() const = 0;
@@ -19,6 +45,11 @@ public:
19 /** 45 /**
20 * these two methods are used if you do not implement 46 * If you do not want to implement the effectiveEvents methods below
21 * effectiveEvents... 47 * you need to supply it with directNonRepeats.
48 * This method can return empty lists if effectiveEvents is implememted
22 */ 49 */
23 virtual OEvent::ValueList directNonRepeats() = 0; 50 virtual OEvent::ValueList directNonRepeats() = 0;
51
52 /**
53 * Same as above but return raw repeats!
54 */
24 virtual OEvent::ValueList directRawRepeats() = 0; 55 virtual OEvent::ValueList directRawRepeats() = 0;
@@ -26,3 +57,13 @@ public:
26 /* is implemented by default but you can reimplement it*/ 57 /* is implemented by default but you can reimplement it*/
58 /**
59 * Effective Events are special event occuring during a time frame. This method does calcualte
60 * EffectiveEvents bases on the directNonRepeats and directRawRepeats. You may implement this method
61 * yourself
62 */
27 virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to ); 63 virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to );
64
65 /**
66 * this is an overloaded member function
67 * @see effecticeEvents
68 */
28 virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start ); 69 virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start );
diff --git a/libopie/pim/odatebookaccessbackend_xml.h b/libopie/pim/odatebookaccessbackend_xml.h
index 563c31f..7848f7c 100644
--- a/libopie/pim/odatebookaccessbackend_xml.h
+++ b/libopie/pim/odatebookaccessbackend_xml.h
@@ -7,2 +7,8 @@
7 7
8/**
9 * This is the default XML implementation for DateBoook XML storage
10 * It fully implements the interface
11 * @see ODateBookAccessBackend
12 * @see OPimAccessBackend
13 */
8class ODateBookAccessBackend_XML : public ODateBookAccessBackend { 14class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
diff --git a/libopie/pim/oevent.h b/libopie/pim/oevent.h
index 585515c..57d32d0 100644
--- a/libopie/pim/oevent.h
+++ b/libopie/pim/oevent.h
@@ -32,2 +32,8 @@ class OPimNotifyManager;
32class ORecur; 32class ORecur;
33
34/**
35 * This is the container for all Events. It encapsules all
36 * available information for a single Event
37 * @short container for events.
38 */
33class OEvent : public OPimRecord { 39class OEvent : public OPimRecord {
@@ -35,2 +41,5 @@ public:
35 typedef QValueList<OEvent> ValueList; 41 typedef QValueList<OEvent> ValueList;
42 /**
43 * RecordFields contain possible attributes
44 */
36 enum RecordFields { 45 enum RecordFields {
@@ -51,3 +60,10 @@ public:
51 60
61 /**
62 * Start with an Empty OEvent. UID == 0 means that it is empty
63 */
52 OEvent(int uid = 0); 64 OEvent(int uid = 0);
65
66 /**
67 * copy c'tor
68 */
53 OEvent( const OEvent& ); 69 OEvent( const OEvent& );
@@ -146,3 +162,2 @@ private:
146 */ 162 */
147
148class OEffectiveEvent { 163class OEffectiveEvent {