summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/odatebookaccessbackend.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.cpp b/libopie2/opiepim/backend/odatebookaccessbackend.cpp
index 73c7059..e44912a 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend.cpp
@@ -71,88 +71,105 @@ void repeat( OPimBackendOccurrence::List& tmpList, const OPimEvent::ValueList& l
while (rec.nextOcurrence(itDate, repeat ) ) {
if (repeat > to ) break;
OPimEvent event = *it;
start = QDateTime( repeat, event.startDateTime().time() );
end = QDateTime( repeat.addDays(dur), event.endDateTime().time() );
OPimBackendOccurrence eff(start, end, event.uid() );
tmpList.append( eff );
}
}
}
}
namespace Opie {
ODateBookAccessBackend::ODateBookAccessBackend()
: OPimAccessBackend<OPimEvent>()
{
}
ODateBookAccessBackend::~ODateBookAccessBackend() {
}
OPimBackendOccurrence::List ODateBookAccessBackend::occurrences( const QDate& from,
const QDate& to )const {
OPimBackendOccurrence::List tmpList;
events( tmpList, directNonRepeats(), from, to );
repeat( tmpList, directRawRepeats(),from,to );
return tmpList;
}
-OPimBackendOccurrence::List ODateBookAccessBackend::occurrences( const QDateTime& dt )const {
+
+OPimBackendOccurrence::List ODateBookAccessBackend::occurrences( const QDateTime& dt )const
+{
OPimBackendOccurrence::List day = occurrences( dt.date(), dt.date() );
return filterOccurrences( day, dt );
}
OPimBackendOccurrence::List ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDate& from,
- const QDate& to )const {
+ const QDate& to )const
+{
OPimBackendOccurrence::List tmpList;
OPimEvent::ValueList list = directNonRepeats();
events( tmpList, list, from, to );
return tmpList;
}
-OPimBackendOccurrence::List ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDateTime& dt )const {
+OPimBackendOccurrence::List ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDateTime& dt )const
+{
OPimBackendOccurrence::List day = effectiveNonRepeatingEvents( dt.date(), dt.date() );
return filterOccurrences( day,dt );
}
+const uint ODateBookAccessBackend::querySettings() const
+{
+ return 0;
+}
+
+bool ODateBookAccessBackend::hasQuerySettings (uint querySettings) const
+{
+ return false;
+}
+
+
-UIDArray ODateBookAccessBackend::queryByExample( const OPimEvent&, int settings,
- const QDateTime& d )const {
+UIDArray ODateBookAccessBackend::queryByExample( const UIDArray& uidlist, const OPimEvent&, int settings,
+ const QDateTime& d )const
+{
+ qDebug( "Accessing ODateBookAccessBackend::queryByExample() which is not implemented!" );
return UIDArray();
}
UIDArray ODateBookAccessBackend::sorted( const UIDArray&, bool asc, int, int, const QArray<int>& )const {
return UIDArray();
}
OPimBackendOccurrence::List ODateBookAccessBackend::filterOccurrences( const OPimBackendOccurrence::List dayList,
const QDateTime& dt ) {
OPimBackendOccurrence::List tmpList;
OPimBackendOccurrence::List::ConstIterator it;
for ( it = dayList.begin(); it != dayList.end(); ++it ) {
OPimBackendOccurrence occ = *it;
/*
* Let us find occurrences that are 'now'!
* If the dt.date() is on the same day as start or end of the Occurrence
* check how near start/end are.
* If it is in the middle of a multiday occurrence list it.
*
* We might want to 'lose' the sixty second offset and list
* all Events which are active at that time.
*/
if ( dt.date() == occ.startDateTime().date() ) {
if ( QABS( dt.time().secsTo( occ.startDateTime().time() ) ) < 60 )
tmpList.append( occ );
}else if ( dt.date() == occ.endDateTime().date() ) {
if ( QABS( dt.time().secsTo( occ.endDateTime().time() ) ) < 60 )
tmpList.append( occ );
}else if ( dt.date() >= occ.startDateTime().date() &&
dt.date() >= occ.endDateTime().date() )