summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h26
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend.h30
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp7
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.h12
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp7
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h12
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend.h45
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.h6
8 files changed, 134 insertions, 11 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 3a73210..ad6cf5a 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -7,24 +7,29 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Use plugins
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.6 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.5 2003/02/21 23:31:52 zecke
* Add XML datebookresource
* -clean up todoaccessxml header
* -implement some more stuff in the oeven tester
* -extend DefaultFactory to not crash and to use datebook
*
* -reading of OEvents is working nicely.. saving will be added
* tomorrow
* -fix spelling in ODateBookAcces
*
* Revision 1.4 2002/10/14 15:55:18 eilers
* Redeactivate SQL.. ;)
@@ -54,37 +59,56 @@
#include <qstring.h>
#include <qasciidict.h>
#include <qpe/config.h>
#include "otodoaccessxml.h"
#include "ocontactaccessbackend_xml.h"
#include "odatebookaccessbackend_xml.h"
#ifdef __USE_SQL
#include "otodoaccesssql.h"
#endif
-
+/**
+ * This class is our factory. It will give us the default implementations
+ * of at least Todolist, Contacts and Datebook. In the future this class will
+ * allow users to switch the backend with ( XML->SQLite ) without the need
+ * to recompile.#
+ * This class as the whole PIM Api is making use of templates
+ *
+ * <pre>
+ * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
+ * backend->load();
+ * </pre>
+ *
+ * @author Stefan Eilers
+ * @version 0.1
+ */
template<class T>
class OBackendFactory
{
public:
OBackendFactory() {};
enum BACKENDS {
TODO,
CONTACT,
DATE
};
+ /**
+ * Returns a backend implementation for backendName
+ * @param backendName the type of the backend
+ * @param appName will be passed on to the backend
+ */
static T* Default( const QString backendName, const QString& appName ){
// __asm__("int3");
Config config( "pimaccess" );
config.setGroup ( backendName );
QString backend = config.readEntry( "usebackend" );
QAsciiDict<int> dict ( 3 );
dict.setAutoDelete ( TRUE );
dict.insert( "todo", new int (TODO) );
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend.h b/libopie2/opiepim/backend/ocontactaccessbackend.h
index 821f5bf..ebeb42d 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend.h
@@ -10,24 +10,29 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.5 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.4 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.3 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.2 2002/10/07 17:34:24 eilers
* added OBackendFactory for advanced backend access
*
* Revision 1.1 2002/09/27 17:11:44 eilers
* Added API for accessing the Contact-Database ! It is compiling, but
* please do not expect that anything is working !
@@ -35,51 +40,68 @@
* Please read README_COMPILE for compiling !
*
* =====================================================================
*
*/
#ifndef _OCONTACTACCESSBACKEND_H_
#define _OCONTACTACCESSBACKEND_H_
#include "ocontact.h"
#include "opimaccessbackend.h"
-#include "qregexp.h"
+#include <qregexp.h>
+/**
+ * This class represents the interface of all Contact Backends.
+ * Derivates of this class will be used to access the contacts.
+ * As implementation currently XML and vCard exist. This class needs to be implemented
+ * if you want to provide your own storage.
+ * In all queries a list of uids is passed on instead of loading the actual record!
+ *
+ * @see OContactAccessBackend_VCard
+ * @see OContactAccessBackend_XML
+ */
class OContactAccessBackend: public OPimAccessBackend<OContact> {
public:
OContactAccessBackend() {}
virtual ~OContactAccessBackend() {}
- /** Return if database was changed externally.
+ /**
+ * Return if database was changed externally.
* This may just make sense on file based databases like a XML-File.
* It is used to prevent to overwrite the current database content
* if the file was already changed by something else !
* If this happens, we have to reload before save our data.
* If we use real databases, this should be handled by the database
* management system themselve, therefore this function should always return false in
* this case. It is not our problem to handle this conflict ...
* @return <i>true</i> if the database was changed and if save without reload will
* be dangerous. <i>false</i> if the database was not changed or it is save to write
* in this situation.
*/
virtual bool wasChangedExternally() = 0;
virtual QArray<int> matchRegexp( const QRegExp &r ) const = 0;
- /** Return all possible settings.
+ /**
+ * Return all possible settings.
* @return All settings provided by the current backend
* (i.e.: query_WildCards & query_IgnoreCase)
*/
virtual const uint querySettings() = 0;
- /** Check whether settings are correct.
+ /**
+ * Check whether settings are correct.
* @return <i>true</i> if the given settings are correct and possible.
*/
virtual bool hasQuerySettings (uint querySettings) const = 0;
+ /**
+ * FIXME!!!
+ * Returns a sorted list of records either ascendinf or descending for a giving criteria and category
+ */
virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
};
#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index f24523f..270bef3 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -8,24 +8,29 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo:
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.10 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.9 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.8 2003/02/21 16:52:49 zecke
* -Remove old Todo classes they're deprecated and today I already using the
* new API
* -Guard against self assignment in OTodo
@@ -67,25 +72,25 @@
* Revision 1.1 2002/11/09 14:34:52 eilers
* Added VCard Backend.
*
*/
#include "ocontactaccessbackend_vcard.h"
#include "../../library/backend/vobject_p.h"
#include "../../library/backend/qfiledirect_p.h"
#include <qpe/timeconversion.h>
#include <qfile.h>
-OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ):
+OContactAccessBackend_VCard::OContactAccessBackend_VCard ( const QString& , const QString& filename ):
m_dirty( false ),
m_file( filename )
{
load();
}
bool OContactAccessBackend_VCard::load ()
{
m_map.clear();
m_dirty = false;
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
index 93e2da3..712d769 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
@@ -8,24 +8,29 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo:
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.6 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.5 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.4 2002/12/07 13:26:22 eilers
* Fixing bug in storing anniversary..
*
* Revision 1.3 2002/11/13 14:14:51 eilers
@@ -38,27 +43,32 @@
* Added VCard Backend.
*
*/
#ifndef __OCONTACTACCESSBACKEND_VCARD_H_
#define __OCONTACTACCESSBACKEND_VCARD_H_
#include <opie/ocontact.h>
#include "ocontactaccessbackend.h"
class VObject;
+/**
+ * This is the vCard 2.1 implementation of the Contact Storage
+ * @see OContactAccessBackend_XML
+ * @see OPimAccessBackend
+ */
class OContactAccessBackend_VCard : public OContactAccessBackend {
public:
- OContactAccessBackend_VCard ( QString appname, QString filename = 0l );
+ OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
bool load ();
bool reload();
bool save();
void clear ();
bool add ( const OContact& newcontact );
bool remove ( int uid );
bool replace ( const OContact& contact );
OContact find ( int uid ) const;
QArray<int> allRecords() const;
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index c5a7820..661cd51 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -8,24 +8,29 @@
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.5 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.4 2003/03/21 14:32:54 mickeyl
* g++ compliance fix: default arguments belong into the declaration, but not the definition
*
* Revision 1.3 2003/03/21 12:26:28 eilers
* Fixing small bug: If we search a birthday from today to today, it returned
* every contact ..
*
* Revision 1.2 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
@@ -98,25 +103,25 @@
#include <qpe/global.h>
#include <opie/xmltree.h>
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <stdlib.h>
#include <errno.h>
using namespace Opie;
-OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString filename ):
+OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ):
m_changed( false )
{
// Just m_contactlist should call delete if an entry
// is removed.
m_contactList.setAutoDelete( true );
m_uidToContact.setAutoDelete( false );
m_appName = appname;
/* Set journalfile name ... */
m_journalName = getenv("HOME");
m_journalName +="/.abjournal" + appname;
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index 4d6a7ef..7b5365b 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -8,24 +8,29 @@
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.14 2003/04/13 18:07:10 zecke
+ * More API doc
+ * QString -> const QString&
+ * QString = 0l -> QString::null
+ *
* Revision 1.13 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
*
* Revision 1.12.2.2 2003/02/11 12:17:28 eilers
* Speed optimization. Removed the sequential search loops.
*
* Revision 1.12.2.1 2003/02/09 15:05:01 eilers
@@ -75,27 +80,32 @@
*/
#ifndef _OContactAccessBackend_XML_
#define _OContactAccessBackend_XML_
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <qlist.h>
#include <qdict.h>
/* the default xml implementation */
+/**
+ * This class is the XML implementation of a Contact backend
+ * it does implement everything available for OContact.
+ * @see OPimAccessBackend for more information of available methods
+ */
class OContactAccessBackend_XML : public OContactAccessBackend {
public:
- OContactAccessBackend_XML ( QString appname, QString filename = 0l );
+ OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null );
bool save();
bool load ();
void clear ();
bool wasChangedExternally();
QArray<int> allRecords() const;
OContact find ( int uid ) const;
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.h b/libopie2/opiepim/backend/odatebookaccessbackend.h
index eb6e8fb..86ff298 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend.h
@@ -1,32 +1,73 @@
#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_H
#define OPIE_DATE_BOOK_ACCESS_BACKEND_H
#include <qarray.h>
#include "opimaccessbackend.h"
#include "oevent.h"
+/**
+ * This class is the interface to the storage of Events.
+ * @see OPimAccessBackend
+ *
+ */
class ODateBookAccessBackend : public OPimAccessBackend<OEvent> {
public:
typedef int UID;
+
+ /**
+ * c'tor without parameter
+ */
ODateBookAccessBackend();
~ODateBookAccessBackend();
+ /**
+ * This method should return a list of UIDs containing
+ * all events. No filter should be applied
+ * @return list of events
+ */
virtual QArray<UID> rawEvents()const = 0;
+
+ /**
+ * This method should return a list of UIDs containing
+ * all repeating events. No filter should be applied
+ * @return list of repeating events
+ */
virtual QArray<UID> rawRepeats()const = 0;
+
+ /**
+ * This mthod should return a list of UIDs containing all non
+ * repeating events. No filter should be applied
+ * @return list of nonrepeating events
+ */
virtual QArray<UID> nonRepeats() const = 0;
/**
- * these two methods are used if you do not implement
- * effectiveEvents...
+ * If you do not want to implement the effectiveEvents methods below
+ * you need to supply it with directNonRepeats.
+ * This method can return empty lists if effectiveEvents is implememted
*/
virtual OEvent::ValueList directNonRepeats() = 0;
+
+ /**
+ * Same as above but return raw repeats!
+ */
virtual OEvent::ValueList directRawRepeats() = 0;
/* is implemented by default but you can reimplement it*/
+ /**
+ * Effective Events are special event occuring during a time frame. This method does calcualte
+ * EffectiveEvents bases on the directNonRepeats and directRawRepeats. You may implement this method
+ * yourself
+ */
virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to );
+
+ /**
+ * this is an overloaded member function
+ * @see effecticeEvents
+ */
virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start );
};
#endif
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
index 563c31f..7848f7c 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
@@ -1,19 +1,25 @@
#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
#define OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
#include <qmap.h>
#include "odatebookaccessbackend.h"
+/**
+ * This is the default XML implementation for DateBoook XML storage
+ * It fully implements the interface
+ * @see ODateBookAccessBackend
+ * @see OPimAccessBackend
+ */
class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
public:
ODateBookAccessBackend_XML( const QString& appName,
const QString& fileName = QString::null);
~ODateBookAccessBackend_XML();
bool load();
bool reload();
bool save();
QArray<int> allRecords()const;
QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() );