summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h1
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp6
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h2
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp27
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h1
5 files changed, 24 insertions, 13 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h
index 3bad6b7..7944a2c 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.h
+++ b/libopie2/opiepim/backend/otodoaccessbackend.h
@@ -14,6 +14,7 @@ public:
virtual QArray<int> overDue() = 0;
virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
int cat ) = 0;
+ virtual void removeAllCompleted() = 0;
};
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index ac70ea0..e96cc3c 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -154,6 +154,12 @@ bool OTodoAccessVCal::remove( int uid ) {
m_dirty = true;
return true;
}
+void OTodoAccessVCal::removeAllCompleted() {
+ for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) {
+ if ( (*it).isCompleted() )
+ m_map.remove( it );
+ }
+}
bool OTodoAccessVCal::replace( const OTodo& to ) {
m_map.replace( to.uid(), to );
m_dirty = true;
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h
index 4499a7e..452f602 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.h
+++ b/libopie2/opiepim/backend/otodoaccessvcal.h
@@ -26,6 +26,8 @@ public:
bool remove( int uid );
bool replace( const OTodo& );
+ void removeAllCompleted();
+
private:
bool m_dirty : 1;
QString m_file;
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index c1682c6..b2dfe80 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -28,7 +28,7 @@ bool OTodoAccessXML::load() {
/*
* UPDATE dict if you change anything!!!
*/
- QAsciiDict<int> dict(15);
+ QAsciiDict<int> dict(21);
dict.setAutoDelete( TRUE );
dict.insert("Categories" , new int(OTodo::Category) );
dict.insert("Uid" , new int(OTodo::Uid) );
@@ -43,11 +43,15 @@ bool OTodoAccessXML::load() {
dict.insert("Progress" , new int(OTodo::Progress) );
dict.insert("Completed", new int(OTodo::Completed) );
dict.insert("CrossReference", new int(OTodo::CrossReference) );
- dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) );
- dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) );
+ dict.insert("State", new int(OTodo::State) );
+ dict.insert("Recurrence", new int(OTodo::Recurrence) );
+ dict.insert("Alarms", new int(OTodo::Alarms) );
+ dict.insert("Reminders", new int(OTodo::Reminders) );
+ dict.insert("Notifiers", new int(OTodo::Notifiers) );
+ dict.insert("Maintainer", new int(OTodo::Maintainer) );
// here the custom XML parser from TT it's GPL
- // but we want to push that to TT.....
+ // but we want to push OpiePIM... to TT.....
QFile f(m_file );
if (!f.open(IO_ReadOnly) )
return false;
@@ -336,14 +340,6 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
}
break;
}
- case OTodo::HasAlarmDateTime:
- ev.setHasAlarmDateTime( val.toInt() );
- break;
- case OTodo::AlarmDateTime: {
- /* this sounds better ;) zecke */
- ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) );
- break;
- }
default:
break;
}
@@ -383,7 +379,6 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
*/
// cross refernce
- str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" ";
return str;
}
@@ -616,3 +611,9 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
qWarning("array count = %d %d", array.count(), vector.count() );
return array;
};
+void OTodoAccessXML::removeAllCompleted() {
+ for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
+ if ( (*it).isCompleted() )
+ m_events.remove( it );
+ }
+}
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h
index dc41c32..93609fe 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.h
+++ b/libopie2/opiepim/backend/otodoaccessxml.h
@@ -29,6 +29,7 @@ public:
void clear();
bool add( const OTodo& );
bool remove( int uid );
+ void removeAllCompleted();
bool replace( const OTodo& );
/* our functions */