From a1306f7603ab9a05f7d0059fad60b68f01a0ae71 Mon Sep 17 00:00:00 2001 From: zecke Date: Fri, 15 Nov 2002 21:43:59 +0000 Subject: Make OTodo compile add the MaintainerMode to OTodo --- (limited to 'libopie/pim') diff --git a/libopie/pim/opimmaintainer.cpp b/libopie/pim/opimmaintainer.cpp new file mode 100644 index 0000000..e34f035 --- a/dev/null +++ b/libopie/pim/opimmaintainer.cpp @@ -0,0 +1,37 @@ +#include "opimmaintainer.h" + +OPimMaintainer::OPimMaintainer( enum Mode mode, int uid ) + : m_mode(mode), m_uid(uid ) +{} +OPimMaintainer::~OPimMaintainer() { +} +OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { + *this = main; +} +OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) { + m_mode = main.m_mode; + m_uid = main.m_uid; + + return *this; +} +bool OPimMaintainer::operator==( const OPimMaintainer& main ) { + if (m_mode != main.m_mode ) return false; + if (m_uid != main.m_uid ) return false; + + return true; +} +bool OPimMaintainer::operator!=( const OPimMaintainer& main ) { + return !(*this == main ); +} +OPimMaintainer::Mode OPimMaintainer::mode()const { + return m_mode; +} +int OPimMaintainer::uid()const { + return m_uid; +} +void OPimMaintainer::setMode( enum Mode mo) { + m_mode = mo; +} +void OPimMaintainer::setUid( int uid ) { + m_uid = uid; +} diff --git a/libopie/pim/opimmaintainer.h b/libopie/pim/opimmaintainer.h new file mode 100644 index 0000000..310e15a --- a/dev/null +++ b/libopie/pim/opimmaintainer.h @@ -0,0 +1,36 @@ +#ifndef OPIE_PIM_MAINTAINER_H +#define OPIE_PIM_MAINTAINER_H + +#include + +/** + * Who maintains what? + */ +class OPimMaintainer { +public: + enum Mode { Undefined = -1, + Responsible = 0, + DoneBy, + Coordinating }; + OPimMaintainer( enum Mode mode = Undefined, int uid = 0); + OPimMaintainer( const OPimMaintainer& ); + ~OPimMaintainer(); + + OPimMaintainer &operator=( const OPimMaintainer& ); + bool operator==( const OPimMaintainer& ); + bool operator!=( const OPimMaintainer& ); + + + Mode mode()const; + int uid()const; + + void setMode( enum Mode ); + void setUid( int uid ); + +private: + Mode m_mode; + int m_uid; + +}; + +#endif diff --git a/libopie/pim/opimxrefmanager.cpp b/libopie/pim/opimxrefmanager.cpp index d49f5f5..965f542 100644 --- a/libopie/pim/opimxrefmanager.cpp +++ b/libopie/pim/opimxrefmanager.cpp @@ -6,6 +6,8 @@ OPimXRefManager::OPimXRefManager() { OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { m_list = ref.m_list; } +OPimXRefManager::~OPimXRefManager() { +} OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { m_list = ref.m_list; return *this; diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 4d5cb79..6fcf9f6 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp @@ -14,6 +14,8 @@ #include "opimstate.h" #include "orecur.h" +#include "opimmaintainer.h" + #include "otodo.h" @@ -33,6 +35,7 @@ struct OTodo::OTodoData : public QShared { QDateTime alarmDateTime; OPimState state; ORecur recur; + OPimMaintainer maintainer; }; OTodo::OTodo(const OTodo &event ) @@ -153,6 +156,9 @@ OPimState OTodo::state()const { ORecur OTodo::recurrence()const { return data->recur; } +OPimMaintainer OTodo::maintainer()const { + return data->maintainer; +} void OTodo::setCompleted( bool completed ) { changeOrModify(); @@ -202,6 +208,10 @@ void OTodo::setRecurrence( const ORecur& rec) { changeOrModify(); data->recur = rec; } +void OTodo::setMaintainer( const OPimMaintainer& pim ) { + changeOrModify(); + data->maintainer = pim; +} bool OTodo::isOverdue( ) { if( data->hasDate && !data->isCompleted) @@ -321,6 +331,8 @@ bool OTodo::operator==(const OTodo &toDoEvent )const return false; if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) return false; + if ( data->maintainer != toDoEvent.data->maintainer ) + return false; return OPimRecord::operator==( toDoEvent ); } @@ -358,7 +370,7 @@ QMap OTodo::toMap() const { map.insert( DateMonth, QString::number( data->date.month() ) ); map.insert( DateYear, QString::number( data->date.year() ) ); map.insert( Progress, QString::number( data->prog ) ); - map.insert( CrossReference, crossToString() ); +// map.insert( CrossReference, crossToString() ); map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); map.insert( AlarmDateTime, data->alarmDateTime.toString() ); @@ -382,6 +394,11 @@ void OTodo::changeOrModify() { data = d2; } } +// WATCHOUT +/* + * if you add something to the Data struct + * be sure to copy it here + */ void OTodo::copy( OTodoData* src, OTodoData* dest ) { dest->date = src->date; dest->isCompleted = src->isCompleted; @@ -395,6 +412,7 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { dest->alarmDateTime = src->alarmDateTime; dest->state = src->state; dest->recur = src->recur; + dest->maintainer = src->maintainer; } QString OTodo::type() const { return QString::fromLatin1("OTodo"); diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h index 2cdc587..70b0253 100644 --- a/libopie/pim/otodo.h +++ b/libopie/pim/otodo.h @@ -18,6 +18,7 @@ class OPimState; class ORecur; +class OPimMaintainer; class OTodo : public OPimRecord { public: typedef QValueList ValueList; @@ -128,6 +129,11 @@ public: ORecur recurrence()const; /** + * the Maintainer of this OTodo + */ + OPimMaintainer maintainer()const; + + /** * The description of the todo */ QString description()const; @@ -202,6 +208,12 @@ public: * @param state State what the todo should take */ void setState( const OPimState& state); + + /** + * set the Maintainer Mode + */ + void setMaintainer( const OPimMaintainer& ); + bool isOverdue(); -- cgit v0.9.0.2