author | mickeyl <mickeyl> | 2004-02-23 13:15:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-23 13:15:42 (UTC) |
commit | f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf (patch) (side-by-side diff) | |
tree | 4044006e676c78370fdeccf960ea4214f13eabd2 /libopie2/opiepim/core/opimnotify.cpp | |
parent | 2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb (diff) | |
download | opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.zip opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.gz opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.bz2 |
cosmetics
Diffstat (limited to 'libopie2/opiepim/core/opimnotify.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimnotify.cpp | 251 |
1 files changed, 186 insertions, 65 deletions
diff --git a/libopie2/opiepim/core/opimnotify.cpp b/libopie2/opiepim/core/opimnotify.cpp index c61f9da..43858f0 100644 --- a/libopie2/opiepim/core/opimnotify.cpp +++ b/libopie2/opiepim/core/opimnotify.cpp @@ -28,11 +28,15 @@ */ -#include <qshared.h> -#include <opie2/opimnotify.h> +#include "opimnotify.h" -namespace Opie { +/* QT */ +#include <qshared.h> -struct OPimNotify::Data : public QShared { - Data() : QShared(),dur(-1),parent(0) { +namespace Opie +{ +struct OPimNotify::Data : public QShared +{ + Data() : QShared(), dur( -1 ), parent( 0 ) + { } @@ -44,3 +48,4 @@ struct OPimNotify::Data : public QShared { -OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { +OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) +{ data = new Data; @@ -50,4 +55,6 @@ OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { } -OPimNotify::OPimNotify( const OPimNotify& noti) - : data( noti.data ) + + +OPimNotify::OPimNotify( const OPimNotify& noti ) + : data( noti.data ) { @@ -55,4 +62,8 @@ OPimNotify::OPimNotify( const OPimNotify& noti) } -OPimNotify::~OPimNotify() { - if ( data->deref() ) { + + +OPimNotify::~OPimNotify() +{ + if ( data->deref() ) + { delete data; @@ -62,3 +73,5 @@ OPimNotify::~OPimNotify() { -OPimNotify &OPimNotify::operator=( const OPimNotify& noti) { + +OPimNotify &OPimNotify::operator=( const OPimNotify& noti ) +{ noti.data->ref(); @@ -69,3 +82,6 @@ OPimNotify &OPimNotify::operator=( const OPimNotify& noti) { } -bool OPimNotify::operator==( const OPimNotify& noti ) { + + +bool OPimNotify::operator==( const OPimNotify& noti ) +{ if ( data == noti.data ) return true; @@ -78,18 +94,36 @@ bool OPimNotify::operator==( const OPimNotify& noti ) { } -QDateTime OPimNotify::dateTime()const { + + +QDateTime OPimNotify::dateTime() const +{ return data->start; } -QString OPimNotify::service()const { + + +QString OPimNotify::service() const +{ return data->application; } -int OPimNotify::parent()const { + + +int OPimNotify::parent() const +{ return data->parent; } -int OPimNotify::duration()const { + + +int OPimNotify::duration() const +{ return data->dur; } -QDateTime OPimNotify::endTime()const { - return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) ); + + +QDateTime OPimNotify::endTime() const +{ + return QDateTime( data->start.date(), data->start.time().addSecs( data->dur ) ); } -void OPimNotify::setDateTime( const QDateTime& time ) { + + +void OPimNotify::setDateTime( const QDateTime& time ) +{ copyIntern(); @@ -97,3 +131,6 @@ void OPimNotify::setDateTime( const QDateTime& time ) { } -void OPimNotify::setDuration( int dur ) { + + +void OPimNotify::setDuration( int dur ) +{ copyIntern(); @@ -101,3 +138,6 @@ void OPimNotify::setDuration( int dur ) { } -void OPimNotify::setParent( int uid ) { + + +void OPimNotify::setParent( int uid ) +{ copyIntern(); @@ -105,3 +145,6 @@ void OPimNotify::setParent( int uid ) { } -void OPimNotify::setService( const QString& str ) { + + +void OPimNotify::setService( const QString& str ) +{ copyIntern(); @@ -109,4 +152,8 @@ void OPimNotify::setService( const QString& str ) { } -void OPimNotify::copyIntern() { - if ( data->count != 1 ) { + + +void OPimNotify::copyIntern() +{ + if ( data->count != 1 ) + { data->deref(); @@ -114,3 +161,3 @@ void OPimNotify::copyIntern() { dat->start = data->start; - dat->dur = data->dur; + dat->dur = data->dur; dat->application = data->application; @@ -120,4 +167,8 @@ void OPimNotify::copyIntern() { } -void OPimNotify::deref() { - if ( data->deref() ) { + + +void OPimNotify::deref() +{ + if ( data->deref() ) + { delete data; @@ -127,5 +178,8 @@ void OPimNotify::deref() { + /***********************************************************/ -struct OPimAlarm::Data : public QShared { - Data() : QShared() { +struct OPimAlarm::Data : public QShared +{ + Data() : QShared() + { sound = 1; @@ -135,4 +189,6 @@ struct OPimAlarm::Data : public QShared { }; + + OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent ) - : OPimNotify( start, duration, parent ) + : OPimNotify( start, duration, parent ) { @@ -141,4 +197,6 @@ OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int paren } -OPimAlarm::OPimAlarm( const OPimAlarm& al) - : OPimNotify(al), data( al.data ) + + +OPimAlarm::OPimAlarm( const OPimAlarm& al ) + : OPimNotify( al ), data( al.data ) { @@ -146,4 +204,8 @@ OPimAlarm::OPimAlarm( const OPimAlarm& al) } -OPimAlarm::~OPimAlarm() { - if ( data->deref() ) { + + +OPimAlarm::~OPimAlarm() +{ + if ( data->deref() ) + { delete data; @@ -152,3 +214,5 @@ OPimAlarm::~OPimAlarm() { } -OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) + + +OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al ) { @@ -163,3 +227,6 @@ OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) } -bool OPimAlarm::operator==( const OPimAlarm& al) { + + +bool OPimAlarm::operator==( const OPimAlarm& al ) +{ if ( data->sound != al.data->sound ) return false; @@ -170,12 +237,24 @@ bool OPimAlarm::operator==( const OPimAlarm& al) { } -QString OPimAlarm::type()const { - return QString::fromLatin1("OPimAlarm"); + + +QString OPimAlarm::type() const +{ + return QString::fromLatin1( "OPimAlarm" ); } -int OPimAlarm::sound()const { + + +int OPimAlarm::sound() const +{ return data->sound; } -QString OPimAlarm::file()const { + + +QString OPimAlarm::file() const +{ return data->file; } -void OPimAlarm::setSound( int snd) { + + +void OPimAlarm::setSound( int snd ) +{ copyIntern(); @@ -183,3 +262,6 @@ void OPimAlarm::setSound( int snd) { } -void OPimAlarm::setFile( const QString& sound ) { + + +void OPimAlarm::setFile( const QString& sound ) +{ copyIntern(); @@ -187,4 +269,8 @@ void OPimAlarm::setFile( const QString& sound ) { } -void OPimAlarm::deref() { - if ( data->deref() ) { + + +void OPimAlarm::deref() +{ + if ( data->deref() ) + { delete data; @@ -193,4 +279,8 @@ void OPimAlarm::deref() { } -void OPimAlarm::copyIntern() { - if ( data->count != 1 ) { + + +void OPimAlarm::copyIntern() +{ + if ( data->count != 1 ) + { data->deref(); @@ -198,3 +288,3 @@ void OPimAlarm::copyIntern() { newDat->sound = data->sound; - newDat->file = data->file; + newDat->file = data->file; data = newDat; @@ -202,6 +292,9 @@ void OPimAlarm::copyIntern() { } + + /************************/ -struct OPimReminder::Data : public QShared { - Data() : QShared(), record( 0) { - } +struct OPimReminder::Data : public QShared +{ + Data() : QShared(), record( 0 ) + {} int record; @@ -209,4 +302,6 @@ struct OPimReminder::Data : public QShared { }; -OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent ) - : OPimNotify( start, dur, parent ) + + +OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent ) + : OPimNotify( start, dur, parent ) { @@ -215,4 +310,6 @@ OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int paren } + + OPimReminder::OPimReminder( const OPimReminder& rem ) - : OPimNotify( rem ), data( rem.data ) + : OPimNotify( rem ), data( rem.data ) { @@ -220,4 +317,7 @@ OPimReminder::OPimReminder( const OPimReminder& rem ) } -OPimReminder& OPimReminder::operator=( const OPimReminder& rem) { - OPimNotify::operator=(rem ); + + +OPimReminder& OPimReminder::operator=( const OPimReminder& rem ) +{ + OPimNotify::operator=( rem ); @@ -229,3 +329,6 @@ OPimReminder& OPimReminder::operator=( const OPimReminder& rem) { } -bool OPimReminder::operator==( const OPimReminder& rem) { + + +bool OPimReminder::operator==( const OPimReminder& rem ) +{ if ( data->record != rem.data->record ) return false; @@ -234,9 +337,18 @@ bool OPimReminder::operator==( const OPimReminder& rem) { } -QString OPimReminder::type()const { - return QString::fromLatin1("OPimReminder"); + + +QString OPimReminder::type() const +{ + return QString::fromLatin1( "OPimReminder" ); } -int OPimReminder::recordUid()const { + + +int OPimReminder::recordUid() const +{ return data->record; } -void OPimReminder::setRecordUid( int uid ) { + + +void OPimReminder::setRecordUid( int uid ) +{ copyIntern(); @@ -244,4 +356,8 @@ void OPimReminder::setRecordUid( int uid ) { } -void OPimReminder::deref() { - if ( data->deref() ) { + + +void OPimReminder::deref() +{ + if ( data->deref() ) + { delete data; @@ -250,5 +366,9 @@ void OPimReminder::deref() { } -void OPimReminder::copyIntern() { - if ( data->count != 1 ) { - Data* da = new Data; + + +void OPimReminder::copyIntern() +{ + if ( data->count != 1 ) + { + Data * da = new Data; da->record = data->record; @@ -257,2 +377,3 @@ void OPimReminder::copyIntern() { } + } |