author | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
commit | 6385f303bef3cbcd19d097a7b05c30e144d5dd6e (patch) (unidiff) | |
tree | 770795d94ea6ec1dc8bcaa67cc174a9c0add564a /libkcal/incidencebase.cpp | |
parent | 13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (diff) | |
download | kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.zip kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.gz kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.bz2 |
implemented remove sync info for kopi and kapi
-rw-r--r-- | libkcal/incidencebase.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index b36dc1a..9aa517c 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -1,407 +1,410 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | #include <kidmanager.h> | 24 | #include <kidmanager.h> |
25 | 25 | ||
26 | #include "calformat.h" | 26 | #include "calformat.h" |
27 | #include "syncdefines.h" | 27 | #include "syncdefines.h" |
28 | 28 | ||
29 | #include "incidencebase.h" | 29 | #include "incidencebase.h" |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | IncidenceBase::IncidenceBase() : | 33 | IncidenceBase::IncidenceBase() : |
34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), | 34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), |
35 | mPilotId(0), mSyncStatus(SYNCMOD) | 35 | mPilotId(0), mSyncStatus(SYNCMOD) |
36 | { | 36 | { |
37 | setUid(CalFormat::createUniqueId()); | 37 | setUid(CalFormat::createUniqueId()); |
38 | mOrganizer = ""; | 38 | mOrganizer = ""; |
39 | mFloats = false; | 39 | mFloats = false; |
40 | mDuration = 0; | 40 | mDuration = 0; |
41 | mHasDuration = false; | 41 | mHasDuration = false; |
42 | mPilotId = 0; | 42 | mPilotId = 0; |
43 | mExternalId = ":"; | 43 | mExternalId = ":"; |
44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
45 | mSyncStatus = 0; | 45 | mSyncStatus = 0; |
46 | mAttendees.setAutoDelete( true ); | 46 | mAttendees.setAutoDelete( true ); |
47 | } | 47 | } |
48 | 48 | ||
49 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : | 49 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : |
50 | CustomProperties( i ) | 50 | CustomProperties( i ) |
51 | { | 51 | { |
52 | mReadOnly = i.mReadOnly; | 52 | mReadOnly = i.mReadOnly; |
53 | mDtStart = i.mDtStart; | 53 | mDtStart = i.mDtStart; |
54 | mDuration = i.mDuration; | 54 | mDuration = i.mDuration; |
55 | mHasDuration = i.mHasDuration; | 55 | mHasDuration = i.mHasDuration; |
56 | mOrganizer = i.mOrganizer; | 56 | mOrganizer = i.mOrganizer; |
57 | mUid = i.mUid; | 57 | mUid = i.mUid; |
58 | QPtrList<Attendee> attendees = i.attendees(); | 58 | QPtrList<Attendee> attendees = i.attendees(); |
59 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { | 59 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { |
60 | mAttendees.append( new Attendee( *a ) ); | 60 | mAttendees.append( new Attendee( *a ) ); |
61 | } | 61 | } |
62 | mFloats = i.mFloats; | 62 | mFloats = i.mFloats; |
63 | mLastModified = i.mLastModified; | 63 | mLastModified = i.mLastModified; |
64 | mPilotId = i.mPilotId; | 64 | mPilotId = i.mPilotId; |
65 | mTempSyncStat = i.mTempSyncStat; | 65 | mTempSyncStat = i.mTempSyncStat; |
66 | mSyncStatus = i.mSyncStatus; | 66 | mSyncStatus = i.mSyncStatus; |
67 | mExternalId = i.mExternalId; | 67 | mExternalId = i.mExternalId; |
68 | // The copied object is a new one, so it isn't observed by the observer | 68 | // The copied object is a new one, so it isn't observed by the observer |
69 | // of the original object. | 69 | // of the original object. |
70 | mObservers.clear(); | 70 | mObservers.clear(); |
71 | 71 | ||
72 | mAttendees.setAutoDelete( true ); | 72 | mAttendees.setAutoDelete( true ); |
73 | } | 73 | } |
74 | 74 | ||
75 | IncidenceBase::~IncidenceBase() | 75 | IncidenceBase::~IncidenceBase() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | 80 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) |
81 | { | 81 | { |
82 | // do not compare mSyncStatus and mExternalId | 82 | // do not compare mSyncStatus and mExternalId |
83 | if( i1.attendees().count() != i2.attendees().count() ) { | 83 | if( i1.attendees().count() != i2.attendees().count() ) { |
84 | return false; // no need to check further | 84 | return false; // no need to check further |
85 | } | 85 | } |
86 | if ( i1.attendees().count() > 0 ) { | 86 | if ( i1.attendees().count() > 0 ) { |
87 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; | 87 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; |
88 | while ( a1 ) { | 88 | while ( a1 ) { |
89 | if ( !( (*a1) == (*a2)) ) | 89 | if ( !( (*a1) == (*a2)) ) |
90 | { | 90 | { |
91 | //qDebug("Attendee not equal "); | 91 | //qDebug("Attendee not equal "); |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | a1 = i1.attendees().next(); | 94 | a1 = i1.attendees().next(); |
95 | a2 = i2.attendees().next(); | 95 | a2 = i2.attendees().next(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | //if ( i1.dtStart() != i2.dtStart() ) | 98 | //if ( i1.dtStart() != i2.dtStart() ) |
99 | // return false; | 99 | // return false; |
100 | #if 0 | 100 | #if 0 |
101 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); | 101 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); |
102 | qDebug("1 %d ",i1.duration() == i2.duration() ); | 102 | qDebug("1 %d ",i1.duration() == i2.duration() ); |
103 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); | 103 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); |
104 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); | 104 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); |
105 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); | 105 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); |
106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
107 | 107 | ||
108 | #endif | 108 | #endif |
109 | return ( i1.organizer() == i2.organizer() && | 109 | return ( i1.organizer() == i2.organizer() && |
110 | // i1.uid() == i2.uid() && | 110 | // i1.uid() == i2.uid() && |
111 | // Don't compare lastModified, otherwise the operator is not | 111 | // Don't compare lastModified, otherwise the operator is not |
112 | // of much use. We are not comparing for identity, after all. | 112 | // of much use. We are not comparing for identity, after all. |
113 | i1.doesFloat() == i2.doesFloat() && | 113 | i1.doesFloat() == i2.doesFloat() && |
114 | i1.duration() == i2.duration() && | 114 | i1.duration() == i2.duration() && |
115 | i1.hasDuration() == i2.hasDuration() && | 115 | i1.hasDuration() == i2.hasDuration() && |
116 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 116 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
117 | // no need to compare mObserver | 117 | // no need to compare mObserver |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 121 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
122 | { | 122 | { |
123 | QTime t = dt.time(); | 123 | QTime t = dt.time(); |
124 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 124 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
125 | return dt; | 125 | return dt; |
126 | } | 126 | } |
127 | 127 | ||
128 | 128 | ||
129 | void IncidenceBase::setUid(const QString &uid) | 129 | void IncidenceBase::setUid(const QString &uid) |
130 | { | 130 | { |
131 | mUid = uid; | 131 | mUid = uid; |
132 | updated(); | 132 | updated(); |
133 | } | 133 | } |
134 | 134 | ||
135 | QString IncidenceBase::uid() const | 135 | QString IncidenceBase::uid() const |
136 | { | 136 | { |
137 | return mUid; | 137 | return mUid; |
138 | } | 138 | } |
139 | 139 | ||
140 | void IncidenceBase::setLastModified(const QDateTime &lm) | 140 | void IncidenceBase::setLastModified(const QDateTime &lm) |
141 | { | 141 | { |
142 | // DON'T! updated() because we call this from | 142 | // DON'T! updated() because we call this from |
143 | // Calendar::updateEvent(). | 143 | // Calendar::updateEvent(). |
144 | mLastModified = getEvenTime(lm); | 144 | mLastModified = getEvenTime(lm); |
145 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 145 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
146 | } | 146 | } |
147 | 147 | ||
148 | QDateTime IncidenceBase::lastModified() const | 148 | QDateTime IncidenceBase::lastModified() const |
149 | { | 149 | { |
150 | return mLastModified; | 150 | return mLastModified; |
151 | } | 151 | } |
152 | 152 | ||
153 | void IncidenceBase::setOrganizer(const QString &o) | 153 | void IncidenceBase::setOrganizer(const QString &o) |
154 | { | 154 | { |
155 | // we don't check for readonly here, because it is | 155 | // we don't check for readonly here, because it is |
156 | // possible that by setting the organizer we are changing | 156 | // possible that by setting the organizer we are changing |
157 | // the event's readonly status... | 157 | // the event's readonly status... |
158 | mOrganizer = o; | 158 | mOrganizer = o; |
159 | if (mOrganizer.left(7).upper() == "MAILTO:") | 159 | if (mOrganizer.left(7).upper() == "MAILTO:") |
160 | mOrganizer = mOrganizer.remove(0,7); | 160 | mOrganizer = mOrganizer.remove(0,7); |
161 | 161 | ||
162 | updated(); | 162 | updated(); |
163 | } | 163 | } |
164 | 164 | ||
165 | QString IncidenceBase::organizer() const | 165 | QString IncidenceBase::organizer() const |
166 | { | 166 | { |
167 | return mOrganizer; | 167 | return mOrganizer; |
168 | } | 168 | } |
169 | 169 | ||
170 | void IncidenceBase::setReadOnly( bool readOnly ) | 170 | void IncidenceBase::setReadOnly( bool readOnly ) |
171 | { | 171 | { |
172 | mReadOnly = readOnly; | 172 | mReadOnly = readOnly; |
173 | } | 173 | } |
174 | 174 | ||
175 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 175 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
176 | { | 176 | { |
177 | // if (mReadOnly) return; | 177 | // if (mReadOnly) return; |
178 | mDtStart = getEvenTime(dtStart); | 178 | mDtStart = getEvenTime(dtStart); |
179 | updated(); | 179 | updated(); |
180 | } | 180 | } |
181 | 181 | ||
182 | QDateTime IncidenceBase::dtStart() const | 182 | QDateTime IncidenceBase::dtStart() const |
183 | { | 183 | { |
184 | return mDtStart; | 184 | return mDtStart; |
185 | } | 185 | } |
186 | 186 | ||
187 | QString IncidenceBase::dtStartTimeStr() const | 187 | QString IncidenceBase::dtStartTimeStr() const |
188 | { | 188 | { |
189 | return KGlobal::locale()->formatTime(dtStart().time()); | 189 | return KGlobal::locale()->formatTime(dtStart().time()); |
190 | } | 190 | } |
191 | 191 | ||
192 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const | 192 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const |
193 | { | 193 | { |
194 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 194 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
195 | } | 195 | } |
196 | 196 | ||
197 | QString IncidenceBase::dtStartStr(bool shortfmt) const | 197 | QString IncidenceBase::dtStartStr(bool shortfmt) const |
198 | { | 198 | { |
199 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); | 199 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | bool IncidenceBase::doesFloat() const | 203 | bool IncidenceBase::doesFloat() const |
204 | { | 204 | { |
205 | return mFloats; | 205 | return mFloats; |
206 | } | 206 | } |
207 | 207 | ||
208 | void IncidenceBase::setFloats(bool f) | 208 | void IncidenceBase::setFloats(bool f) |
209 | { | 209 | { |
210 | if (mReadOnly) return; | 210 | if (mReadOnly) return; |
211 | mFloats = f; | 211 | mFloats = f; |
212 | updated(); | 212 | updated(); |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | void IncidenceBase::addAttendee(Attendee *a, bool doupdate) | 216 | void IncidenceBase::addAttendee(Attendee *a, bool doupdate) |
217 | { | 217 | { |
218 | if (mReadOnly) return; | 218 | if (mReadOnly) return; |
219 | if (a->name().left(7).upper() == "MAILTO:") | 219 | if (a->name().left(7).upper() == "MAILTO:") |
220 | a->setName(a->name().remove(0,7)); | 220 | a->setName(a->name().remove(0,7)); |
221 | 221 | ||
222 | mAttendees.append(a); | 222 | mAttendees.append(a); |
223 | if (doupdate) updated(); | 223 | if (doupdate) updated(); |
224 | } | 224 | } |
225 | 225 | ||
226 | #if 0 | 226 | #if 0 |
227 | void IncidenceBase::removeAttendee(Attendee *a) | 227 | void IncidenceBase::removeAttendee(Attendee *a) |
228 | { | 228 | { |
229 | if (mReadOnly) return; | 229 | if (mReadOnly) return; |
230 | mAttendees.removeRef(a); | 230 | mAttendees.removeRef(a); |
231 | updated(); | 231 | updated(); |
232 | } | 232 | } |
233 | 233 | ||
234 | void IncidenceBase::removeAttendee(const char *n) | 234 | void IncidenceBase::removeAttendee(const char *n) |
235 | { | 235 | { |
236 | Attendee *a; | 236 | Attendee *a; |
237 | 237 | ||
238 | if (mReadOnly) return; | 238 | if (mReadOnly) return; |
239 | for (a = mAttendees.first(); a; a = mAttendees.next()) | 239 | for (a = mAttendees.first(); a; a = mAttendees.next()) |
240 | if (a->getName() == n) { | 240 | if (a->getName() == n) { |
241 | mAttendees.remove(); | 241 | mAttendees.remove(); |
242 | break; | 242 | break; |
243 | } | 243 | } |
244 | } | 244 | } |
245 | #endif | 245 | #endif |
246 | 246 | ||
247 | void IncidenceBase::clearAttendees() | 247 | void IncidenceBase::clearAttendees() |
248 | { | 248 | { |
249 | if (mReadOnly) return; | 249 | if (mReadOnly) return; |
250 | mAttendees.clear(); | 250 | mAttendees.clear(); |
251 | } | 251 | } |
252 | 252 | ||
253 | #if 0 | 253 | #if 0 |
254 | Attendee *IncidenceBase::getAttendee(const char *n) const | 254 | Attendee *IncidenceBase::getAttendee(const char *n) const |
255 | { | 255 | { |
256 | QPtrListIterator<Attendee> qli(mAttendees); | 256 | QPtrListIterator<Attendee> qli(mAttendees); |
257 | 257 | ||
258 | qli.toFirst(); | 258 | qli.toFirst(); |
259 | while (qli) { | 259 | while (qli) { |
260 | if (qli.current()->getName() == n) | 260 | if (qli.current()->getName() == n) |
261 | return qli.current(); | 261 | return qli.current(); |
262 | ++qli; | 262 | ++qli; |
263 | } | 263 | } |
264 | return 0L; | 264 | return 0L; |
265 | } | 265 | } |
266 | #endif | 266 | #endif |
267 | 267 | ||
268 | Attendee *IncidenceBase::attendeeByMail(const QString &email) | 268 | Attendee *IncidenceBase::attendeeByMail(const QString &email) |
269 | { | 269 | { |
270 | QPtrListIterator<Attendee> qli(mAttendees); | 270 | QPtrListIterator<Attendee> qli(mAttendees); |
271 | 271 | ||
272 | qli.toFirst(); | 272 | qli.toFirst(); |
273 | while (qli) { | 273 | while (qli) { |
274 | if (qli.current()->email().lower() == email.lower()) | 274 | if (qli.current()->email().lower() == email.lower()) |
275 | return qli.current(); | 275 | return qli.current(); |
276 | ++qli; | 276 | ++qli; |
277 | } | 277 | } |
278 | return 0L; | 278 | return 0L; |
279 | } | 279 | } |
280 | 280 | ||
281 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) | 281 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) |
282 | { | 282 | { |
283 | QPtrListIterator<Attendee> qli(mAttendees); | 283 | QPtrListIterator<Attendee> qli(mAttendees); |
284 | 284 | ||
285 | QStringList mails = emails; | 285 | QStringList mails = emails; |
286 | if (!email.isEmpty()) { | 286 | if (!email.isEmpty()) { |
287 | mails.append(email); | 287 | mails.append(email); |
288 | } | 288 | } |
289 | qli.toFirst(); | 289 | qli.toFirst(); |
290 | while (qli) { | 290 | while (qli) { |
291 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { | 291 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { |
292 | if (qli.current()->email().lower() == (*it).lower()) | 292 | if (qli.current()->email().lower() == (*it).lower()) |
293 | return qli.current(); | 293 | return qli.current(); |
294 | } | 294 | } |
295 | 295 | ||
296 | ++qli; | 296 | ++qli; |
297 | } | 297 | } |
298 | return 0L; | 298 | return 0L; |
299 | } | 299 | } |
300 | 300 | ||
301 | void IncidenceBase::setDuration(int seconds) | 301 | void IncidenceBase::setDuration(int seconds) |
302 | { | 302 | { |
303 | mDuration = seconds; | 303 | mDuration = seconds; |
304 | setHasDuration(true); | 304 | setHasDuration(true); |
305 | } | 305 | } |
306 | 306 | ||
307 | int IncidenceBase::duration() const | 307 | int IncidenceBase::duration() const |
308 | { | 308 | { |
309 | return mDuration; | 309 | return mDuration; |
310 | } | 310 | } |
311 | 311 | ||
312 | void IncidenceBase::setHasDuration(bool b) | 312 | void IncidenceBase::setHasDuration(bool b) |
313 | { | 313 | { |
314 | mHasDuration = b; | 314 | mHasDuration = b; |
315 | } | 315 | } |
316 | 316 | ||
317 | bool IncidenceBase::hasDuration() const | 317 | bool IncidenceBase::hasDuration() const |
318 | { | 318 | { |
319 | return mHasDuration; | 319 | return mHasDuration; |
320 | } | 320 | } |
321 | 321 | ||
322 | void IncidenceBase::setSyncStatus(int stat) | 322 | void IncidenceBase::setSyncStatus(int stat) |
323 | { | 323 | { |
324 | if (mReadOnly) return; | 324 | if (mReadOnly) return; |
325 | mSyncStatus = stat; | 325 | mSyncStatus = stat; |
326 | } | 326 | } |
327 | 327 | ||
328 | int IncidenceBase::syncStatus() const | 328 | int IncidenceBase::syncStatus() const |
329 | { | 329 | { |
330 | return mSyncStatus; | 330 | return mSyncStatus; |
331 | } | 331 | } |
332 | 332 | ||
333 | void IncidenceBase::setPilotId( int id ) | 333 | void IncidenceBase::setPilotId( int id ) |
334 | { | 334 | { |
335 | if (mReadOnly) return; | 335 | if (mReadOnly) return; |
336 | mPilotId = id; | 336 | mPilotId = id; |
337 | } | 337 | } |
338 | 338 | ||
339 | int IncidenceBase::pilotId() const | 339 | int IncidenceBase::pilotId() const |
340 | { | 340 | { |
341 | return mPilotId; | 341 | return mPilotId; |
342 | } | 342 | } |
343 | 343 | ||
344 | int IncidenceBase::tempSyncStat() const | 344 | int IncidenceBase::tempSyncStat() const |
345 | { | 345 | { |
346 | return mTempSyncStat; | 346 | return mTempSyncStat; |
347 | } | 347 | } |
348 | void IncidenceBase::setTempSyncStat( int id ) | 348 | void IncidenceBase::setTempSyncStat( int id ) |
349 | { | 349 | { |
350 | if (mReadOnly) return; | 350 | if (mReadOnly) return; |
351 | mTempSyncStat = id; | 351 | mTempSyncStat = id; |
352 | } | 352 | } |
353 | 353 | ||
354 | void IncidenceBase::removeID(const QString &prof) | 354 | void IncidenceBase::removeID(const QString &prof) |
355 | { | 355 | { |
356 | mExternalId = KIdManager::removeId ( mExternalId, prof); | 356 | if ( prof.isEmpty() ) |
357 | mExternalId = ":"; | ||
358 | else | ||
359 | mExternalId = KIdManager::removeId ( mExternalId, prof); | ||
357 | 360 | ||
358 | } | 361 | } |
359 | void IncidenceBase::setID( const QString & prof , const QString & id ) | 362 | void IncidenceBase::setID( const QString & prof , const QString & id ) |
360 | { | 363 | { |
361 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); | 364 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); |
362 | } | 365 | } |
363 | QString IncidenceBase::getID( const QString & prof) | 366 | QString IncidenceBase::getID( const QString & prof) |
364 | { | 367 | { |
365 | return KIdManager::getId ( mExternalId, prof ); | 368 | return KIdManager::getId ( mExternalId, prof ); |
366 | } | 369 | } |
367 | 370 | ||
368 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: | 371 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: |
369 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 | 372 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 |
370 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) | 373 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) |
371 | { | 374 | { |
372 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); | 375 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); |
373 | } | 376 | } |
374 | QString IncidenceBase::getCsum( const QString & prof) | 377 | QString IncidenceBase::getCsum( const QString & prof) |
375 | { | 378 | { |
376 | return KIdManager::getCsum ( mExternalId, prof ); | 379 | return KIdManager::getCsum ( mExternalId, prof ); |
377 | } | 380 | } |
378 | 381 | ||
379 | void IncidenceBase::setIDStr( const QString & s ) | 382 | void IncidenceBase::setIDStr( const QString & s ) |
380 | { | 383 | { |
381 | if (mReadOnly) return; | 384 | if (mReadOnly) return; |
382 | mExternalId = s; | 385 | mExternalId = s; |
383 | } | 386 | } |
384 | 387 | ||
385 | QString IncidenceBase::IDStr() const | 388 | QString IncidenceBase::IDStr() const |
386 | { | 389 | { |
387 | return mExternalId ; | 390 | return mExternalId ; |
388 | } | 391 | } |
389 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) | 392 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) |
390 | { | 393 | { |
391 | if( !mObservers.contains(observer) ) mObservers.append( observer ); | 394 | if( !mObservers.contains(observer) ) mObservers.append( observer ); |
392 | } | 395 | } |
393 | 396 | ||
394 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) | 397 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) |
395 | { | 398 | { |
396 | mObservers.remove( observer ); | 399 | mObservers.remove( observer ); |
397 | } | 400 | } |
398 | 401 | ||
399 | void IncidenceBase::updated() | 402 | void IncidenceBase::updated() |
400 | { | 403 | { |
401 | QPtrListIterator<Observer> it(mObservers); | 404 | QPtrListIterator<Observer> it(mObservers); |
402 | while( it.current() ) { | 405 | while( it.current() ) { |
403 | Observer *o = it.current(); | 406 | Observer *o = it.current(); |
404 | ++it; | 407 | ++it; |
405 | o->incidenceUpdated( this ); | 408 | o->incidenceUpdated( this ); |
406 | } | 409 | } |
407 | } | 410 | } |