summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-07 15:26:59 (UTC)
committer zecke <zecke>2003-05-07 15:26:59 (UTC)
commite150dfd5151aa59eb373aa58df5d9644c6c65b52 (patch) (side-by-side diff)
tree4cbc036ef9bfc51d9938d6ff6a433081c0b400b8
parent1a550df3248342a8c863951ba733b862ca222216 (diff)
downloadopie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.zip
opie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.tar.gz
opie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.tar.bz2
Make it possible to see what a backend supports
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccess.cpp6
-rw-r--r--libopie/pim/otodoaccess.h15
-rw-r--r--libopie/pim/otodoaccessbackend.h3
-rw-r--r--libopie/pim/otodoaccessvcal.cpp20
-rw-r--r--libopie/pim/otodoaccessvcal.h2
-rw-r--r--libopie/pim/otodoaccessxml.cpp16
-rw-r--r--libopie/pim/otodoaccessxml.h2
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h3
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp20
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h2
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp16
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h2
-rw-r--r--libopie2/opiepim/core/otodoaccess.cpp6
-rw-r--r--libopie2/opiepim/core/otodoaccess.h15
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
@@ -56 +56,7 @@ void OTodoAccess::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
@@ -74,2 +74,17 @@ public:
+ /**
+ * 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:
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
@@ -3,2 +3,4 @@
+#include <qbitarray.h>
+
#include "otodo.h"
@@ -17,2 +19,3 @@ public:
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
@@ -201 +201,21 @@ QArray<int> OTodoAccessVCal::overDue() {
}
+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
@@ -29,4 +29,6 @@ public:
void removeAllCompleted();
+ virtual QBitArray supports()const;
private:
+ static QBitArray sup();
bool m_dirty : 1;
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
@@ -666,3 +666,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
}
- qWarning("array count = %d %d", array.count(), vector.count() );
return array;
@@ -675 +674,16 @@ void OTodoAccessXML::removeAllCompleted() {
}
+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
@@ -41,3 +41,5 @@ public:
int sortFilter, int cat );
+ QBitArray supports()const;
private:
+ static QBitArray sup();
void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& );
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
@@ -3,2 +3,4 @@
+#include <qbitarray.h>
+
#include "otodo.h"
@@ -17,2 +19,3 @@ public:
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
@@ -201 +201,21 @@ QArray<int> OTodoAccessVCal::overDue() {
}
+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
@@ -29,4 +29,6 @@ public:
void removeAllCompleted();
+ virtual QBitArray supports()const;
private:
+ static QBitArray sup();
bool m_dirty : 1;
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
@@ -666,3 +666,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
}
- qWarning("array count = %d %d", array.count(), vector.count() );
return array;
@@ -675 +674,16 @@ void OTodoAccessXML::removeAllCompleted() {
}
+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
@@ -41,3 +41,5 @@ public:
int sortFilter, int cat );
+ QBitArray supports()const;
private:
+ static QBitArray sup();
void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& );
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
@@ -56 +56,7 @@ void OTodoAccess::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
@@ -74,2 +74,17 @@ public:
+ /**
+ * 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: