summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Unidiff
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h14
-rw-r--r--libopie2/opiepim/core/odatebookaccess.cpp28
-rw-r--r--libopie2/opiepim/core/odatebookaccess.h15
3 files changed, 52 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index 32b2dcb..d7ceaf2 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -8,24 +8,29 @@
8 *This program is free software; you can redistribute it and/or 8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public 9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; 10 * License as published by the Free Software Foundation;
11 * either version 2 of the License, or (at your option) any later 11 * either version 2 of the License, or (at your option) any later
12 * version. 12 * version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Improved query by example: Search by date is possible.. First step 26 * Improved query by example: Search by date is possible.. First step
22 * for a today plugin for birthdays.. 27 * for a today plugin for birthdays..
23 * 28 *
24 * Revision 1.5 2002/11/13 14:14:51 eilers 29 * Revision 1.5 2002/11/13 14:14:51 eilers
25 * Added sorted for Contacts.. 30 * Added sorted for Contacts..
26 * 31 *
27 * Revision 1.4 2002/11/01 15:10:42 eilers 32 * Revision 1.4 2002/11/01 15:10:42 eilers
28 * Added regExp-search in database for all fields in a contact. 33 * Added regExp-search in database for all fields in a contact.
29 * 34 *
30 * Revision 1.3 2002/10/16 10:52:40 eilers 35 * Revision 1.3 2002/10/16 10:52:40 eilers
31 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 36 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
@@ -46,35 +51,40 @@
46 51
47#include <qobject.h> 52#include <qobject.h>
48 53
49#include <qpe/qcopenvelope_qws.h> 54#include <qpe/qcopenvelope_qws.h>
50 55
51#include <qvaluelist.h> 56#include <qvaluelist.h>
52#include <qfileinfo.h> 57#include <qfileinfo.h>
53 58
54#include "ocontact.h" 59#include "ocontact.h"
55#include "ocontactaccessbackend.h" 60#include "ocontactaccessbackend.h"
56#include "opimaccesstemplate.h" 61#include "opimaccesstemplate.h"
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
62 */ 71 */
63class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 72class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
64{ 73{
65 Q_OBJECT 74 Q_OBJECT
66 75
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
70 * (i.e. "todolist") 80 * (i.e. "todolist")
71 * @param filename The name of the database file. If not set, the default one 81 * @param filename The name of the database file. If not set, the default one
72 * is used. 82 * is used.
73 * @param backend Pointer to an alternative Backend. If not set, we will use 83 * @param backend Pointer to an alternative Backend. If not set, we will use
74 * the default backend. 84 * the default backend.
75 * @param handlesync If <b>true</b> the database stores the current state 85 * @param handlesync If <b>true</b> the database stores the current state
76 * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> 86 * automatically if it receives the signals <i>flush()</i> and <i>reload()</i>
77 * which are used before and after synchronisation. If the application wants 87 * which are used before and after synchronisation. If the application wants
78 * to react itself, it should be disabled by setting it to <b>false</b> 88 * to react itself, it should be disabled by setting it to <b>false</b>
79 * @see OContactAccessBackend 89 * @see OContactAccessBackend
80 */ 90 */
diff --git a/libopie2/opiepim/core/odatebookaccess.cpp b/libopie2/opiepim/core/odatebookaccess.cpp
index 08e61ff..a3661a3 100644
--- a/libopie2/opiepim/core/odatebookaccess.cpp
+++ b/libopie2/opiepim/core/odatebookaccess.cpp
@@ -1,38 +1,66 @@
1#include "obackendfactory.h" 1#include "obackendfactory.h"
2#include "odatebookaccess.h" 2#include "odatebookaccess.h"
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 )
5 : OPimAccessTemplate<OEvent>( back ) 12 : OPimAccessTemplate<OEvent>( back )
6{ 13{
7 if (!back ) 14 if (!back )
8 back = OBackendFactory<ODateBookAccessBackend>::Default("datebook", QString::null ); 15 back = OBackendFactory<ODateBookAccessBackend>::Default("datebook", QString::null );
9 16
10 m_backEnd = back; 17 m_backEnd = back;
11 setBackEnd( m_backEnd ); 18 setBackEnd( m_backEnd );
12} 19}
13ODateBookAccess::~ODateBookAccess() { 20ODateBookAccess::~ODateBookAccess() {
14} 21}
22
23/**
24 * @return all events available
25 */
15ODateBookAccess::List ODateBookAccess::rawEvents()const { 26ODateBookAccess::List ODateBookAccess::rawEvents()const {
16 QArray<int> ints = m_backEnd->rawEvents(); 27 QArray<int> ints = m_backEnd->rawEvents();
17 28
18 List lis( ints, this ); 29 List lis( ints, this );
19 return lis; 30 return lis;
20} 31}
32
33/**
34 * @return all repeating events
35 */
21ODateBookAccess::List ODateBookAccess::rawRepeats()const { 36ODateBookAccess::List ODateBookAccess::rawRepeats()const {
22 QArray<int> ints = m_backEnd->rawRepeats(); 37 QArray<int> ints = m_backEnd->rawRepeats();
23 38
24 List lis( ints, this ); 39 List lis( ints, this );
25 return lis; 40 return lis;
26} 41}
42
43/**
44 * @return all non repeating events
45 */
27ODateBookAccess::List ODateBookAccess::nonRepeats()const { 46ODateBookAccess::List ODateBookAccess::nonRepeats()const {
28 QArray<int> ints = m_backEnd->nonRepeats(); 47 QArray<int> ints = m_backEnd->nonRepeats();
29 48
30 List lis( ints, this ); 49 List lis( ints, this );
31 return lis; 50 return lis;
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 ) {
34 return m_backEnd->effecticeEvents( from, to ); 59 return m_backEnd->effecticeEvents( from, to );
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 ) {
37 return m_backEnd->effecticeEvents( start ); 65 return m_backEnd->effecticeEvents( start );
38} 66}
diff --git a/libopie2/opiepim/core/odatebookaccess.h b/libopie2/opiepim/core/odatebookaccess.h
index 7047039..7c7a63f 100644
--- a/libopie2/opiepim/core/odatebookaccess.h
+++ b/libopie2/opiepim/core/odatebookaccess.h
@@ -1,32 +1,41 @@
1#ifndef OPIE_DATE_BOOK_ACCESS_H 1#ifndef OPIE_DATE_BOOK_ACCESS_H
2#define OPIE_DATE_BOOK_ACCESS_H 2#define OPIE_DATE_BOOK_ACCESS_H
3 3
4#include "odatebookaccessbackend.h" 4#include "odatebookaccessbackend.h"
5#include "opimaccesstemplate.h" 5#include "opimaccesstemplate.h"
6 6
7#include "oevent.h" 7#include "oevent.h"
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> {
10public: 19public:
11 ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random ); 20 ODateBookAccess( ODateBookAccessBackend* = 0l, enum Access acc = Random );
12 ~ODateBookAccess(); 21 ~ODateBookAccess();
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;
22 31
23 OEffectiveEvent::ValueList effectiveEvents( const QDate& from, const QDate& to ); 32 OEffectiveEvent::ValueList effectiveEvents( const QDate& from, const QDate& to );
24 OEffectiveEvent::ValueList effectiveEvents( const QDateTime& start ); 33 OEffectiveEvent::ValueList effectiveEvents( const QDateTime& start );
25 34
26private: 35private:
27 ODateBookAccessBackend* m_backEnd; 36 ODateBookAccessBackend* m_backEnd;
28 class Private; 37 class Private;
29 Private* d; 38 Private* d;
30}; 39};
31 40
32#endif 41#endif