-rw-r--r-- | libopie/libopie.pro | 2 | ||||
-rw-r--r-- | libopie/pim/opimmaintainer.cpp | 37 | ||||
-rw-r--r-- | libopie/pim/opimmaintainer.h | 36 | ||||
-rw-r--r-- | libopie/pim/opimxrefmanager.cpp | 2 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 20 | ||||
-rw-r--r-- | libopie/pim/otodo.h | 12 |
6 files changed, 108 insertions, 1 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 3e6156e..a80a407 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro @@ -22,24 +22,25 @@ HEADERS = ofontmenu.h \ pim/ocontactaccess.h \ pim/ocontactaccessbackend.h \ pim/ocontactaccessbackend_xml.h \ pim/ocontactaccessbackend_vcard.h \ pim/obackendfactory.h \ pim/opimcache.h \ pim/otodoaccessvcal.h \ pim/orecur.h \ pim/opimstate.h \ pim/opimxrefpartner.h \ pim/opimxref.h \ pim/opimxrefmanager.h \ + pim/opimmaintainer.h \ orecurrancewidget.h \ oticker.h # pim/otodoaccesssql.h \ SOURCES = ofontmenu.cc \ ocolorbutton.cpp \ xmltree.cc \ ofiledialog.cc ofileselector.cc \ ocheckitem.cpp tododb.cpp todoevent.cpp \ todovcalresource.cpp colordialog.cpp \ colorpopupmenu.cpp oclickablelabel.cpp \ oprocctrl.cpp oprocess.cpp \ @@ -51,24 +52,25 @@ SOURCES = ofontmenu.cc \ pim/otodoaccess.cpp \ pim/otodoaccessbackend.cpp \ pim/otodoaccessxml.cpp \ pim/ocontact.cpp \ pim/ocontactaccess.cpp \ pim/ocontactaccessbackend_vcard.cpp \ pim/otodoaccessvcal.cpp \ pim/orecur.cpp \ pim/opimstate.cpp \ pim/opimxrefpartner.cpp \ pim/opimxref.cpp \ pim/opimxrefmanager.cpp \ + pim/opimmaintainer.cpp \ orecurrancewidget.cpp \ oticker.cpp # pim/otodoaccesssql.cpp \ TARGET = opie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(QTDIR)/lib$(PROJMAK) #VERSION = 1.0.0 # LIBS += -lopiesql INTERFACES = otimepickerbase.ui orecurrancebase.ui 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 <qstring.h> + +/** + * 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 @@ -1,20 +1,22 @@ #include "opimxrefmanager.h" 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; } bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { // if ( m_list == ref.m_list ) return true; return false; } void OPimXRefManager::add( const OPimXRef& ref) { m_list.append( ref ); } 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 @@ -5,43 +5,46 @@ #include <qpe/palmtopuidgen.h> #include <qpe/stringutil.h> #include <qpe/palmtoprecord.h> #include <qpe/stringutil.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> #include "opimstate.h" #include "orecur.h" +#include "opimmaintainer.h" + #include "otodo.h" struct OTodo::OTodoData : public QShared { OTodoData() : QShared() { }; QDate date; bool isCompleted:1; bool hasDate:1; int priority; QString desc; QString sum; QMap<QString, QString> extra; ushort prog; bool hasAlarmDateTime :1; QDateTime alarmDateTime; OPimState state; ORecur recur; + OPimMaintainer maintainer; }; OTodo::OTodo(const OTodo &event ) : OPimRecord( event ), data( event.data ) { data->ref(); // qWarning("ref up"); } OTodo::~OTodo() { // qWarning("~OTodo " ); if ( data->deref() ) { @@ -144,24 +147,27 @@ QDateTime OTodo::alarmDateTime() const } QString OTodo::description()const { return data->desc; } OPimState OTodo::state()const { return data->state; } ORecur OTodo::recurrence()const { return data->recur; } +OPimMaintainer OTodo::maintainer()const { + return data->maintainer; +} void OTodo::setCompleted( bool completed ) { changeOrModify(); data->isCompleted = completed; } void OTodo::setHasDueDate( bool hasDate ) { changeOrModify(); data->hasDate = hasDate; } void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) { @@ -193,24 +199,28 @@ void OTodo::setAlarmDateTime( const QDateTime& alarm ) { changeOrModify(); data->alarmDateTime = alarm; } void OTodo::setState( const OPimState& state ) { changeOrModify(); data->state = state; } 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) return QDate::currentDate() > data->date; return false; } void OTodo::setProgress(ushort progress ) { changeOrModify(); data->prog = progress; } QString OTodo::toShortText() const { @@ -312,24 +322,26 @@ bool OTodo::operator==(const OTodo &toDoEvent )const { if ( data->priority != toDoEvent.data->priority ) return false; if ( data->priority != toDoEvent.data->prog ) return false; if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; if ( data->hasDate != toDoEvent.data->hasDate ) return false; if ( data->date != toDoEvent.data->date ) return false; if ( data->sum != toDoEvent.data->sum ) return false; if ( data->desc != toDoEvent.data->desc ) return false; if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) return false; if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) return false; + if ( data->maintainer != toDoEvent.data->maintainer ) + return false; return OPimRecord::operator==( toDoEvent ); } void OTodo::deref() { // qWarning("deref in ToDoEvent"); if ( data->deref() ) { // qWarning("deleting"); delete data; data= 0; } } @@ -349,57 +361,63 @@ QMap<int, QString> OTodo::toMap() const { map.insert( Uid, QString::number( uid() ) ); map.insert( Category, idsToString( categories() ) ); map.insert( HasDate, QString::number( data->hasDate ) ); map.insert( Completed, QString::number( data->isCompleted ) ); map.insert( Description, data->desc ); map.insert( Summary, data->sum ); map.insert( Priority, QString::number( data->priority ) ); map.insert( DateDay, QString::number( data->date.day() ) ); 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() ); return map; } QMap<QString, QString> OTodo::toExtraMap()const { return data->extra; } /** * change or modify looks at the ref count and either * creates a new QShared Object or it can modify it * right in place */ void OTodo::changeOrModify() { if ( data->count != 1 ) { qWarning("changeOrModify"); data->deref(); OTodoData* d2 = new OTodoData(); copy(data, d2 ); 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; dest->hasDate = src->hasDate; dest->priority = src->priority; dest->desc = src->desc; dest->sum = src->sum; dest->extra = src->extra; dest->prog = src->prog; dest->hasAlarmDateTime = src->hasAlarmDateTime; dest->alarmDateTime = src->alarmDateTime; dest->state = src->state; dest->recur = src->recur; + dest->maintainer = src->maintainer; } QString OTodo::type() const { return QString::fromLatin1("OTodo"); } QString OTodo::recordField(int /*id*/ )const { return QString::null; } 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 @@ -9,24 +9,25 @@ #include <qstringlist.h> #include <qdatetime.h> #include <qvaluelist.h> #include <qpe/recordfields.h> #include <qpe/palmtopuidgen.h> #include <opie/opimrecord.h> class OPimState; class ORecur; +class OPimMaintainer; class OTodo : public OPimRecord { public: typedef QValueList<OTodo> ValueList; enum RecordFields { Uid = Qtopia::UID_ID, Category = Qtopia::CATEGORY_ID, HasDate, Completed, Description, Summary, Priority, DateDay, @@ -119,24 +120,29 @@ public: /** * What is the state of this OTodo? */ OPimState state()const; /** * the recurrance of this */ ORecur recurrence()const; /** + * the Maintainer of this OTodo + */ + OPimMaintainer maintainer()const; + + /** * The description of the todo */ QString description()const; /** * A small summary of the todo */ QString summary() const; /** * @reimplemented * Return this todoevent in a RichText formatted QString @@ -193,24 +199,30 @@ public: * set the alarm time */ void setAlarmDateTime ( const QDateTime& alarm ); void setDescription(const QString& ); void setSummary(const QString& ); /** * set the state of a Todo * @param state State what the todo should take */ void setState( const OPimState& state); + + /** + * set the Maintainer Mode + */ + void setMaintainer( const OPimMaintainer& ); + bool isOverdue(); bool match( const QRegExp &r )const; bool operator<(const OTodo &toDoEvent )const; bool operator<=(const OTodo &toDoEvent )const; bool operator!=(const OTodo &toDoEvent )const; bool operator>(const OTodo &toDoEvent )const; bool operator>=(const OTodo &toDoEvent)const; bool operator==(const OTodo &toDoEvent )const; OTodo &operator=(const OTodo &toDoEvent ); |