summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimtodo.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimtodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimtodo.cpp127
1 files changed, 112 insertions, 15 deletions
diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp
index 27b36a6..16ca987 100644
--- a/libopie2/opiepim/core/opimtodo.cpp
+++ b/libopie2/opiepim/core/opimtodo.cpp
@@ -66,2 +66,3 @@ struct OPimTodo::OPimTodoData : public QShared
66 delete notifiers; 66 delete notifiers;
67 delete state;
67 } 68 }
@@ -89,3 +90,2 @@ OPimTodo::OPimTodo( const OPimTodo &event )
89 data->ref(); 90 data->ref();
90 // owarn << "ref up" << oendl;
91} 91}
@@ -96,6 +96,4 @@ OPimTodo::~OPimTodo()
96 96
97 // owarn << "~OPimTodo " << oendl;
98 if ( data->deref() ) 97 if ( data->deref() )
99 { 98 {
100 // owarn << "OPimTodo::dereffing" << oendl;
101 delete data; 99 delete data;
@@ -114,3 +112,2 @@ OPimTodo::OPimTodo( bool completed, int priority,
114{ 112{
115 // owarn << "OPimTodoData " + summary << oendl;
116 setCategories( category ); 113 setCategories( category );
@@ -137,3 +134,2 @@ OPimTodo::OPimTodo( bool completed, int priority,
137{ 134{
138 // owarn << "OPimTodoData" + summary << oendl;
139 setCategories( idsFromString( category.join( ";" ) ) ); 135 setCategories( idsFromString( category.join( ";" ) ) );
@@ -189,3 +185,14 @@ bool OPimTodo::hasDueDate() const
189 185
190 186/**
187 * \brief Does this Todo have a start date
188 *
189 * Does this Todo have a start date. The decision
190 * is based on if the internal startDate isValid
191 * in the sense of QDate::isValid.
192 *
193 * @return True if the startDate isValid
194 * @see startDate
195 * @see setStartDate
196 * @see QDate::isValid()
197 */
191bool OPimTodo::hasStartDate() const 198bool OPimTodo::hasStartDate() const
@@ -195,3 +202,12 @@ bool OPimTodo::hasStartDate() const
195 202
196 203/**
204 * \brief Does this Todo have a Date when it was completed
205 *
206 * As in \sa hasStartDate() it is determined if there
207 * is a completed date by looking if the internal date
208 * isValid \sa QDate::isValid.
209 *
210 * @see hasStartDate
211 * @return True if the completedDate is set and valid.
212 */
197bool OPimTodo::hasCompletedDate() const 213bool OPimTodo::hasCompletedDate() const
@@ -310,3 +326,2 @@ void OPimTodo::setDescription( const QString &desc )
310{ 326{
311 // owarn << "desc " + desc << oendl;
312 changeOrModify(); 327 changeOrModify();
@@ -382,3 +397,3 @@ void OPimTodo::setMaintainer( const OPimMaintainer& pim )
382 397
383bool OPimTodo::isOverdue( ) 398bool OPimTodo::isOverdue( )const
384{ 399{
@@ -595,6 +610,4 @@ void OPimTodo::deref()
595 610
596 // owarn << "deref in ToDoEvent" << oendl;
597 if ( data->deref() ) 611 if ( data->deref() )
598 { 612 {
599 // owarn << "deleting" << oendl;
600 delete data; 613 delete data;
@@ -610,3 +623,2 @@ OPimTodo &OPimTodo::operator=( const OPimTodo &item )
610 OPimRecord::operator=( item ); 623 OPimRecord::operator=( item );
611 //owarn << "operator= ref " << oendl;
612 item.data->ref(); 624 item.data->ref();
@@ -653,3 +665,2 @@ void OPimTodo::changeOrModify()
653 { 665 {
654 owarn << "changeOrModify" << oendl;
655 data->deref(); 666 data->deref();
@@ -701,5 +712,74 @@ QString OPimTodo::type() const
701 712
702QString OPimTodo::recordField( int /*id*/ ) const 713QString OPimTodo::recordField( int id) const
703{ 714{
704 return QString::null; 715 QString res;
716 Q_UNUSED( id )
717#if 0
718 switch( id ) {
719 case HasDate:
720 res = (hasDueDate() ?
721 QObject::tr( "Has a due-date" )
722 : QObject::tr( "No due-date" ));
723 break;
724 case Completed:
725 res = ( isCompleted() ?
726 QObject::tr( "Completed" ) :
727 QObject::tr( "Not completed" ));
728 break;
729 case Description:
730 res = description();
731 break;
732 case Summary:
733 res = summary();
734 break;
735 case Priority:
736 res = QString::number( priority() );
737 break;
738 case DateDay:
739 res = QString::number( dueDate().day() );
740 break;
741 case DateMonth:
742 res = QString::number( dueDate().month() );
743 break;
744 case DateYear:
745 res = QString::number( dueDate().year() );
746 break;
747 case Progress:
748 res = QString::number( progress() );
749 break;
750 case State:
751 res = QString::number( state().state() );
752 break;
753 case Recurrence:
754 res = ( hasRecurrence() ?
755 QString::null /*recurrence().summary()*/ :
756 QObject::tr("No reccurrence"));
757 break;
758 case Alarms:
759 break;
760 case Reminders:
761 break;
762 case Maintainer:
763 break;
764 case StartDate:
765 res = ( hasStartDate() ?
766 /*TimeString::()*/ QString::null :
767 QObject::tr( "No start-date" ) );
768 break;
769 case CompletedDate:
770 res = ( hasCompletedDate() ?
771 /*TimeString::()*/ QString::null :
772 QObject::tr( "No completed-date" ) );
773 break;
774 case DueDate:
775 res = ( hasDueDate() ?
776 /*TimeString::()*/ QString::null :
777 QObject::tr( "No due-date" );
778 break;
779 default:
780 res = OPimRecord::recordField( id );
781 }
782
783#endif
784 return res;
705} 785}
@@ -712,2 +792,19 @@ int OPimTodo::rtti() const
712 792
793/**
794 * \brief Provide a SafeCast to OPimTodo from a OPimRecord
795 *
796 * Provide a safe cast that will return 0 if the record
797 * type is not OPimTodo. In the other case it will
798 * be casted to OPimTodo and returned
799 *
800 * @param rec The OPimRecord to be casted
801 *
802 * @return a pointer to OPimTodo or 0l
803 */
804OPimTodo* OPimTodo::safeCast( const OPimRecord* rec ) {
805 return (rec && rec->rtti() == OPimResolver::TodoList ) ?
806 static_cast<OPimTodo*>( const_cast<OPimRecord*>(rec) ) :
807 0l;
808}
809
713} 810}