summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-12 13:20:21 (UTC)
committer zecke <zecke>2003-05-12 13:20:21 (UTC)
commita4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d (patch) (unidiff)
treeaee89fa76cc9e71a67d8ae9462b567e3f91f284f
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 (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccessxml.cpp71
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp71
2 files changed, 130 insertions, 12 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
@@ -18,6 +18,7 @@
18#include "oconversion.h" 18#include "oconversion.h"
19#include "opimstate.h" 19#include "opimstate.h"
20#include "otimezone.h" 20#include "otimezone.h"
21#include "opimnotifymanager.h"
21#include "orecur.h" 22#include "orecur.h"
22#include "otodoaccessxml.h" 23#include "otodoaccessxml.h"
23 24
@@ -426,6 +427,27 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
426 case OTodo::State: 427 case OTodo::State:
427 ev.setState( val.toInt() ); 428 ev.setState( val.toInt() );
428 break; 429 break;
430 case OTodo::Alarms:{
431 OPimNotifyManager &manager = ev.notifiers();
432 QStringList als = QStringList::split(";", val );
433 for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
434 QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
435 qWarning("alarm: %s", alarm.join("___").latin1() );
436 qWarning("alarm[0]: %s %s", alarm[0].latin1(), OConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
437 OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
438 manager.add( al );
439 }
440 }
441 break;
442 case OTodo::Reminders:{
443 OPimNotifyManager &manager = ev.notifiers();
444 QStringList rems = QStringList::split(";", val );
445 for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
446 OPimReminder rem( (*it).toInt() );
447 manager.add( rem );
448 }
449 }
450 break;
429 case OTodo::CrossReference: 451 case OTodo::CrossReference:
430 { 452 {
431 /* 453 /*
@@ -522,6 +544,44 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
522 if ( ev.hasState() ) 544 if ( ev.hasState() )
523 str += "State=\""+QString::number( ev.state().state() )+"\" "; 545 str += "State=\""+QString::number( ev.state().state() )+"\" ";
524 546
547 /*
548 * save reminders and notifiers!
549 * DATE_TIME:DURATION:SOUND:NOT_USED_YET;OTHER_DATE_TIME:OTHER:DURATION:SOUND:....
550 */
551 if ( ev.hasNotifiers() ) {
552 OPimNotifyManager manager = ev.notifiers();
553 OPimNotifyManager::Alarms alarms = manager.alarms();
554 if (!alarms.isEmpty() ) {
555 QStringList als;
556 OPimNotifyManager::Alarms::Iterator it = alarms.begin();
557 for ( ; it != alarms.end(); ++it ) {
558 /* only if time is valid */
559 if ( (*it).dateTime().isValid() ) {
560 als << OConversion::dateTimeToString( (*it).dateTime() )
561 + ":" + QString::number( (*it).duration() )
562 + ":" + QString::number( (*it).sound() )
563 + ":";
564 }
565 }
566 // now write the list
567 qWarning("als: %s", als.join("____________").latin1() );
568 str += "Alarms=\""+als.join(";") +"\" ";
569 }
570
571 /*
572 * now the same for reminders but more easy. We just save the uid of the OEvent.
573 */
574 OPimNotifyManager::Reminders reminders = manager.reminders();
575 if (!reminders.isEmpty() ) {
576 OPimNotifyManager::Reminders::Iterator it = reminders.begin();
577 QStringList records;
578 for ( ; it != reminders.end(); ++it ) {
579 records << QString::number( (*it).recordUid() );
580 }
581 str += "Reminders=\""+ records.join(";") +"\" ";
582 }
583 }
584
525 585
526 return str; 586 return str;
527} 587}
@@ -704,7 +764,6 @@ public:
704 764
705QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, 765QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
706 int sortFilter, int cat ) { 766 int sortFilter, int cat ) {
707 qWarning("sorted! %d cat", cat);
708 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 767 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
709 QMap<int, OTodo>::Iterator it; 768 QMap<int, OTodo>::Iterator it;
710 int item = 0; 769 int item = 0;
@@ -715,9 +774,12 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
715 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 774 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
716 775
717 /* show category */ 776 /* show category */
718 if ( bCat && cat != 0) 777 /* -1 == unfiled */
778 if ( bCat && cat == -1 ) {
779 if(!(*it).categories().isEmpty() )
780 continue;
781 }else if ( bCat && cat != 0)
719 if (!(*it).categories().contains( cat ) ) { 782 if (!(*it).categories().contains( cat ) ) {
720 qWarning("category mis match");
721 continue; 783 continue;
722 } 784 }
723 /* isOverdue but we should not show overdue - why?*/ 785 /* isOverdue but we should not show overdue - why?*/
@@ -727,12 +789,10 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
727 } 789 }
728*/ 790*/
729 if ( !(*it).isOverdue() && bOnly ) { 791 if ( !(*it).isOverdue() && bOnly ) {
730 qWarning("item is not overdue but bOnly checked");
731 continue; 792 continue;
732 } 793 }
733 794
734 if ((*it).isCompleted() && comp ) { 795 if ((*it).isCompleted() && comp ) {
735 qWarning("completed continue!");
736 continue; 796 continue;
737 } 797 }
738 798
@@ -742,7 +802,6 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
742 vector.insert(item, con ); 802 vector.insert(item, con );
743 item++; 803 item++;
744 } 804 }
745 qWarning("XXX %d Items added", item);
746 vector.resize( item ); 805 vector.resize( item );
747 /* sort it now */ 806 /* sort it now */
748 vector.sort(); 807 vector.sort();
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 69b7ab4..2b62f0d 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -18,6 +18,7 @@
18#include "oconversion.h" 18#include "oconversion.h"
19#include "opimstate.h" 19#include "opimstate.h"
20#include "otimezone.h" 20#include "otimezone.h"
21#include "opimnotifymanager.h"
21#include "orecur.h" 22#include "orecur.h"
22#include "otodoaccessxml.h" 23#include "otodoaccessxml.h"
23 24
@@ -426,6 +427,27 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
426 case OTodo::State: 427 case OTodo::State:
427 ev.setState( val.toInt() ); 428 ev.setState( val.toInt() );
428 break; 429 break;
430 case OTodo::Alarms:{
431 OPimNotifyManager &manager = ev.notifiers();
432 QStringList als = QStringList::split(";", val );
433 for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
434 QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
435 qWarning("alarm: %s", alarm.join("___").latin1() );
436 qWarning("alarm[0]: %s %s", alarm[0].latin1(), OConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
437 OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
438 manager.add( al );
439 }
440 }
441 break;
442 case OTodo::Reminders:{
443 OPimNotifyManager &manager = ev.notifiers();
444 QStringList rems = QStringList::split(";", val );
445 for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
446 OPimReminder rem( (*it).toInt() );
447 manager.add( rem );
448 }
449 }
450 break;
429 case OTodo::CrossReference: 451 case OTodo::CrossReference:
430 { 452 {
431 /* 453 /*
@@ -522,6 +544,44 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
522 if ( ev.hasState() ) 544 if ( ev.hasState() )
523 str += "State=\""+QString::number( ev.state().state() )+"\" "; 545 str += "State=\""+QString::number( ev.state().state() )+"\" ";
524 546
547 /*
548 * save reminders and notifiers!
549 * DATE_TIME:DURATION:SOUND:NOT_USED_YET;OTHER_DATE_TIME:OTHER:DURATION:SOUND:....
550 */
551 if ( ev.hasNotifiers() ) {
552 OPimNotifyManager manager = ev.notifiers();
553 OPimNotifyManager::Alarms alarms = manager.alarms();
554 if (!alarms.isEmpty() ) {
555 QStringList als;
556 OPimNotifyManager::Alarms::Iterator it = alarms.begin();
557 for ( ; it != alarms.end(); ++it ) {
558 /* only if time is valid */
559 if ( (*it).dateTime().isValid() ) {
560 als << OConversion::dateTimeToString( (*it).dateTime() )
561 + ":" + QString::number( (*it).duration() )
562 + ":" + QString::number( (*it).sound() )
563 + ":";
564 }
565 }
566 // now write the list
567 qWarning("als: %s", als.join("____________").latin1() );
568 str += "Alarms=\""+als.join(";") +"\" ";
569 }
570
571 /*
572 * now the same for reminders but more easy. We just save the uid of the OEvent.
573 */
574 OPimNotifyManager::Reminders reminders = manager.reminders();
575 if (!reminders.isEmpty() ) {
576 OPimNotifyManager::Reminders::Iterator it = reminders.begin();
577 QStringList records;
578 for ( ; it != reminders.end(); ++it ) {
579 records << QString::number( (*it).recordUid() );
580 }
581 str += "Reminders=\""+ records.join(";") +"\" ";
582 }
583 }
584
525 585
526 return str; 586 return str;
527} 587}
@@ -704,7 +764,6 @@ public:
704 764
705QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, 765QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
706 int sortFilter, int cat ) { 766 int sortFilter, int cat ) {
707 qWarning("sorted! %d cat", cat);
708 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 767 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
709 QMap<int, OTodo>::Iterator it; 768 QMap<int, OTodo>::Iterator it;
710 int item = 0; 769 int item = 0;
@@ -715,9 +774,12 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
715 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 774 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
716 775
717 /* show category */ 776 /* show category */
718 if ( bCat && cat != 0) 777 /* -1 == unfiled */
778 if ( bCat && cat == -1 ) {
779 if(!(*it).categories().isEmpty() )
780 continue;
781 }else if ( bCat && cat != 0)
719 if (!(*it).categories().contains( cat ) ) { 782 if (!(*it).categories().contains( cat ) ) {
720 qWarning("category mis match");
721 continue; 783 continue;
722 } 784 }
723 /* isOverdue but we should not show overdue - why?*/ 785 /* isOverdue but we should not show overdue - why?*/
@@ -727,12 +789,10 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
727 } 789 }
728*/ 790*/
729 if ( !(*it).isOverdue() && bOnly ) { 791 if ( !(*it).isOverdue() && bOnly ) {
730 qWarning("item is not overdue but bOnly checked");
731 continue; 792 continue;
732 } 793 }
733 794
734 if ((*it).isCompleted() && comp ) { 795 if ((*it).isCompleted() && comp ) {
735 qWarning("completed continue!");
736 continue; 796 continue;
737 } 797 }
738 798
@@ -742,7 +802,6 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
742 vector.insert(item, con ); 802 vector.insert(item, con );
743 item++; 803 item++;
744 } 804 }
745 qWarning("XXX %d Items added", item);
746 vector.resize( item ); 805 vector.resize( item );
747 /* sort it now */ 806 /* sort it now */
748 vector.sort(); 807 vector.sort();