author | mickeyl <mickeyl> | 2004-02-21 12:25:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-21 12:25:50 (UTC) |
commit | 6155f1be5c19fc51a4929c9e173f9e5a24d193e6 (patch) (side-by-side diff) | |
tree | c18ca863f82a559c60728f922519ac696387ec53 /libopie2/opiepim/core/orecur.cpp | |
parent | a570c2824fcecaf1c278e1b5a592fa14cc0647f8 (diff) | |
download | opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.zip opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.tar.gz opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.tar.bz2 |
the usual cosmetics
Diffstat (limited to 'libopie2/opiepim/core/orecur.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/orecur.cpp | 76 |
1 files changed, 71 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp index 033f264..5e2da25 100644 --- a/libopie2/opiepim/core/orecur.cpp +++ b/libopie2/opiepim/core/orecur.cpp @@ -27,16 +27,20 @@ Boston, MA 02111-1307, USA. */ -#include <time.h> +#include "orecur.h" -#include <qshared.h> +/* OPIE */ +#include <opie2/otimezone.h> +#include <qpe/timeconversion.h> -#include <qtopia/timeconversion.h> +/* QT */ +#include <qshared.h> -#include <opie2/otimezone.h> -#include <opie2/orecur.h> +/* STD */ +#include <time.h> namespace Opie { + struct ORecur::Data : public QShared { Data() : QShared() { type = ORecur::NoRepeat; @@ -77,21 +81,29 @@ ORecur::ORecur( const ORecur& rec) { data->ref(); } + + ORecur::~ORecur() { if ( data->deref() ) { delete data; data = 0l; } } + + void ORecur::deref() { if ( data->deref() ) { delete data; data = 0l; } } + + bool ORecur::operator==( const ORecur& )const { return false; } + + ORecur &ORecur::operator=( const ORecur& re) { if ( *this == re ) return *this; @@ -101,9 +113,13 @@ ORecur &ORecur::operator=( const ORecur& re) { return *this; } + + bool ORecur::doesRecur()const { return !( type() == NoRepeat ); } + + /* * we try to be smart here * @@ -118,6 +134,8 @@ bool ORecur::doesRecur( const QDate& date ) { return (recur == date); } + + // FIXME unuglify! // GPL from Datebookdb.cpp // FIXME exception list! @@ -129,6 +147,8 @@ bool ORecur::nextOcurrence( const QDate& from, QDate& next ) { return stillLooking; } + + bool ORecur::p_nextOccurrence( const QDate& from, QDate& next ) { // easy checks, first are we too far in the future or too far in the past? @@ -401,79 +421,123 @@ bool ORecur::p_nextOccurrence( const QDate& from, QDate& next ) { return FALSE; } } + + ORecur::RepeatType ORecur::type()const{ return data->type; } + + int ORecur::frequency()const { return data->freq; } + + int ORecur::position()const { return data->pos; } + + char ORecur::days() const{ return data->days; } + + bool ORecur::hasEndDate()const { return data->hasEnd; } + + QDate ORecur::endDate()const { return data->end; } + + QDate ORecur::start()const{ return data->start; } + + QDateTime ORecur::createdDateTime()const { return data->create; } + + int ORecur::repetition()const { return data->rep; } + + QString ORecur::service()const { return data->app; } + + ORecur::ExceptionList& ORecur::exceptions() { return data->list; } + + void ORecur::setType( const RepeatType& z) { checkOrModify(); data->type = z; } + + void ORecur::setFrequency( int freq ) { checkOrModify(); data->freq = freq; } + + void ORecur::setPosition( int pos ) { checkOrModify(); data->pos = pos; } + + void ORecur::setDays( char c ) { checkOrModify(); data->days = c; } + + void ORecur::setEndDate( const QDate& dt) { checkOrModify(); data->end = dt; } + + void ORecur::setCreatedDateTime( const QDateTime& t) { checkOrModify(); data->create = t; } + + void ORecur::setHasEndDate( bool b) { checkOrModify(); data->hasEnd = b; } + + void ORecur::setRepitition( int rep ) { checkOrModify(); data->rep = rep; } + + void ORecur::setService( const QString& app ) { checkOrModify(); data->app = app; } + + void ORecur::setStart( const QDate& dt ) { checkOrModify(); data->start = dt; } + + void ORecur::checkOrModify() { if ( data->count != 1 ) { data->deref(); @@ -492,6 +556,8 @@ void ORecur::checkOrModify() { data = d2; } } + + QString ORecur::toString()const { QString buf; QMap<int, QString> recMap = toMap(); |