summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimnotify.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimnotify.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotify.cpp219
1 files changed, 170 insertions, 49 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 @@
28*/ 28*/
29#include <qshared.h>
30 29
31#include <opie2/opimnotify.h> 30#include "opimnotify.h"
32 31
33namespace Opie { 32/* QT */
33#include <qshared.h>
34 34
35struct OPimNotify::Data : public QShared { 35namespace Opie
36 Data() : QShared(),dur(-1),parent(0) { 36{
37 37
38struct OPimNotify::Data : public QShared
39{
40 Data() : QShared(), dur( -1 ), parent( 0 )
41 {
38 } 42 }
@@ -44,3 +48,4 @@ struct OPimNotify::Data : public QShared {
44 48
45OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { 49OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent )
50{
46 data = new Data; 51 data = new Data;
@@ -50,2 +55,4 @@ OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) {
50} 55}
56
57
51OPimNotify::OPimNotify( const OPimNotify& noti) 58OPimNotify::OPimNotify( const OPimNotify& noti)
@@ -55,4 +62,8 @@ OPimNotify::OPimNotify( const OPimNotify& noti)
55} 62}
56OPimNotify::~OPimNotify() { 63
57 if ( data->deref() ) { 64
65OPimNotify::~OPimNotify()
66{
67 if ( data->deref() )
68 {
58 delete data; 69 delete data;
@@ -62,3 +73,5 @@ OPimNotify::~OPimNotify() {
62 73
63OPimNotify &OPimNotify::operator=( const OPimNotify& noti) { 74
75OPimNotify &OPimNotify::operator=( const OPimNotify& noti )
76{
64 noti.data->ref(); 77 noti.data->ref();
@@ -69,3 +82,6 @@ OPimNotify &OPimNotify::operator=( const OPimNotify& noti) {
69} 82}
70bool OPimNotify::operator==( const OPimNotify& noti ) { 83
84
85bool OPimNotify::operator==( const OPimNotify& noti )
86{
71 if ( data == noti.data ) return true; 87 if ( data == noti.data ) return true;
@@ -78,18 +94,36 @@ bool OPimNotify::operator==( const OPimNotify& noti ) {
78} 94}
79QDateTime OPimNotify::dateTime()const { 95
96
97QDateTime OPimNotify::dateTime() const
98{
80 return data->start; 99 return data->start;
81} 100}
82QString OPimNotify::service()const { 101
102
103QString OPimNotify::service() const
104{
83 return data->application; 105 return data->application;
84} 106}
85int OPimNotify::parent()const { 107
108
109int OPimNotify::parent() const
110{
86 return data->parent; 111 return data->parent;
87} 112}
88int OPimNotify::duration()const { 113
114
115int OPimNotify::duration() const
116{
89 return data->dur; 117 return data->dur;
90} 118}
91QDateTime OPimNotify::endTime()const { 119
120
121QDateTime OPimNotify::endTime() const
122{
92 return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) ); 123 return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) );
93} 124}
94void OPimNotify::setDateTime( const QDateTime& time ) { 125
126
127void OPimNotify::setDateTime( const QDateTime& time )
128{
95 copyIntern(); 129 copyIntern();
@@ -97,3 +131,6 @@ void OPimNotify::setDateTime( const QDateTime& time ) {
97} 131}
98void OPimNotify::setDuration( int dur ) { 132
133
134void OPimNotify::setDuration( int dur )
135{
99 copyIntern(); 136 copyIntern();
@@ -101,3 +138,6 @@ void OPimNotify::setDuration( int dur ) {
101} 138}
102void OPimNotify::setParent( int uid ) { 139
140
141void OPimNotify::setParent( int uid )
142{
103 copyIntern(); 143 copyIntern();
@@ -105,3 +145,6 @@ void OPimNotify::setParent( int uid ) {
105} 145}
106void OPimNotify::setService( const QString& str ) { 146
147
148void OPimNotify::setService( const QString& str )
149{
107 copyIntern(); 150 copyIntern();
@@ -109,4 +152,8 @@ void OPimNotify::setService( const QString& str ) {
109} 152}
110void OPimNotify::copyIntern() { 153
111 if ( data->count != 1 ) { 154
155void OPimNotify::copyIntern()
156{
157 if ( data->count != 1 )
158 {
112 data->deref(); 159 data->deref();
@@ -120,4 +167,8 @@ void OPimNotify::copyIntern() {
120} 167}
121void OPimNotify::deref() { 168
122 if ( data->deref() ) { 169
170void OPimNotify::deref()
171{
172 if ( data->deref() )
173 {
123 delete data; 174 delete data;
@@ -127,5 +178,8 @@ void OPimNotify::deref() {
127 178
179
128/***********************************************************/ 180/***********************************************************/
129struct OPimAlarm::Data : public QShared { 181struct OPimAlarm::Data : public QShared
130 Data() : QShared() { 182{
183 Data() : QShared()
184 {
131 sound = 1; 185 sound = 1;
@@ -135,2 +189,4 @@ struct OPimAlarm::Data : public QShared {
135}; 189};
190
191
136OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent ) 192OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent )
@@ -141,2 +197,4 @@ OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int paren
141} 197}
198
199
142OPimAlarm::OPimAlarm( const OPimAlarm& al) 200OPimAlarm::OPimAlarm( const OPimAlarm& al)
@@ -146,4 +204,8 @@ OPimAlarm::OPimAlarm( const OPimAlarm& al)
146} 204}
147OPimAlarm::~OPimAlarm() { 205
148 if ( data->deref() ) { 206
207OPimAlarm::~OPimAlarm()
208{
209 if ( data->deref() )
210 {
149 delete data; 211 delete data;
@@ -152,2 +214,4 @@ OPimAlarm::~OPimAlarm() {
152} 214}
215
216
153OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) 217OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
@@ -163,3 +227,6 @@ OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
163} 227}
164bool OPimAlarm::operator==( const OPimAlarm& al) { 228
229
230bool OPimAlarm::operator==( const OPimAlarm& al )
231{
165 if ( data->sound != al.data->sound ) return false; 232 if ( data->sound != al.data->sound ) return false;
@@ -170,12 +237,24 @@ bool OPimAlarm::operator==( const OPimAlarm& al) {
170} 237}
171QString OPimAlarm::type()const { 238
239
240QString OPimAlarm::type() const
241{
172 return QString::fromLatin1("OPimAlarm"); 242 return QString::fromLatin1("OPimAlarm");
173} 243}
174int OPimAlarm::sound()const { 244
245
246int OPimAlarm::sound() const
247{
175 return data->sound; 248 return data->sound;
176} 249}
177QString OPimAlarm::file()const { 250
251
252QString OPimAlarm::file() const
253{
178 return data->file; 254 return data->file;
179} 255}
180void OPimAlarm::setSound( int snd) { 256
257
258void OPimAlarm::setSound( int snd )
259{
181 copyIntern(); 260 copyIntern();
@@ -183,3 +262,6 @@ void OPimAlarm::setSound( int snd) {
183} 262}
184void OPimAlarm::setFile( const QString& sound ) { 263
264
265void OPimAlarm::setFile( const QString& sound )
266{
185 copyIntern(); 267 copyIntern();
@@ -187,4 +269,8 @@ void OPimAlarm::setFile( const QString& sound ) {
187} 269}
188void OPimAlarm::deref() { 270
189 if ( data->deref() ) { 271
272void OPimAlarm::deref()
273{
274 if ( data->deref() )
275 {
190 delete data; 276 delete data;
@@ -193,4 +279,8 @@ void OPimAlarm::deref() {
193} 279}
194void OPimAlarm::copyIntern() { 280
195 if ( data->count != 1 ) { 281
282void OPimAlarm::copyIntern()
283{
284 if ( data->count != 1 )
285 {
196 data->deref(); 286 data->deref();
@@ -202,6 +292,9 @@ void OPimAlarm::copyIntern() {
202} 292}
293
294
203/************************/ 295/************************/
204struct OPimReminder::Data : public QShared { 296struct OPimReminder::Data : public QShared
205 Data() : QShared(), record( 0) { 297{
206 } 298 Data() : QShared(), record( 0 )
299 {}
207 int record; 300 int record;
@@ -209,2 +302,4 @@ struct OPimReminder::Data : public QShared {
209}; 302};
303
304
210OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent ) 305OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent )
@@ -215,2 +310,4 @@ OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int paren
215} 310}
311
312
216OPimReminder::OPimReminder( const OPimReminder& rem ) 313OPimReminder::OPimReminder( const OPimReminder& rem )
@@ -220,3 +317,6 @@ OPimReminder::OPimReminder( const OPimReminder& rem )
220} 317}
221OPimReminder& OPimReminder::operator=( const OPimReminder& rem) { 318
319
320OPimReminder& OPimReminder::operator=( const OPimReminder& rem )
321{
222 OPimNotify::operator=(rem ); 322 OPimNotify::operator=(rem );
@@ -229,3 +329,6 @@ OPimReminder& OPimReminder::operator=( const OPimReminder& rem) {
229} 329}
230bool OPimReminder::operator==( const OPimReminder& rem) { 330
331
332bool OPimReminder::operator==( const OPimReminder& rem )
333{
231 if ( data->record != rem.data->record ) return false; 334 if ( data->record != rem.data->record ) return false;
@@ -234,9 +337,18 @@ bool OPimReminder::operator==( const OPimReminder& rem) {
234} 337}
235QString OPimReminder::type()const { 338
339
340QString OPimReminder::type() const
341{
236 return QString::fromLatin1("OPimReminder"); 342 return QString::fromLatin1("OPimReminder");
237} 343}
238int OPimReminder::recordUid()const { 344
345
346int OPimReminder::recordUid() const
347{
239 return data->record; 348 return data->record;
240} 349}
241void OPimReminder::setRecordUid( int uid ) { 350
351
352void OPimReminder::setRecordUid( int uid )
353{
242 copyIntern(); 354 copyIntern();
@@ -244,4 +356,8 @@ void OPimReminder::setRecordUid( int uid ) {
244} 356}
245void OPimReminder::deref() { 357
246 if ( data->deref() ) { 358
359void OPimReminder::deref()
360{
361 if ( data->deref() )
362 {
247 delete data; 363 delete data;
@@ -250,4 +366,8 @@ void OPimReminder::deref() {
250} 366}
251void OPimReminder::copyIntern() { 367
252 if ( data->count != 1 ) { 368
369void OPimReminder::copyIntern()
370{
371 if ( data->count != 1 )
372 {
253 Data* da = new Data; 373 Data* da = new Data;
@@ -257,2 +377,3 @@ void OPimReminder::copyIntern() {
257} 377}
378
258} 379}