author | eilers <eilers> | 2002-10-07 17:44:24 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-07 17:44:24 (UTC) |
commit | d25a925e70982b86539b98362ab2cd75c7883110 (patch) (side-by-side diff) | |
tree | eaa1d292fdfc9a87e538130b8c635df63086ec9c | |
parent | 0981af024243b314b45ddaf3ebee08bc184f06e2 (diff) | |
download | opie-d25a925e70982b86539b98362ab2cd75c7883110.zip opie-d25a925e70982b86539b98362ab2cd75c7883110.tar.gz opie-d25a925e70982b86539b98362ab2cd75c7883110.tar.bz2 |
added OBackendFactory for advanced backend access
-rw-r--r-- | libopie/pim/otodoaccess.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp index 5990841..4468812 100644 --- a/libopie/pim/otodoaccess.cpp +++ b/libopie/pim/otodoaccess.cpp @@ -1,62 +1,65 @@ #include <qdatetime.h> #include <qpe/alarmserver.h> #include "otodoaccesssql.h" #include "otodoaccess.h" - +#include "obackendfactory.h" OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) { if (end == 0l ) m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); + // if (end == 0l ) + // m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); + setBackEnd( m_todoBackEnd ); } OTodoAccess::~OTodoAccess() { // qWarning("~OTodoAccess"); } void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { QValueList<OTodo>::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { replace( (*it) ); } } OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, const QDate& end, bool includeNoDates ) { QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); List lis( ints, this ); return lis; } OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, bool includeNoDates ) { return effectiveToDos( start, QDate::currentDate(), includeNoDates ); } OTodoAccess::List OTodoAccess::overDue() { List lis( m_todoBackEnd->overDue(), this ); return lis; } void OTodoAccess::addAlarm( const OTodo& event) { if (!event.hasAlarmDateTime() ) return; QDateTime now = QDateTime::currentDateTime(); QDateTime schedule = event.alarmDateTime(); if ( schedule > now ){ AlarmServer::addAlarm( schedule, "QPE/Application/todolist", "alarm(QDateTime,int)", event.uid() ); } } void OTodoAccess::delAlarm( int uid) { QDateTime schedule; // Create null DateTime // I hope this will remove all scheduled alarms // with the given uid !? diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index 5990841..4468812 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp @@ -1,62 +1,65 @@ #include <qdatetime.h> #include <qpe/alarmserver.h> #include "otodoaccesssql.h" #include "otodoaccess.h" - +#include "obackendfactory.h" OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) { if (end == 0l ) m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); + // if (end == 0l ) + // m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); + setBackEnd( m_todoBackEnd ); } OTodoAccess::~OTodoAccess() { // qWarning("~OTodoAccess"); } void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { QValueList<OTodo>::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { replace( (*it) ); } } OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, const QDate& end, bool includeNoDates ) { QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); List lis( ints, this ); return lis; } OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, bool includeNoDates ) { return effectiveToDos( start, QDate::currentDate(), includeNoDates ); } OTodoAccess::List OTodoAccess::overDue() { List lis( m_todoBackEnd->overDue(), this ); return lis; } void OTodoAccess::addAlarm( const OTodo& event) { if (!event.hasAlarmDateTime() ) return; QDateTime now = QDateTime::currentDateTime(); QDateTime schedule = event.alarmDateTime(); if ( schedule > now ){ AlarmServer::addAlarm( schedule, "QPE/Application/todolist", "alarm(QDateTime,int)", event.uid() ); } } void OTodoAccess::delAlarm( int uid) { QDateTime schedule; // Create null DateTime // I hope this will remove all scheduled alarms // with the given uid !? |