summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
authorzautrix <zautrix>2005-07-07 20:46:00 (UTC)
committer zautrix <zautrix>2005-07-07 20:46:00 (UTC)
commitde5621f2fd3924f27c05459ae555b3bd06c5e584 (patch) (unidiff)
tree589d19415e3c0ff6c08cec375db145242581c143 /libkcal/incidencebase.cpp
parent766b53919de14b8faec22db32b6a750acde0b760 (diff)
downloadkdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.zip
kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.gz
kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.bz2
fixxx
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 96039df..dcead02 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -46,192 +46,200 @@ IncidenceBase::IncidenceBase() :
46 mAttendees.setAutoDelete( true ); 46 mAttendees.setAutoDelete( true );
47 mCalEnabled = true; 47 mCalEnabled = true;
48 mAlarmEnabled = true; 48 mAlarmEnabled = true;
49 mCalID = 0; 49 mCalID = 0;
50} 50}
51 51
52IncidenceBase::IncidenceBase(const IncidenceBase &i) : 52IncidenceBase::IncidenceBase(const IncidenceBase &i) :
53 CustomProperties( i ) 53 CustomProperties( i )
54{ 54{
55 55
56 mReadOnly = i.mReadOnly; 56 mReadOnly = i.mReadOnly;
57 mDtStart = i.mDtStart; 57 mDtStart = i.mDtStart;
58 mDuration = i.mDuration; 58 mDuration = i.mDuration;
59 mHasDuration = i.mHasDuration; 59 mHasDuration = i.mHasDuration;
60 mOrganizer = i.mOrganizer; 60 mOrganizer = i.mOrganizer;
61 mUid = i.mUid; 61 mUid = i.mUid;
62 mCalEnabled = i.mCalEnabled; 62 mCalEnabled = i.mCalEnabled;
63 mAlarmEnabled = i.mAlarmEnabled; 63 mAlarmEnabled = i.mAlarmEnabled;
64 mCalID = i.mCalID; 64 mCalID = i.mCalID;
65 QPtrList<Attendee> attendees = i.attendees(); 65 QPtrList<Attendee> attendees = i.attendees();
66 for( Attendee *a = attendees.first(); a; a = attendees.next() ) { 66 for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
67 mAttendees.append( new Attendee( *a ) ); 67 mAttendees.append( new Attendee( *a ) );
68 } 68 }
69 mFloats = i.mFloats; 69 mFloats = i.mFloats;
70 mLastModified = i.mLastModified; 70 mLastModified = i.mLastModified;
71 mPilotId = i.mPilotId; 71 mPilotId = i.mPilotId;
72 mTempSyncStat = i.mTempSyncStat; 72 mTempSyncStat = i.mTempSyncStat;
73 mSyncStatus = i.mSyncStatus; 73 mSyncStatus = i.mSyncStatus;
74 mExternalId = i.mExternalId; 74 mExternalId = i.mExternalId;
75 // The copied object is a new one, so it isn't observed by the observer 75 // The copied object is a new one, so it isn't observed by the observer
76 // of the original object. 76 // of the original object.
77 mObservers.clear(); 77 mObservers.clear();
78 78
79 mAttendees.setAutoDelete( true ); 79 mAttendees.setAutoDelete( true );
80} 80}
81 81
82IncidenceBase::~IncidenceBase() 82IncidenceBase::~IncidenceBase()
83{ 83{
84} 84}
85 85
86 86
87bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) 87bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
88{ 88{
89 // do not compare mSyncStatus and mExternalId 89 // do not compare mSyncStatus and mExternalId
90 if( i1.attendees().count() != i2.attendees().count() ) { 90 if( i1.attendees().count() != i2.attendees().count() ) {
91 return false; // no need to check further 91 return false; // no need to check further
92 } 92 }
93 if ( i1.attendees().count() > 0 ) { 93 if ( i1.attendees().count() > 0 ) {
94 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 94 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
95 while ( a1 ) { 95 while ( a1 ) {
96 if ( !( (*a1) == (*a2)) ) 96 if ( !( (*a1) == (*a2)) )
97 { 97 {
98 //qDebug("Attendee not equal "); 98 //qDebug("Attendee not equal ");
99 return false; 99 return false;
100 } 100 }
101 a1 = i1.attendees().next(); 101 a1 = i1.attendees().next();
102 a2 = i2.attendees().next(); 102 a2 = i2.attendees().next();
103 } 103 }
104 } 104 }
105 //if ( i1.dtStart() != i2.dtStart() ) 105 //if ( i1.dtStart() != i2.dtStart() )
106 // return false; 106 // return false;
107#if 0 107#if 0
108 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); 108 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() );
109 qDebug("1 %d ",i1.duration() == i2.duration() ); 109 qDebug("1 %d ",i1.duration() == i2.duration() );
110 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); 110 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() );
111 qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); 111 qDebug("1 %d ",i1.pilotId() == i2.pilotId() );
112 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); 112 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() );
113 qDebug("6 %d ",i1.organizer() == i2.organizer() ); 113 qDebug("6 %d ",i1.organizer() == i2.organizer() );
114 114
115#endif 115#endif
116 if ( i1.hasDuration() == i2.hasDuration() ) { 116 if ( i1.hasDuration() == i2.hasDuration() ) {
117 if ( i1.hasDuration() ) { 117 if ( i1.hasDuration() ) {
118 if ( i1.duration() != i2.duration() ) 118 if ( i1.duration() != i2.duration() )
119 return false; 119 return false;
120 } 120 }
121 } else { 121 } else {
122 return false; 122 return false;
123 } 123 }
124 124
125 return ( i1.organizer() == i2.organizer() && 125 return ( i1.organizer() == i2.organizer() &&
126 // i1.uid() == i2.uid() && 126 // i1.uid() == i2.uid() &&
127 // Don't compare lastModified, otherwise the operator is not 127 // Don't compare lastModified, otherwise the operator is not
128 // of much use. We are not comparing for identity, after all. 128 // of much use. We are not comparing for identity, after all.
129 i1.doesFloat() == i2.doesFloat() && 129 i1.doesFloat() == i2.doesFloat() &&
130 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); 130 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() );
131 // no need to compare mObserver 131 // no need to compare mObserver
132} 132}
133 133
134 134
135QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 135QDateTime IncidenceBase::getEvenTime( QDateTime dt )
136{ 136{
137 QTime t = dt.time(); 137 QTime t = dt.time();
138 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 138 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
139 return dt; 139 return dt;
140} 140}
141 141
142bool IncidenceBase::isTagged() const
143{
144 return mIsTagged;
145}
146void IncidenceBase::setTagged( bool b)
147{
148 mIsTagged = b;
149}
142void IncidenceBase::setCalID( int id ) 150void IncidenceBase::setCalID( int id )
143{ 151{
144 if ( mCalID > 0 ) 152 if ( mCalID > 0 )
145 updated(); 153 updated();
146 mCalID = id; 154 mCalID = id;
147} 155}
148int IncidenceBase::calID() const 156int IncidenceBase::calID() const
149{ 157{
150 return mCalID; 158 return mCalID;
151} 159}
152void IncidenceBase::setCalEnabled( bool b ) 160void IncidenceBase::setCalEnabled( bool b )
153{ 161{
154 mCalEnabled = b; 162 mCalEnabled = b;
155} 163}
156bool IncidenceBase::calEnabled() const 164bool IncidenceBase::calEnabled() const
157{ 165{
158 return mCalEnabled; 166 return mCalEnabled;
159} 167}
160 168
161void IncidenceBase::setAlarmEnabled( bool b ) 169void IncidenceBase::setAlarmEnabled( bool b )
162{ 170{
163 mAlarmEnabled = b; 171 mAlarmEnabled = b;
164} 172}
165bool IncidenceBase::alarmEnabled() const 173bool IncidenceBase::alarmEnabled() const
166{ 174{
167 return mAlarmEnabled; 175 return mAlarmEnabled;
168} 176}
169 177
170 178
171void IncidenceBase::setUid(const QString &uid) 179void IncidenceBase::setUid(const QString &uid)
172{ 180{
173 mUid = uid; 181 mUid = uid;
174 updated(); 182 updated();
175} 183}
176 184
177QString IncidenceBase::uid() const 185QString IncidenceBase::uid() const
178{ 186{
179 return mUid; 187 return mUid;
180} 188}
181 189
182void IncidenceBase::setLastModified(const QDateTime &lm) 190void IncidenceBase::setLastModified(const QDateTime &lm)
183{ 191{
184 // DON'T! updated() because we call this from 192 // DON'T! updated() because we call this from
185 // Calendar::updateEvent(). 193 // Calendar::updateEvent().
186 mLastModified = getEvenTime(lm); 194 mLastModified = getEvenTime(lm);
187 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 195 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
188} 196}
189 197
190QDateTime IncidenceBase::lastModified() const 198QDateTime IncidenceBase::lastModified() const
191{ 199{
192 return mLastModified; 200 return mLastModified;
193} 201}
194 202
195void IncidenceBase::setOrganizer(const QString &o) 203void IncidenceBase::setOrganizer(const QString &o)
196{ 204{
197 // we don't check for readonly here, because it is 205 // we don't check for readonly here, because it is
198 // possible that by setting the organizer we are changing 206 // possible that by setting the organizer we are changing
199 // the event's readonly status... 207 // the event's readonly status...
200 mOrganizer = o; 208 mOrganizer = o;
201 if (mOrganizer.left(7).upper() == "MAILTO:") 209 if (mOrganizer.left(7).upper() == "MAILTO:")
202 mOrganizer = mOrganizer.remove(0,7); 210 mOrganizer = mOrganizer.remove(0,7);
203 211
204 updated(); 212 updated();
205} 213}
206 214
207QString IncidenceBase::organizer() const 215QString IncidenceBase::organizer() const
208{ 216{
209 return mOrganizer; 217 return mOrganizer;
210} 218}
211 219
212void IncidenceBase::setReadOnly( bool readOnly ) 220void IncidenceBase::setReadOnly( bool readOnly )
213{ 221{
214 mReadOnly = readOnly; 222 mReadOnly = readOnly;
215} 223}
216 224
217void IncidenceBase::setDtStart(const QDateTime &dtStart) 225void IncidenceBase::setDtStart(const QDateTime &dtStart)
218{ 226{
219// if (mReadOnly) return; 227// if (mReadOnly) return;
220 mDtStart = getEvenTime(dtStart); 228 mDtStart = getEvenTime(dtStart);
221 updated(); 229 updated();
222} 230}
223 231
224 232
225QDateTime IncidenceBase::dtStart() const 233QDateTime IncidenceBase::dtStart() const
226{ 234{
227 return mDtStart; 235 return mDtStart;
228} 236}
229 237
230QString IncidenceBase::dtStartTimeStr() const 238QString IncidenceBase::dtStartTimeStr() const
231{ 239{
232 return KGlobal::locale()->formatTime(dtStart().time()); 240 return KGlobal::locale()->formatTime(dtStart().time());
233} 241}
234 242
235QString IncidenceBase::dtStartDateStr(bool shortfmt) const 243QString IncidenceBase::dtStartDateStr(bool shortfmt) const
236{ 244{
237 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 245 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);