-rw-r--r-- | libopie/pim/otodoaccess.cpp | 6 | ||||
-rw-r--r-- | libopie/pim/otodoaccess.h | 15 | ||||
-rw-r--r-- | libopie/pim/otodoaccessbackend.h | 3 | ||||
-rw-r--r-- | libopie/pim/otodoaccessvcal.cpp | 20 | ||||
-rw-r--r-- | libopie/pim/otodoaccessvcal.h | 2 | ||||
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 16 | ||||
-rw-r--r-- | libopie/pim/otodoaccessxml.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessbackend.h | 3 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.h | 15 |
14 files changed, 126 insertions, 2 deletions
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp index 5e89a1b..37f6fbc 100644 --- a/libopie/pim/otodoaccess.cpp +++ b/libopie/pim/otodoaccess.cpp @@ -54,3 +54,9 @@ OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int void OTodoAccess::removeAllCompleted() { m_todoBackEnd->removeAllCompleted(); } +QBitArray OTodoAccess::backendSupport( const QString& ) const{ + return m_todoBackEnd->supports(); +} +bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ + return backendSupport(ar).testBit( attr ); +} diff --git a/libopie/pim/otodoaccess.h b/libopie/pim/otodoaccess.h index a626731..916923f 100644 --- a/libopie/pim/otodoaccess.h +++ b/libopie/pim/otodoaccess.h @@ -72,6 +72,21 @@ public: */ void removeAllCompleted(); + /** + * request information about what a backend supports. + * Supports in the sense of beeing able to store. + * This is related to the enum in OTodo + * + * @param backend Will be used in the future when we support multiple backend + */ + QBitArray backendSupport( const QString& backend = QString::null )const; + + /** + * see above but for a specefic attribute. This method was added for convience + * @param attr The attribute to be queried for + * @param backend Will be used in the future when we support multiple backends + */ + bool backendSupports( int attr, const QString& backend = QString::null )const; signals: /** * if the OTodoAccess was changed diff --git a/libopie/pim/otodoaccessbackend.h b/libopie/pim/otodoaccessbackend.h index 7944a2c..05e8ca9 100644 --- a/libopie/pim/otodoaccessbackend.h +++ b/libopie/pim/otodoaccessbackend.h @@ -1,6 +1,8 @@ #ifndef OPIE_TODO_ACCESS_BACKEND_H #define OPIE_TODO_ACCESS_BACKEND_H +#include <qbitarray.h> + #include "otodo.h" #include "opimaccessbackend.h" @@ -15,6 +17,7 @@ public: virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, int cat ) = 0; virtual void removeAllCompleted() = 0; + virtual QBitArray supports()const = 0; }; diff --git a/libopie/pim/otodoaccessvcal.cpp b/libopie/pim/otodoaccessvcal.cpp index 2136283..9bc16c6 100644 --- a/libopie/pim/otodoaccessvcal.cpp +++ b/libopie/pim/otodoaccessvcal.cpp @@ -199,3 +199,23 @@ QArray<int> OTodoAccessVCal::overDue() { QArray<int> ar(0); return ar; } +QBitArray OTodoAccessVCal::supports()const { + static QBitArray ar = sup(); + + return ar; +} +QBitArray OTodoAccessVCal::sup() { + QBitArray ar ( OTodo::CompletedDate +1 ); + ar.fill( true ); + + ar[OTodo::CrossReference] = false; + ar[OTodo::State ] = false; + ar[OTodo::Reminders] = false; + ar[OTodo::Notifiers] = false; + ar[OTodo::Maintainer] = false; + ar[OTodo::Progress] = false; + ar[OTodo::Alarms ] = false; + ar[OTodo::Recurrence] = false; + + return ar; +} diff --git a/libopie/pim/otodoaccessvcal.h b/libopie/pim/otodoaccessvcal.h index a90ee9c..489416b 100644 --- a/libopie/pim/otodoaccessvcal.h +++ b/libopie/pim/otodoaccessvcal.h @@ -27,8 +27,10 @@ public: bool replace( const OTodo& ); void removeAllCompleted(); + virtual QBitArray supports()const; private: + static QBitArray sup(); bool m_dirty : 1; QString m_file; QMap<int, OTodo> m_map; diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 71e8787..55f268b 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp @@ -664,7 +664,6 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, for (uint i= 0; i < vector.count(); i++ ) { array[i] = ( vector.at(i) )->todo.uid(); } - qWarning("array count = %d %d", array.count(), vector.count() ); return array; }; void OTodoAccessXML::removeAllCompleted() { @@ -673,3 +672,18 @@ void OTodoAccessXML::removeAllCompleted() { m_events.remove( it ); } } +QBitArray OTodoAccessXML::supports()const { + static QBitArray ar = sup(); + return ar; +} +QBitArray OTodoAccessXML::sup() { + QBitArray ar( OTodo::CompletedDate +1 ); + ar.fill( true ); + ar[OTodo::CrossReference] = false; + ar[OTodo::State ] = false; + ar[OTodo::Reminders] = false; + ar[OTodo::Notifiers] = false; + ar[OTodo::Maintainer] = false; + + return ar; +} diff --git a/libopie/pim/otodoaccessxml.h b/libopie/pim/otodoaccessxml.h index 1032c92..cc4a16f 100644 --- a/libopie/pim/otodoaccessxml.h +++ b/libopie/pim/otodoaccessxml.h @@ -39,7 +39,9 @@ public: QArray<int> overDue(); QArray<int> sorted( bool asc, int sortOrder, int sortFilter, int cat ); + QBitArray supports()const; private: + static QBitArray sup(); void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& ); QString toString( const OTodo& )const; QString toString( const QArray<int>& ints ) const; diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h index 7944a2c..05e8ca9 100644 --- a/libopie2/opiepim/backend/otodoaccessbackend.h +++ b/libopie2/opiepim/backend/otodoaccessbackend.h @@ -1,6 +1,8 @@ #ifndef OPIE_TODO_ACCESS_BACKEND_H #define OPIE_TODO_ACCESS_BACKEND_H +#include <qbitarray.h> + #include "otodo.h" #include "opimaccessbackend.h" @@ -15,6 +17,7 @@ public: virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, int cat ) = 0; virtual void removeAllCompleted() = 0; + virtual QBitArray supports()const = 0; }; diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 2136283..9bc16c6 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp @@ -199,3 +199,23 @@ QArray<int> OTodoAccessVCal::overDue() { QArray<int> ar(0); return ar; } +QBitArray OTodoAccessVCal::supports()const { + static QBitArray ar = sup(); + + return ar; +} +QBitArray OTodoAccessVCal::sup() { + QBitArray ar ( OTodo::CompletedDate +1 ); + ar.fill( true ); + + ar[OTodo::CrossReference] = false; + ar[OTodo::State ] = false; + ar[OTodo::Reminders] = false; + ar[OTodo::Notifiers] = false; + ar[OTodo::Maintainer] = false; + ar[OTodo::Progress] = false; + ar[OTodo::Alarms ] = false; + ar[OTodo::Recurrence] = false; + + return ar; +} diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h index a90ee9c..489416b 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.h +++ b/libopie2/opiepim/backend/otodoaccessvcal.h @@ -27,8 +27,10 @@ public: bool replace( const OTodo& ); void removeAllCompleted(); + virtual QBitArray supports()const; private: + static QBitArray sup(); bool m_dirty : 1; QString m_file; QMap<int, OTodo> m_map; diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 71e8787..55f268b 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp @@ -664,7 +664,6 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, for (uint i= 0; i < vector.count(); i++ ) { array[i] = ( vector.at(i) )->todo.uid(); } - qWarning("array count = %d %d", array.count(), vector.count() ); return array; }; void OTodoAccessXML::removeAllCompleted() { @@ -673,3 +672,18 @@ void OTodoAccessXML::removeAllCompleted() { m_events.remove( it ); } } +QBitArray OTodoAccessXML::supports()const { + static QBitArray ar = sup(); + return ar; +} +QBitArray OTodoAccessXML::sup() { + QBitArray ar( OTodo::CompletedDate +1 ); + ar.fill( true ); + ar[OTodo::CrossReference] = false; + ar[OTodo::State ] = false; + ar[OTodo::Reminders] = false; + ar[OTodo::Notifiers] = false; + ar[OTodo::Maintainer] = false; + + return ar; +} diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h index 1032c92..cc4a16f 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.h +++ b/libopie2/opiepim/backend/otodoaccessxml.h @@ -39,7 +39,9 @@ public: QArray<int> overDue(); QArray<int> sorted( bool asc, int sortOrder, int sortFilter, int cat ); + QBitArray supports()const; private: + static QBitArray sup(); void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& ); QString toString( const OTodo& )const; QString toString( const QArray<int>& ints ) const; diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index 5e89a1b..37f6fbc 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp @@ -54,3 +54,9 @@ OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int void OTodoAccess::removeAllCompleted() { m_todoBackEnd->removeAllCompleted(); } +QBitArray OTodoAccess::backendSupport( const QString& ) const{ + return m_todoBackEnd->supports(); +} +bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ + return backendSupport(ar).testBit( attr ); +} diff --git a/libopie2/opiepim/core/otodoaccess.h b/libopie2/opiepim/core/otodoaccess.h index a626731..916923f 100644 --- a/libopie2/opiepim/core/otodoaccess.h +++ b/libopie2/opiepim/core/otodoaccess.h @@ -72,6 +72,21 @@ public: */ void removeAllCompleted(); + /** + * request information about what a backend supports. + * Supports in the sense of beeing able to store. + * This is related to the enum in OTodo + * + * @param backend Will be used in the future when we support multiple backend + */ + QBitArray backendSupport( const QString& backend = QString::null )const; + + /** + * see above but for a specefic attribute. This method was added for convience + * @param attr The attribute to be queried for + * @param backend Will be used in the future when we support multiple backends + */ + bool backendSupports( int attr, const QString& backend = QString::null )const; signals: /** * if the OTodoAccess was changed |