summaryrefslogtreecommitdiff
path: root/libopie/pim
authorzecke <zecke>2003-05-12 13:20:21 (UTC)
committer zecke <zecke>2003-05-12 13:20:21 (UTC)
commita4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d (patch) (side-by-side diff)
treeaee89fa76cc9e71a67d8ae9462b567e3f91f284f /libopie/pim
parentc2602b4c290a14f4655d7e07eea20b55c1f38c8e (diff)
downloadopie-a4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d.zip
opie-a4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d.tar.gz
opie-a4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d.tar.bz2
Hospital Hacking Session
kill warnings implement storing of reminders and alarms... Nach viel Eiter und Gestank...
Diffstat (limited to 'libopie/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccessxml.cpp71
1 files changed, 65 insertions, 6 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 69b7ab4..2b62f0d 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -20,2 +20,3 @@
#include "otimezone.h"
+#include "opimnotifymanager.h"
#include "orecur.h"
@@ -428,2 +429,23 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
break;
+ case OTodo::Alarms:{
+ OPimNotifyManager &manager = ev.notifiers();
+ QStringList als = QStringList::split(";", val );
+ for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
+ QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
+ qWarning("alarm: %s", alarm.join("___").latin1() );
+ qWarning("alarm[0]: %s %s", alarm[0].latin1(), OConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
+ OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
+ manager.add( al );
+ }
+ }
+ break;
+ case OTodo::Reminders:{
+ OPimNotifyManager &manager = ev.notifiers();
+ QStringList rems = QStringList::split(";", val );
+ for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
+ OPimReminder rem( (*it).toInt() );
+ manager.add( rem );
+ }
+ }
+ break;
case OTodo::CrossReference:
@@ -524,2 +546,40 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
+ /*
+ * save reminders and notifiers!
+ * DATE_TIME:DURATION:SOUND:NOT_USED_YET;OTHER_DATE_TIME:OTHER:DURATION:SOUND:....
+ */
+ if ( ev.hasNotifiers() ) {
+ OPimNotifyManager manager = ev.notifiers();
+ OPimNotifyManager::Alarms alarms = manager.alarms();
+ if (!alarms.isEmpty() ) {
+ QStringList als;
+ OPimNotifyManager::Alarms::Iterator it = alarms.begin();
+ for ( ; it != alarms.end(); ++it ) {
+ /* only if time is valid */
+ if ( (*it).dateTime().isValid() ) {
+ als << OConversion::dateTimeToString( (*it).dateTime() )
+ + ":" + QString::number( (*it).duration() )
+ + ":" + QString::number( (*it).sound() )
+ + ":";
+ }
+ }
+ // now write the list
+ qWarning("als: %s", als.join("____________").latin1() );
+ str += "Alarms=\""+als.join(";") +"\" ";
+ }
+
+ /*
+ * now the same for reminders but more easy. We just save the uid of the OEvent.
+ */
+ OPimNotifyManager::Reminders reminders = manager.reminders();
+ if (!reminders.isEmpty() ) {
+ OPimNotifyManager::Reminders::Iterator it = reminders.begin();
+ QStringList records;
+ for ( ; it != reminders.end(); ++it ) {
+ records << QString::number( (*it).recordUid() );
+ }
+ str += "Reminders=\""+ records.join(";") +"\" ";
+ }
+ }
+
@@ -706,3 +766,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
int sortFilter, int cat ) {
- qWarning("sorted! %d cat", cat);
OTodoXMLVector vector(m_events.count(), asc,sortOrder );
@@ -717,5 +776,8 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
/* show category */
- if ( bCat && cat != 0)
+ /* -1 == unfiled */
+ if ( bCat && cat == -1 ) {
+ if(!(*it).categories().isEmpty() )
+ continue;
+ }else if ( bCat && cat != 0)
if (!(*it).categories().contains( cat ) ) {
- qWarning("category mis match");
continue;
@@ -729,3 +791,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
if ( !(*it).isOverdue() && bOnly ) {
- qWarning("item is not overdue but bOnly checked");
continue;
@@ -734,3 +795,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
if ((*it).isCompleted() && comp ) {
- qWarning("completed continue!");
continue;
@@ -744,3 +804,2 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
}
- qWarning("XXX %d Items added", item);
vector.resize( item );